X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=dygraph.js;h=fe56d3d7915eaba418eea1ec681a101346bcd46b;hb=4731ec3a0b60f81e8ef26fc95a69b9751069686b;hp=348ef6c57ec96597009b74db60004bff89c01550;hpb=0b5828435e5514ddd94dfbf7ae0cadf7fe09b128;p=dygraphs.git diff --git a/dygraph.js b/dygraph.js index 348ef6c..fe56d3d 100644 --- a/dygraph.js +++ b/dygraph.js @@ -226,12 +226,12 @@ Dygraph.dateAxisLabelFormatter = function(date, granularity, opts) { if (granularity >= Dygraph.DECADAL) { return '' + year; } else if (granularity >= Dygraph.MONTHLY) { - return Dygraph.SHORT_MONTH_NAMES_[month] + ' ' + year; + return Dygraph.SHORT_MONTH_NAMES_[month] + ' ' + year; } else { var frac = hours * 3600 + mins * 60 + secs + 1e-3 * millis; if (frac === 0 || granularity >= Dygraph.DAILY) { - // e.g. '21Jan' (%d%b) - return Dygraph.zeropad(day) + Dygraph.SHORT_MONTH_NAMES_[month]; + // e.g. '21 Jan' (%d%b) + return Dygraph.zeropad(day) + ' ' + Dygraph.SHORT_MONTH_NAMES_[month]; } else { return Dygraph.hmsString_(hours, mins, secs); } @@ -290,8 +290,6 @@ Dygraph.DEFAULT_ATTRS = { axisTickSize: 3, axisLabelFontSize: 14, - xAxisLabelWidth: 50, - yAxisLabelWidth: 50, rightGap: 5, showRoller: false, @@ -312,9 +310,7 @@ Dygraph.DEFAULT_ATTRS = { stackedGraphNaNFill: 'all', hideOverlayOnMouseOut: true, - // TODO(danvk): support 'onmouseover' and 'never', and remove synonyms. - legend: 'onmouseover', // the only relevant value at the moment is 'always'. - + legend: 'onmouseover', stepPlot: false, avoidMinZero: false, xRangePad: 0, @@ -360,7 +356,8 @@ Dygraph.DEFAULT_ATTRS = { // per-axis options axes: { x: { - pixelsPerLabel: 60, + pixelsPerLabel: 70, + axisLabelWidth: 60, axisLabelFormatter: Dygraph.dateAxisLabelFormatter, valueFormatter: Dygraph.dateValueFormatter, drawGrid: true, @@ -369,6 +366,7 @@ Dygraph.DEFAULT_ATTRS = { ticker: null // will be set in dygraph-tickers.js }, y: { + axisLabelWidth: 50, pixelsPerLabel: 30, valueFormatter: Dygraph.numberValueFormatter, axisLabelFormatter: Dygraph.numberAxisLabelFormatter, @@ -378,10 +376,11 @@ Dygraph.DEFAULT_ATTRS = { ticker: null // will be set in dygraph-tickers.js }, y2: { + axisLabelWidth: 50, pixelsPerLabel: 30, valueFormatter: Dygraph.numberValueFormatter, axisLabelFormatter: Dygraph.numberAxisLabelFormatter, - drawAxis: false, + drawAxis: true, // only applies when there are two axes of data. drawGrid: false, independentTicks: false, ticker: null // will be set in dygraph-tickers.js @@ -2154,7 +2153,7 @@ Dygraph.prototype.updateSelection_ = function(opt_animFraction) { * legend. The selection can be cleared using clearSelection() and queried * using getSelection(). * @param {number} row Row number that should be highlighted (i.e. appear with - * hover dots on the chart). Set to false to clear any selection. + * hover dots on the chart). * @param {seriesName} optional series name to highlight that series with the * the highlightSeriesOpts setting. * @param { locked } optional If true, keep seriesName selected when mousing @@ -2317,7 +2316,7 @@ Dygraph.prototype.addXTicks_ = function() { var xTicks = xAxisOptionsView('ticker')( range[0], range[1], - this.width_, // TODO(danvk): should be area.width + this.plotter_.area.w, // TODO(danvk): should be area.width xAxisOptionsView, this); // var msg = 'ticker(' + range[0] + ', ' + range[1] + ', ' + this.width_ + ', ' + this.attr_('pixelsPerXLabel') + ') -> ' + JSON.stringify(xTicks); @@ -2971,7 +2970,7 @@ Dygraph.prototype.computeYAxisRanges_ = function(extremes) { var ticker = opts('ticker'); axis.ticks = ticker(axis.computedValueRange[0], axis.computedValueRange[1], - this.height_, // TODO(danvk): should be area.height + this.plotter_.area.h, opts, this); // Define the first independent axis as primary axis. @@ -3002,7 +3001,7 @@ Dygraph.prototype.computeYAxisRanges_ = function(extremes) { axis.ticks = ticker(axis.computedValueRange[0], axis.computedValueRange[1], - this.height_, // TODO(danvk): should be area.height + this.plotter_.area.h, opts, this, tick_values); @@ -3587,6 +3586,8 @@ Dygraph.mapLegacyOptions_ = function(attrs) { map('drawXAxis', 'x', 'drawAxis'); map('drawYGrid', 'y', 'drawGrid'); map('drawYAxis', 'y', 'drawAxis'); + map('xAxisLabelWidth', 'x', 'axisLabelWidth'); + map('yAxisLabelWidth', 'y', 'axisLabelWidth'); return my_attrs; };