Ignore:
Timestamp:
01/22/16 06:25:19 (8 years ago)
Author:
nanardon
Message:

Update timeline

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LATMOS-Accounts-Web/root/static/js/timeline/timeframe.js

    r1611 r1651  
    3232 
    3333                this.outerWidth = this.container.innerWidth(); 
    34                 this.outerHeight = 100; 
     34                this.outerHeight = 140; 
    3535                this.paddingX = 40; 
    36                 this.paddingY = 20; 
     36                this.paddingY = 60; 
    3737 
    3838                this.width = this.outerWidth - (this.paddingX * 2); 
     
    112112        Timeline.prototype.addEvent = function (eventData, category) { 
    113113                var event = { 
    114                         name: eventData.name, 
    115                         date: parseDateString(eventData.date) 
     114                        name:    eventData.name, 
     115                        date:    parseDateString(eventData.date), 
     116            options: eventData.options ? eventData.options : {}, 
    116117                }; 
    117118                category.events.push(event); 
     
    227228                        .appendTo(group); 
    228229 
     230        var color =  
     231              event.options.type == 'alarm'      ? 'red' 
     232            : event.options.type == 'employment' ? 'green' 
     233            : 'blue'; 
     234        var labelHeigth = event.options.type == 'alarm' 
     235            ? 32 
     236            : 12; 
    229237        var line = $svg.line( 
    230238           x, 
    231239           this.height - this.options.textHeight - this.options.tickHeight + this.paddingY, 
    232240           x, 
    233            this.height - this.options.textHeight - this.options.tickHeight + this.paddingY - 24 
     241           this.height - this.options.textHeight - this.options.tickHeight + this.paddingY - labelHeigth 
    234242        ) 
    235             .attr("stroke", "blue") 
     243            .attr("stroke", color) 
    236244            .attr("stroke-width", 1) 
    237245            .appendTo(group);  
     
    239247                var label = $svg.text( 
    240248                        x, 
    241                         this.height - this.options.textHeight - this.options.tickHeight + this.paddingY - 32, 
     249                        this.height - this.options.textHeight - this.options.tickHeight + this.paddingY - (labelHeigth + 8), 
    242250                        event.name, 
    243251                        { 
    244                                 fill: "blue", 
     252                                fill: color, 
    245253                                "font-size": "12", 
    246254                                "text-anchor": "middle" 
     
    248256                ) 
    249257                        .appendTo(group); 
     258 
     259        if (event.options.showdate) { 
     260            var line = $svg.line( 
     261                x, 
     262                this.height - this.options.textHeight - this.options.tickHeight + this.paddingY, 
     263                x, 
     264                this.height - this.options.textHeight - this.options.tickHeight + this.paddingY + 16 
     265            ) 
     266                .attr("stroke", color) 
     267                .attr("stroke-width", 1) 
     268                .appendTo(group); 
     269 
     270            var label = $svg.text( 
     271                x, 
     272                this.height - this.options.textHeight - this.options.tickHeight + this.paddingY + 24, 
     273                $.datepicker.formatDate('dd/mm/yy', event.date), 
     274                { 
     275                    fill: color, 
     276                    "font-size": "11", 
     277                    "text-anchor": "middle" 
     278                } 
     279            ) 
     280                .appendTo(group); 
     281        } 
    250282        }; 
    251283 
     
    275307                var label = $svg.text( 
    276308                        (startX + endX) / 2, 
    277                         this.height + this.options.textHeight - this.options.tickHeight + this.paddingY + 8, 
     309                        this.height + this.options.textHeight - this.options.tickHeight + this.paddingY + 24, 
    278310                        span.name, 
    279311                        { 
Note: See TracChangeset for help on using the changeset viewer.