Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/24/14 09:16:42 (10 years ago)
Author:
mroscoe
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Scripts/jqPlot/plugins/jqplot.dateAxisRenderer.js

    r9646 r11222  
    33 * Pure JavaScript plotting plugin using jQuery
    44 *
    5  * Version: 1.0.0b2_r1012
     5 * Version: 1.0.8
     6 * Revision: 1250
    67 *
    7  * Copyright (c) 2009-2011 Chris Leonello
     8 * Copyright (c) 2009-2013 Chris Leonello
    89 * jqPlot is currently available for use in all personal or commercial projects
    910 * under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
     
    3334     * A plugin for a jqPlot to render an axis as a series of date values.
    3435     * This renderer has no options beyond those supplied by the <Axis> class.
    35      * It supplies it's own tick formatter, so the tickOptions.formatter option
     36     * It supplies its own tick formatter, so the tickOptions.formatter option
    3637     * should not be overridden.
    3738     *
     
    334335        var threshold = 30;
    335336        var insetMult = 1;
     337        var daTickInterval = null;
     338       
     339        // if user specified a tick interval, convert to usable.
     340        if (this.tickInterval != null)
     341        {
     342            // if interval is a number or can be converted to one, use it.
     343            // Assume it is in SECONDS!!!
     344            if (Number(this.tickInterval)) {
     345                daTickInterval = [Number(this.tickInterval), 'seconds'];
     346            }
     347            // else, parse out something we can build from.
     348            else if (typeof this.tickInterval == "string") {
     349                var parts = this.tickInterval.split(' ');
     350                if (parts.length == 1) {
     351                    daTickInterval = [1, parts[0]];
     352                }
     353                else if (parts.length == 2) {
     354                    daTickInterval = [parts[0], parts[1]];
     355                }
     356            }
     357        }
    336358
    337359        var tickInterval = this.tickInterval;
     
    401423        ////////
    402424
     425        // special case when there is only one point, make three tick marks to center the point
     426        else if (this.min == null && this.max == null && db.min == db.max)
     427        {
     428             var onePointOpts = $.extend(true, {}, this.tickOptions, {name: this.name, value: null});
     429             var delta = 300000;
     430             this.min = db.min - delta;
     431             this.max = db.max + delta;
     432             this.numberTicks = 3;
     433
     434             for(var i=this.min;i<=this.max;i+= delta)
     435             {
     436                 onePointOpts.value = i;
     437
     438                 var t = new this.tickRenderer(onePointOpts);
     439
     440                 if (this._overrideFormatString && this._autoFormatString != '') {
     441                    t.formatString = this._autoFormatString;
     442                 }
     443
     444                 t.showLabel = false;
     445                 t.showMark = false;
     446
     447                 this._ticks.push(t);
     448             }
     449
     450             if(this.showTicks) {
     451                 this._ticks[1].showLabel = true;
     452             }
     453             if(this.showTickMarks) {
     454                 this._ticks[1].showTickMarks = true;
     455             }                   
     456        }
    403457        // if user specified min and max are null, we set those to make best ticks.
    404458        else if (this.min == null && this.max == null) {
     459
    405460            var opts = $.extend(true, {}, this.tickOptions, {name: this.name, value: null});
     461
    406462            // want to find a nice interval
    407463            var nttarget,
     
    425481
    426482            // If tickInterval is specified, we'll try to honor it.
    427             // Not gauranteed to get this interval, but we'll get as close as
     483            // Not guaranteed to get this interval, but we'll get as close as
    428484            // we can.
    429485            // tickInterval will be used before numberTicks, that is if
    430486            // both are specified, numberTicks will be ignored.
    431487            else if (this.tickInterval) {
    432                 titarget = this.tickInterval;
     488                titarget = new $.jsDate(0).add(daTickInterval[0], daTickInterval[1]).getTime();
    433489            }
    434490
    435491            // if numberTicks specified, try to honor it.
    436             // Not gauranteed, but will try to get close.
     492            // Not guaranteed, but will try to get close.
    437493            else if (this.numberTicks) {
    438494                nttarget = this.numberTicks;
     
    446502                this._autoFormatString = ret[1];
    447503
    448                 min = Math.floor(min/tempti) * tempti;
    449504                min = new $.jsDate(min);
    450                 min = min.getTime();
     505                min = Math.floor((min.getTime() - min.getUtcOffset())/tempti) * tempti + min.getUtcOffset();
    451506
    452507                nttarget = Math.ceil((max - min) / tempti) + 1;
     
    606661            }
    607662           
    608             // if user specified a tick interval, convert to usable.
    609             if (this.tickInterval != null)
    610             {
    611                 // if interval is a number or can be converted to one, use it.
    612                 // Assume it is in SECONDS!!!
    613                 if (Number(this.tickInterval)) {
    614                     this.daTickInterval = [Number(this.tickInterval), 'seconds'];
    615                 }
    616                 // else, parse out something we can build from.
    617                 else if (typeof this.tickInterval == "string") {
    618                     var parts = this.tickInterval.split(' ');
    619                     if (parts.length == 1) {
    620                         this.daTickInterval = [1, parts[0]];
    621                     }
    622                     else if (parts.length == 2) {
    623                         this.daTickInterval = [parts[0], parts[1]];
    624                     }
    625                 }
     663            if (this.tickInterval != null && daTickInterval != null) {
     664                this.daTickInterval = daTickInterval;
    626665            }
    627666           
Note: See TracChangeset for help on using the changeset viewer.