From: Jukka Kurkela Date: Fri, 15 Nov 2019 17:11:13 +0000 (+0200) Subject: Move scale defining options up from `ticks` (#6738) X-Git-Tag: v3.0.0-alpha~235 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7f97adf5a05d59ce388f62d958926f598fa0bcf5;p=thirdparty%2FChart.js.git Move scale defining options up from `ticks` (#6738) * Move scale defining options up from `ticks` * Include `ticks.reverse` in v3-migration --- diff --git a/docs/README.md b/docs/README.md index 9592ecf2c..c82e93872 100644 --- a/docs/README.md +++ b/docs/README.md @@ -44,9 +44,7 @@ var myChart = new Chart(ctx, { options: { scales: { yAxes: [{ - ticks: { - beginAtZero: true - } + beginAtZero: true }] } } diff --git a/docs/axes/README.md b/docs/axes/README.md index e400f2a76..c91b9d220 100644 --- a/docs/axes/README.md +++ b/docs/axes/README.md @@ -5,6 +5,7 @@ Axes are an integral part of a chart. They are used to determine how data maps t In a radial chart, such as a radar chart or a polar area chart, there is a single axis that maps points in the angular and radial directions. These are known as ['radial axes'](./radial/README.md#radial-axes). Scales in Chart.js >v2.0 are significantly more powerful, but also different than those of v1.0. + * Multiple X & Y axes are supported. * A built-in label auto-skip feature detects would-be overlapping ticks and labels and removes every nth label to keep things displaying normally. * Scale titles are supported. @@ -21,6 +22,7 @@ The following properties are common to all axes provided by Chart.js. | `weight` | `number` | `0` | The weight used to sort the axis. Higher weights are further away from the chart area. ### Callbacks + There are a number of config callbacks that can be used to change parameters in the scale at different points in the update process. | Name | Arguments | Description @@ -48,11 +50,10 @@ For example, to set the minimum value of 0 for all linear scales, you would do t ```javascript Chart.scaleService.updateScaleDefaults('linear', { - ticks: { - min: 0 - } + min: 0 }); ``` ## Creating New Axes + To create a new axis, see the [developer docs](../developers/axes.md). diff --git a/docs/axes/cartesian/category.md b/docs/axes/cartesian/category.md index 690b712f5..acb140cbe 100644 --- a/docs/axes/cartesian/category.md +++ b/docs/axes/cartesian/category.md @@ -59,9 +59,7 @@ let chart = new Chart(ctx, { options: { scales: { xAxes: [{ - ticks: { - min: 'March' - } + min: 'March' }] } } diff --git a/docs/axes/cartesian/linear.md b/docs/axes/cartesian/linear.md index ef4833b56..52b287dfe 100644 --- a/docs/axes/cartesian/linear.md +++ b/docs/axes/cartesian/linear.md @@ -2,18 +2,23 @@ The linear scale is use to chart numerical data. It can be placed on either the x or y axis. The scatter chart type automatically configures a line chart to use one of these scales for the x axis. As the name suggests, linear interpolation is used to determine where a value lies on the axis. +## Configuration Options + +| Name | Type | Description +| ---- | ---- | ----------- +| `beginAtZero` | `boolean` | if true, scale will include 0 if it is not already included. +| `suggestedMax` | `number` | Adjustment used when calculating the maximum data value. [more...](#axis-range-settings) +| `suggestedMin` | `number` | Adjustment used when calculating the minimum data value. [more...](#axis-range-settings) + ## Tick Configuration Options The following options are provided by the linear scale. They are all located in the `ticks` sub options. These options extend the [common tick configuration](README.md#tick-configuration). | Name | Type | Default | Description | ---- | ---- | ------- | ----------- -| `beginAtZero` | `boolean` | | if true, scale will include 0 if it is not already included. | `maxTicksLimit` | `number` | `11` | Maximum number of ticks and gridlines to show. | `precision` | `number` | | if defined and `stepSize` is not specified, the step size will be rounded to this many decimal places. | `stepSize` | `number` | | User defined fixed step size for the scale. [more...](#step-size) -| `suggestedMax` | `number` | | Adjustment used when calculating the maximum data value. [more...](#axis-range-settings) -| `suggestedMin` | `number` | | Adjustment used when calculating the minimum data value. [more...](#axis-range-settings) ## Axis Range Settings @@ -22,8 +27,8 @@ Given the number of axis range settings, it is important to understand how they The `suggestedMax` and `suggestedMin` settings only change the data values that are used to scale the axis. These are useful for extending the range of the axis while maintaining the auto fit behaviour. ```javascript -let minDataValue = Math.min(mostNegativeValue, options.ticks.suggestedMin); -let maxDataValue = Math.max(mostPositiveValue, options.ticks.suggestedMax); +let minDataValue = Math.min(mostNegativeValue, options.suggestedMin); +let maxDataValue = Math.max(mostPositiveValue, options.suggestedMax); ``` In this example, the largest positive value is 50, but the data maximum is expanded out to 100. However, because the lowest data value is below the `suggestedMin` setting, it is ignored. @@ -41,10 +46,8 @@ let chart = new Chart(ctx, { options: { scales: { yAxes: [{ - ticks: { - suggestedMin: 50, - suggestedMax: 100 - } + suggestedMin: 50, + suggestedMax: 100 }] } } @@ -54,6 +57,7 @@ let chart = new Chart(ctx, { In contrast to the `suggested*` settings, the `min` and `max` settings set explicit ends to the axes. When these are set, some data points may not be visible. ## Step Size + If set, the scale ticks will be enumerated by multiple of `stepSize`, having one tick per increment. If not set, the ticks are labeled automatically using the nice numbers algorithm. This example sets up a chart with a y axis that creates ticks at `0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5`. @@ -62,9 +66,9 @@ This example sets up a chart with a y axis that creates ticks at `0, 0.5, 1, 1.5 let options = { scales: { yAxes: [{ + max: 5, + min: 0, ticks: { - max: 5, - min: 0, stepSize: 0.5 } }] diff --git a/docs/axes/radial/linear.md b/docs/axes/radial/linear.md index 72e0edd06..ca89aa324 100644 --- a/docs/axes/radial/linear.md +++ b/docs/axes/radial/linear.md @@ -8,14 +8,20 @@ The following additional configuration options are provided by the radial linear The axis has configuration properties for ticks, angle lines (line that appear in a radar chart outward from the center), pointLabels (labels around the edge in a radar chart). The following sections define each of the properties in those sections. -| Name | Type | Description -| ---- | ---- | ----------- -| `angleLines` | `object` | Angle line configuration. [more...](#angle-line-options) -| `gridLines` | `object` | Grid line configuration. [more...](../styling.md#grid-line-configuration) -| `pointLabels` | `object` | Point label configuration. [more...](#point-label-options) -| `ticks` | `object` | Tick configuration. [more...](#tick-options) +| Name | Type | Default | Description +| ---- | ---- | ------- | ----------- +| `angleLines` | `object` | | Angle line configuration. [more...](#angle-line-options) +| `beginAtZero` | `boolean` | `false` | if true, scale will include 0 if it is not already included. +| `gridLines` | `object` | | Grid line configuration. [more...](../styling.md#grid-line-configuration) +| `min` | `number` | | User defined minimum number for the scale, overrides minimum value from data. [more...](#axis-range-settings) +| `max` | `number` | | User defined maximum number for the scale, overrides maximum value from data. [more...](#axis-range-settings) +| `pointLabels` | `object` | | Point label configuration. [more...](#point-label-options) +| `suggestedMax` | `number` | | Adjustment used when calculating the maximum data value. [more...](#axis-range-settings) +| `suggestedMin` | `number` | | Adjustment used when calculating the minimum data value. [more...](#axis-range-settings) +| `ticks` | `object` | | Tick configuration. [more...](#tick-options) ## Tick Options + The following options are provided by the linear scale. They are all located in the `ticks` sub options. The [common tick configuration](../styling.md#tick-configuration) options are supported by this axis. | Name | Type | Default | Description @@ -23,14 +29,9 @@ The following options are provided by the linear scale. They are all located in | `backdropColor` | `Color` | `'rgba(255, 255, 255, 0.75)'` | Color of label backdrops. | `backdropPaddingX` | `number` | `2` | Horizontal padding of label backdrop. | `backdropPaddingY` | `number` | `2` | Vertical padding of label backdrop. -| `beginAtZero` | `boolean` | `false` | if true, scale will include 0 if it is not already included. -| `min` | `number` | | User defined minimum number for the scale, overrides minimum value from data. [more...](#axis-range-settings) -| `max` | `number` | | User defined maximum number for the scale, overrides maximum value from data. [more...](#axis-range-settings) | `maxTicksLimit` | `number` | `11` | Maximum number of ticks and gridlines to show. | `precision` | `number` | | if defined and `stepSize` is not specified, the step size will be rounded to this many decimal places. | `stepSize` | `number` | | User defined fixed step size for the scale. [more...](#step-size) -| `suggestedMax` | `number` | | Adjustment used when calculating the maximum data value. [more...](#axis-range-settings) -| `suggestedMin` | `number` | | Adjustment used when calculating the minimum data value. [more...](#axis-range-settings) | `showLabelBackdrop` | `boolean` | `true` | If true, draw a background behind the tick labels. ## Axis Range Settings @@ -58,10 +59,8 @@ let chart = new Chart(ctx, { }, options: { scale: { - ticks: { - suggestedMin: 50, - suggestedMax: 100 - } + suggestedMin: 50, + suggestedMax: 100 } } }); @@ -77,9 +76,9 @@ This example sets up a chart with a y axis that creates ticks at `0, 0.5, 1, 1.5 ```javascript let options = { scale: { + max: 5, + min: 0, ticks: { - max: 5, - min: 0, stepSize: 0.5 } } diff --git a/docs/charts/bar.md b/docs/charts/bar.md index f2b0193bd..8cf78f995 100644 --- a/docs/charts/bar.md +++ b/docs/charts/bar.md @@ -42,9 +42,7 @@ A bar chart provides a way of showing data values represented as vertical bars. "options": { "scales": { "yAxes": [{ - "ticks": { - "beginAtZero": true - } + "beginAtZero": true }] } } @@ -52,6 +50,7 @@ A bar chart provides a way of showing data values represented as vertical bars. {% endchartjs %} ## Example Usage + ```javascript var myBarChart = new Chart(ctx, { type: 'bar', @@ -302,9 +301,7 @@ A horizontal bar chart is a variation on a vertical bar chart. It is sometimes u "options": { "scales": { "xAxes": [{ - "ticks": { - "beginAtZero": true - } + "beginAtZero": true }] } } @@ -312,6 +309,7 @@ A horizontal bar chart is a variation on a vertical bar chart. It is sometimes u {% endchartjs %} ## Example + ```javascript var myBarChart = new Chart(ctx, { type: 'horizontalBar', @@ -321,6 +319,7 @@ var myBarChart = new Chart(ctx, { ``` ### Config Options + The configuration options for the horizontal bar chart are the same as for the [bar chart](#scale-configuration). However, any options specified on the x axis in a bar chart, are applied to the y axis in a horizontal bar chart. The default horizontal bar configuration is specified in `Chart.defaults.horizontalBar`. diff --git a/docs/charts/mixed.md b/docs/charts/mixed.md index 5ead1fb34..96f541672 100644 --- a/docs/charts/mixed.md +++ b/docs/charts/mixed.md @@ -62,9 +62,7 @@ At this point we have a chart rendering how we'd like. It's important to note th "options": { "scales": { "yAxes": [{ - "ticks": { - "beginAtZero": true - } + "beginAtZero": true }] } } diff --git a/docs/charts/radar.md b/docs/charts/radar.md index 0e993f597..f11eb3888 100644 --- a/docs/charts/radar.md +++ b/docs/charts/radar.md @@ -172,10 +172,8 @@ options = { angleLines: { display: false }, - ticks: { - suggestedMin: 50, - suggestedMax: 100 - } + suggestedMin: 50, + suggestedMax: 100 } }; ``` diff --git a/docs/getting-started/usage.md b/docs/getting-started/usage.md index 0a0d48b99..5b6311d91 100644 --- a/docs/getting-started/usage.md +++ b/docs/getting-started/usage.md @@ -54,9 +54,7 @@ var myChart = new Chart(ctx, { options: { scales: { yAxes: [{ - ticks: { - beginAtZero: true - } + beginAtZero: true }] } } diff --git a/docs/getting-started/v3-migration.md b/docs/getting-started/v3-migration.md index a797db8e2..b16a3066b 100644 --- a/docs/getting-started/v3-migration.md +++ b/docs/getting-started/v3-migration.md @@ -37,9 +37,15 @@ Chart.js is no longer providing the `Chart.bundle.js` and `Chart.bundle.min.js`. * `scales.[x/y]Axes.categoryPercentage` was moved to dataset option `categoryPercentage` * `scales.[x/y]Axes.minBarLength` was moved to dataset option `minBarLength` * `scales.[x/y]Axes.maxBarThickness` was moved to dataset option `maxBarThickness` +* `scales.[x/y]Axes.ticks.beginAtZero` was renamed to `scales.[x/y]Axes.beginAtZero` +* `scales.[x/y]Axes.ticks.max` was renamed to `scales.[x/y]Axes.max` +* `scales.[x/y]Axes.ticks.min` was renamed to `scales.[x/y]Axes.min` +* `scales.[x/y]Axes.ticks.reverse` was renamed to `scales.[x/y]Axes.reverse` +* `scales.[x/y]Axes.ticks.suggestedMax` was renamed to `scales.[x/y]Axes.suggestedMax` +* `scales.[x/y]Axes.ticks.suggestedMin` was renamed to `scales.[x/y]Axes.suggestedMin` * `scales.[x/y]Axes.time.format` was renamed to `scales.[x/y]Axes.time.parser` -* `scales.[x/y]Axes.time.min` was renamed to `scales.[x/y]Axes.ticks.min` -* `scales.[x/y]Axes.time.max` was renamed to `scales.[x/y]Axes.ticks.max` +* `scales.[x/y]Axes.time.max` was renamed to `scales.[x/y]Axes.max` +* `scales.[x/y]Axes.time.min` was renamed to `scales.[x/y]Axes.min` ## Developer migration diff --git a/samples/charts/line/interpolation-modes.html b/samples/charts/line/interpolation-modes.html index 037b07d2a..fa5717dbf 100644 --- a/samples/charts/line/interpolation-modes.html +++ b/samples/charts/line/interpolation-modes.html @@ -76,10 +76,8 @@ display: true, labelString: 'Value' }, - ticks: { - suggestedMin: -10, - suggestedMax: 200, - } + suggestedMin: -10, + suggestedMax: 200, }] } } diff --git a/samples/charts/radar.html b/samples/charts/radar.html index 3f75863d1..1b2f4095c 100644 --- a/samples/charts/radar.html +++ b/samples/charts/radar.html @@ -72,9 +72,7 @@ text: 'Chart.js Radar Chart' }, scale: { - ticks: { - beginAtZero: true - } + beginAtZero: true } } }; diff --git a/samples/scales/gridlines-display.html b/samples/scales/gridlines-display.html index 407dbe6ee..2569a1e79 100644 --- a/samples/scales/gridlines-display.html +++ b/samples/scales/gridlines-display.html @@ -60,9 +60,9 @@ }], yAxes: [{ gridLines: gridlines, + min: 0, + max: 100, ticks: { - min: 0, - max: 100, stepSize: 10 } }] diff --git a/samples/scales/gridlines-style.html b/samples/scales/gridlines-style.html index ed5ea5d68..9dabae293 100644 --- a/samples/scales/gridlines-style.html +++ b/samples/scales/gridlines-style.html @@ -49,9 +49,9 @@ drawBorder: false, color: ['pink', 'red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'purple'] }, + min: 0, + max: 100, ticks: { - min: 0, - max: 100, stepSize: 10 } }] diff --git a/samples/scales/linear/min-max-suggested.html b/samples/scales/linear/min-max-suggested.html index 83ce7bc07..81512ca92 100644 --- a/samples/scales/linear/min-max-suggested.html +++ b/samples/scales/linear/min-max-suggested.html @@ -45,13 +45,11 @@ }, scales: { yAxes: [{ - ticks: { - // the data minimum used for determining the ticks is Math.min(dataMin, suggestedMin) - suggestedMin: 10, + // the data minimum used for determining the ticks is Math.min(dataMin, suggestedMin) + suggestedMin: 10, - // the data maximum used for determining the ticks is Math.max(dataMax, suggestedMax) - suggestedMax: 50 - } + // the data maximum used for determining the ticks is Math.max(dataMax, suggestedMax) + suggestedMax: 50 }] } } diff --git a/samples/scales/linear/min-max.html b/samples/scales/linear/min-max.html index f0c87be85..5a8981017 100644 --- a/samples/scales/linear/min-max.html +++ b/samples/scales/linear/min-max.html @@ -45,10 +45,8 @@ }, scales: { yAxes: [{ - ticks: { - min: 10, - max: 50 - } + min: 10, + max: 50 }] } } diff --git a/samples/scales/linear/step-size.html b/samples/scales/linear/step-size.html index 2ee0c5756..ac667cc04 100644 --- a/samples/scales/linear/step-size.html +++ b/samples/scales/linear/step-size.html @@ -94,10 +94,9 @@ display: true, labelString: 'Value' }, + min: 0, + max: 100, ticks: { - min: 0, - max: 100, - // forces step size to be 5 units stepSize: 5 } diff --git a/samples/scales/non-numeric-y.html b/samples/scales/non-numeric-y.html index e7eb2776a..09c9a61ca 100644 --- a/samples/scales/non-numeric-y.html +++ b/samples/scales/non-numeric-y.html @@ -54,9 +54,7 @@ display: true, labelString: 'Request State' }, - ticks: { - reverse: true - } + reverse: true }] } } diff --git a/src/controllers/controller.polarArea.js b/src/controllers/controller.polarArea.js index 0272d6e46..4bd83c9d9 100644 --- a/src/controllers/controller.polarArea.js +++ b/src/controllers/controller.polarArea.js @@ -13,14 +13,12 @@ defaults._set('polarArea', { angleLines: { display: false }, + beginAtZero: true, gridLines: { circular: true }, pointLabels: { display: false - }, - ticks: { - beginAtZero: true } }, diff --git a/src/core/core.controller.js b/src/core/core.controller.js index c1ca43a3d..a1325394a 100644 --- a/src/core/core.controller.js +++ b/src/core/core.controller.js @@ -392,8 +392,8 @@ helpers.extend(Chart.prototype, /** @lends Chart */ { } // parse min/max value, so we can properly determine min/max for other scales - scale._userMin = scale._parse(scale.options.ticks.min); - scale._userMax = scale._parse(scale.options.ticks.max); + scale._userMin = scale._parse(scale.options.min); + scale._userMax = scale._parse(scale.options.max); // TODO(SB): I think we should be able to remove this custom case (options.scale) // and consider it as a regular scale part of the "scales"" map only! This would diff --git a/src/core/core.datasetController.js b/src/core/core.datasetController.js index d9adc2ef9..541da7775 100644 --- a/src/core/core.datasetController.js +++ b/src/core/core.datasetController.js @@ -50,10 +50,10 @@ function listenArrayEvents(array, listener) { function scaleClip(scale, allowedOverflow) { - var tickOpts = scale && scale.options.ticks || {}; - var reverse = tickOpts.reverse; - var min = tickOpts.min === undefined ? allowedOverflow : 0; - var max = tickOpts.max === undefined ? allowedOverflow : 0; + var opts = scale && scale.options || {}; + var reverse = opts.reverse; + var min = opts.min === undefined ? allowedOverflow : 0; + var max = opts.max === undefined ? allowedOverflow : 0; return { start: reverse ? max : min, end: reverse ? min : max diff --git a/src/core/core.scale.js b/src/core/core.scale.js index a06438eba..5b59f348d 100644 --- a/src/core/core.scale.js +++ b/src/core/core.scale.js @@ -16,6 +16,8 @@ defaults._set('scale', { display: true, position: 'left', offset: false, + reverse: false, + beginAtZero: false, // grid line settings gridLines: { @@ -48,12 +50,10 @@ defaults._set('scale', { // label settings ticks: { - beginAtZero: false, minRotation: 0, maxRotation: 50, mirror: false, padding: 0, - reverse: false, display: true, autoSkip: true, autoSkipPadding: 0, @@ -530,7 +530,7 @@ class Scale extends Element { */ _configure() { var me = this; - var reversePixels = me.options.ticks.reverse; + var reversePixels = me.options.reverse; var startPixel, endPixel; if (me.isHorizontal()) { @@ -1291,7 +1291,7 @@ class Scale extends Element { var scaleLabelAlign = scaleLabel.align; var position = options.position; var rotation = 0; - var isReverse = me.options.ticks.reverse; + var isReverse = me.options.reverse; var scaleLabelX, scaleLabelY, textAlign; if (me.isHorizontal()) { diff --git a/src/plugins/plugin.filler.js b/src/plugins/plugin.filler.js index 00000e4fd..fd69b8ff4 100644 --- a/src/plugins/plugin.filler.js +++ b/src/plugins/plugin.filler.js @@ -156,8 +156,8 @@ function computeCircularBoundary(source) { return null; } - start = options.ticks.reverse ? scale.max : scale.min; - end = options.ticks.reverse ? scale.min : scale.max; + start = options.reverse ? scale.max : scale.min; + end = options.reverse ? scale.min : scale.max; center = scale.getPointPositionForValue(0, start); for (i = 0; i < length; ++i) { point = fill === 'start' || fill === 'end' diff --git a/src/scales/scale.linear.js b/src/scales/scale.linear.js index 84c3b19c5..36a0fa62c 100644 --- a/src/scales/scale.linear.js +++ b/src/scales/scale.linear.js @@ -28,7 +28,7 @@ module.exports = LinearScaleBase.extend({ me.min = 0; } - // Common base implementation to handle ticks.min, ticks.max, ticks.beginAtZero + // Common base implementation to handle min, max, beginAtZero me.handleTickRangeOptions(); }, diff --git a/src/scales/scale.linearbase.js b/src/scales/scale.linearbase.js index cff6830ea..a41e8c584 100644 --- a/src/scales/scale.linearbase.js +++ b/src/scales/scale.linearbase.js @@ -98,12 +98,11 @@ module.exports = Scale.extend({ handleTickRangeOptions: function() { var me = this; var opts = me.options; - var tickOpts = opts.ticks; // If we are forcing it to begin at 0, but 0 will already be rendered on the chart, // do nothing since that would make the chart weird. If the user really wants a weird chart // axis, they can manually override it - if (tickOpts.beginAtZero) { + if (opts.beginAtZero) { var minSign = helpers.sign(me.min); var maxSign = helpers.sign(me.max); @@ -116,26 +115,26 @@ module.exports = Scale.extend({ } } - var setMin = tickOpts.min !== undefined || tickOpts.suggestedMin !== undefined; - var setMax = tickOpts.max !== undefined || tickOpts.suggestedMax !== undefined; + var setMin = opts.min !== undefined || opts.suggestedMin !== undefined; + var setMax = opts.max !== undefined || opts.suggestedMax !== undefined; - if (tickOpts.min !== undefined) { - me.min = tickOpts.min; - } else if (tickOpts.suggestedMin !== undefined) { + if (opts.min !== undefined) { + me.min = opts.min; + } else if (opts.suggestedMin !== undefined) { if (me.min === null) { - me.min = tickOpts.suggestedMin; + me.min = opts.suggestedMin; } else { - me.min = Math.min(me.min, tickOpts.suggestedMin); + me.min = Math.min(me.min, opts.suggestedMin); } } - if (tickOpts.max !== undefined) { - me.max = tickOpts.max; - } else if (tickOpts.suggestedMax !== undefined) { + if (opts.max !== undefined) { + me.max = opts.max; + } else if (opts.suggestedMax !== undefined) { if (me.max === null) { - me.max = tickOpts.suggestedMax; + me.max = opts.suggestedMax; } else { - me.max = Math.max(me.max, tickOpts.suggestedMax); + me.max = Math.max(me.max, opts.suggestedMax); } } @@ -143,7 +142,7 @@ module.exports = Scale.extend({ // We set the min or the max but not both. // So ensure that our range is good // Inverted or 0 length range can happen when - // ticks.min is set, and no datasets are visible + // min is set, and no datasets are visible if (me.min >= me.max) { if (setMin) { me.max = me.min + 1; @@ -156,7 +155,7 @@ module.exports = Scale.extend({ if (me.min === me.max) { me.max++; - if (!tickOpts.beginAtZero) { + if (!opts.beginAtZero) { me.min--; } } @@ -205,8 +204,8 @@ module.exports = Scale.extend({ var numericGeneratorOptions = { maxTicks: maxTicks, - min: tickOpts.min, - max: tickOpts.max, + min: opts.min, + max: opts.max, precision: tickOpts.precision, stepSize: helpers.valueOrDefault(tickOpts.fixedStepSize, tickOpts.stepSize) }; @@ -218,7 +217,7 @@ module.exports = Scale.extend({ // range of the scale helpers._setMinAndMaxByKey(ticks, me, 'value'); - if (tickOpts.reverse) { + if (opts.reverse) { ticks.reverse(); me.start = me.max; diff --git a/src/scales/scale.logarithmic.js b/src/scales/scale.logarithmic.js index ae5e65824..561af5449 100644 --- a/src/scales/scale.logarithmic.js +++ b/src/scales/scale.logarithmic.js @@ -123,7 +123,7 @@ module.exports = Scale.extend({ buildTicks: function() { var me = this; - var tickOpts = me.options.ticks; + var opts = me.options; var reverse = !me.isHorizontal(); var generationOptions = { @@ -136,7 +136,7 @@ module.exports = Scale.extend({ // range of the scale helpers._setMinAndMaxByKey(ticks, me, 'value'); - if (tickOpts.reverse) { + if (opts.reverse) { reverse = !reverse; me.start = me.max; me.end = me.min; diff --git a/src/scales/scale.radialLinear.js b/src/scales/scale.radialLinear.js index 5ccf9a20d..50d95ff81 100644 --- a/src/scales/scale.radialLinear.js +++ b/src/scales/scale.radialLinear.js @@ -312,7 +312,7 @@ module.exports = LinearScaleBase.extend({ me.min = helpers.isFinite(min) && !isNaN(min) ? min : 0; me.max = helpers.isFinite(max) && !isNaN(max) ? max : 0; - // Common base implementation to handle ticks.min, ticks.max, ticks.beginAtZero + // Common base implementation to handle min, max, beginAtZero me.handleTickRangeOptions(); }, @@ -398,7 +398,7 @@ module.exports = LinearScaleBase.extend({ // Take into account half font size + the yPadding of the top value var scalingFactor = me.drawingArea / (me.max - me.min); - if (me.options.ticks.reverse) { + if (me.options.reverse) { return (me.max - value) * scalingFactor; } return (value - me.min) * scalingFactor; @@ -503,7 +503,7 @@ module.exports = LinearScaleBase.extend({ ctx.textBaseline = 'middle'; helpers.each(me.ticks, function(tick, index) { - if (index === 0 && !tickOpts.reverse) { + if (index === 0 && !opts.reverse) { return; } diff --git a/src/scales/scale.time.js b/src/scales/scale.time.js index d0bf44aca..89ad6bb54 100644 --- a/src/scales/scale.time.js +++ b/src/scales/scale.time.js @@ -635,7 +635,7 @@ module.exports = Scale.extend({ me._table = buildLookupTable(getTimestampsForTable(me), min, max, distribution); me._offsets = computeOffsets(me._table, ticks, min, max, options); - if (tickOpts.reverse) { + if (options.reverse) { ticks.reverse(); } diff --git a/test/fixtures/controller.bar/backgroundColor/scriptable.js b/test/fixtures/controller.bar/backgroundColor/scriptable.js index b17349b1d..e7bfe20ad 100644 --- a/test/fixtures/controller.bar/backgroundColor/scriptable.js +++ b/test/fixtures/controller.bar/backgroundColor/scriptable.js @@ -40,9 +40,7 @@ module.exports = { yAxes: [ { display: false, - ticks: { - beginAtZero: true - } + beginAtZero: true } ] } diff --git a/test/fixtures/controller.bar/bar-thickness-absolute.json b/test/fixtures/controller.bar/bar-thickness-absolute.json index 4c5ed5339..ea55d4fab 100644 --- a/test/fixtures/controller.bar/bar-thickness-absolute.json +++ b/test/fixtures/controller.bar/bar-thickness-absolute.json @@ -29,9 +29,7 @@ }], "yAxes": [{ "display": false, - "ticks": { - "beginAtZero": true - } + "beginAtZero": true }] } } diff --git a/test/fixtures/controller.bar/bar-thickness-flex-offset.json b/test/fixtures/controller.bar/bar-thickness-flex-offset.json index 6672516e4..46265b304 100644 --- a/test/fixtures/controller.bar/bar-thickness-flex-offset.json +++ b/test/fixtures/controller.bar/bar-thickness-flex-offset.json @@ -29,9 +29,7 @@ }], "yAxes": [{ "display": false, - "ticks": { - "beginAtZero": true - } + "beginAtZero": true }] } } diff --git a/test/fixtures/controller.bar/bar-thickness-flex-single-reverse.json b/test/fixtures/controller.bar/bar-thickness-flex-single-reverse.json index e6d123736..691b33a62 100644 --- a/test/fixtures/controller.bar/bar-thickness-flex-single-reverse.json +++ b/test/fixtures/controller.bar/bar-thickness-flex-single-reverse.json @@ -22,16 +22,14 @@ "time": { "parser": "YYYY" }, + "reverse": true, "ticks": { - "source": "labels", - "reverse": true + "source": "labels" } }], "yAxes": [{ "display": false, - "ticks": { - "beginAtZero": true - } + "beginAtZero": true }] } } diff --git a/test/fixtures/controller.bar/bar-thickness-flex-single.json b/test/fixtures/controller.bar/bar-thickness-flex-single.json index a59b2aff8..5f682066d 100644 --- a/test/fixtures/controller.bar/bar-thickness-flex-single.json +++ b/test/fixtures/controller.bar/bar-thickness-flex-single.json @@ -28,9 +28,7 @@ }], "yAxes": [{ "display": false, - "ticks": { - "beginAtZero": true - } + "beginAtZero": true }] } } diff --git a/test/fixtures/controller.bar/bar-thickness-flex.json b/test/fixtures/controller.bar/bar-thickness-flex.json index b9048faed..8e5eebac1 100644 --- a/test/fixtures/controller.bar/bar-thickness-flex.json +++ b/test/fixtures/controller.bar/bar-thickness-flex.json @@ -28,9 +28,7 @@ }], "yAxes": [{ "display": false, - "ticks": { - "beginAtZero": true - } + "beginAtZero": true }] } } diff --git a/test/fixtures/controller.bar/bar-thickness-max.json b/test/fixtures/controller.bar/bar-thickness-max.json index 2ca185516..f9d0e87a2 100644 --- a/test/fixtures/controller.bar/bar-thickness-max.json +++ b/test/fixtures/controller.bar/bar-thickness-max.json @@ -28,9 +28,7 @@ }], "yAxes": [{ "display": false, - "ticks": { - "beginAtZero": true - } + "beginAtZero": true }] } } diff --git a/test/fixtures/controller.bar/bar-thickness-min-interval.json b/test/fixtures/controller.bar/bar-thickness-min-interval.json index 954e15cfd..e4f910032 100644 --- a/test/fixtures/controller.bar/bar-thickness-min-interval.json +++ b/test/fixtures/controller.bar/bar-thickness-min-interval.json @@ -27,9 +27,7 @@ }], "yAxes": [{ "display": false, - "ticks": { - "beginAtZero": true - } + "beginAtZero": true }] } } diff --git a/test/fixtures/controller.bar/bar-thickness-multiple.json b/test/fixtures/controller.bar/bar-thickness-multiple.json index f26a395fb..99a609892 100644 --- a/test/fixtures/controller.bar/bar-thickness-multiple.json +++ b/test/fixtures/controller.bar/bar-thickness-multiple.json @@ -37,9 +37,7 @@ }], "yAxes": [{ "display": false, - "ticks": { - "beginAtZero": true - } + "beginAtZero": true }] } } diff --git a/test/fixtures/controller.bar/bar-thickness-no-overlap.json b/test/fixtures/controller.bar/bar-thickness-no-overlap.json index 2bfee4436..502b02a48 100644 --- a/test/fixtures/controller.bar/bar-thickness-no-overlap.json +++ b/test/fixtures/controller.bar/bar-thickness-no-overlap.json @@ -37,9 +37,7 @@ }], "yAxes": [{ "display": false, - "ticks": { - "beginAtZero": true - } + "beginAtZero": true }] } } diff --git a/test/fixtures/controller.bar/bar-thickness-offset.json b/test/fixtures/controller.bar/bar-thickness-offset.json index 878556957..31b9304c2 100644 --- a/test/fixtures/controller.bar/bar-thickness-offset.json +++ b/test/fixtures/controller.bar/bar-thickness-offset.json @@ -38,9 +38,7 @@ }], "yAxes": [{ "display": false, - "ticks": { - "beginAtZero": true - } + "beginAtZero": true }] } } diff --git a/test/fixtures/controller.bar/bar-thickness-per-dataset-stacked.json b/test/fixtures/controller.bar/bar-thickness-per-dataset-stacked.json index 29210110f..b23ab4936 100644 --- a/test/fixtures/controller.bar/bar-thickness-per-dataset-stacked.json +++ b/test/fixtures/controller.bar/bar-thickness-per-dataset-stacked.json @@ -39,9 +39,7 @@ "yAxes": [{ "display": false, "stacked": true, - "ticks": { - "beginAtZero": true - } + "beginAtZero": true }] } } diff --git a/test/fixtures/controller.bar/bar-thickness-per-dataset.json b/test/fixtures/controller.bar/bar-thickness-per-dataset.json index 88f4ff1dc..6884cfa96 100644 --- a/test/fixtures/controller.bar/bar-thickness-per-dataset.json +++ b/test/fixtures/controller.bar/bar-thickness-per-dataset.json @@ -32,9 +32,7 @@ }], "yAxes": [{ "display": false, - "ticks": { - "beginAtZero": true - } + "beginAtZero": true }] } } diff --git a/test/fixtures/controller.bar/bar-thickness-reverse.json b/test/fixtures/controller.bar/bar-thickness-reverse.json index 215858dd8..bcc52e987 100644 --- a/test/fixtures/controller.bar/bar-thickness-reverse.json +++ b/test/fixtures/controller.bar/bar-thickness-reverse.json @@ -31,16 +31,14 @@ "time": { "parser": "YYYY" }, + "reverse": true, "ticks": { - "source": "labels", - "reverse": true + "source": "labels" } }], "yAxes": [{ "display": false, - "ticks": { - "beginAtZero": true - } + "beginAtZero": true }] } } diff --git a/test/fixtures/controller.bar/bar-thickness-single-xy.json b/test/fixtures/controller.bar/bar-thickness-single-xy.json index 68a99a908..10fdfbae7 100644 --- a/test/fixtures/controller.bar/bar-thickness-single-xy.json +++ b/test/fixtures/controller.bar/bar-thickness-single-xy.json @@ -27,9 +27,7 @@ }], "yAxes": [{ "display": false, - "ticks": { - "beginAtZero": true - } + "beginAtZero": true }] } } diff --git a/test/fixtures/controller.bar/bar-thickness-single.json b/test/fixtures/controller.bar/bar-thickness-single.json index 1b6565ed0..9de2600e9 100644 --- a/test/fixtures/controller.bar/bar-thickness-single.json +++ b/test/fixtures/controller.bar/bar-thickness-single.json @@ -21,16 +21,14 @@ "time": { "parser": "YYYY" }, + "min": "2013", "ticks": { - "source": "labels", - "min": "2013" + "source": "labels" } }], "yAxes": [{ "display": false, - "ticks": { - "beginAtZero": true - } + "beginAtZero": true }] } } diff --git a/test/fixtures/controller.bar/bar-thickness-stacked.json b/test/fixtures/controller.bar/bar-thickness-stacked.json index 3c9f01c28..c39703894 100644 --- a/test/fixtures/controller.bar/bar-thickness-stacked.json +++ b/test/fixtures/controller.bar/bar-thickness-stacked.json @@ -39,9 +39,7 @@ "yAxes": [{ "display": false, "stacked": true, - "ticks": { - "beginAtZero": true - } + "beginAtZero": true }] } } diff --git a/test/fixtures/controller.bar/borderColor/scriptable.js b/test/fixtures/controller.bar/borderColor/scriptable.js index d4fefc788..3a0646e4a 100644 --- a/test/fixtures/controller.bar/borderColor/scriptable.js +++ b/test/fixtures/controller.bar/borderColor/scriptable.js @@ -42,9 +42,7 @@ module.exports = { yAxes: [ { display: false, - ticks: { - beginAtZero: true - } + beginAtZero: true } ] } diff --git a/test/fixtures/controller.bar/borderSkipped/scriptable.js b/test/fixtures/controller.bar/borderSkipped/scriptable.js index 6801d95fa..03a69142e 100644 --- a/test/fixtures/controller.bar/borderSkipped/scriptable.js +++ b/test/fixtures/controller.bar/borderSkipped/scriptable.js @@ -43,9 +43,7 @@ module.exports = { yAxes: [ { display: false, - ticks: { - beginAtZero: true - } + beginAtZero: true } ] } diff --git a/test/fixtures/controller.bar/borderWidth/scriptable-object.js b/test/fixtures/controller.bar/borderWidth/scriptable-object.js index 5bd2903ef..66caf5c2d 100644 --- a/test/fixtures/controller.bar/borderWidth/scriptable-object.js +++ b/test/fixtures/controller.bar/borderWidth/scriptable-object.js @@ -37,9 +37,7 @@ module.exports = { yAxes: [ { display: false, - ticks: { - beginAtZero: true - } + beginAtZero: true } ] } diff --git a/test/fixtures/controller.bar/borderWidth/scriptable.js b/test/fixtures/controller.bar/borderWidth/scriptable.js index 401286577..198e92b4c 100644 --- a/test/fixtures/controller.bar/borderWidth/scriptable.js +++ b/test/fixtures/controller.bar/borderWidth/scriptable.js @@ -35,9 +35,7 @@ module.exports = { yAxes: [ { display: false, - ticks: { - beginAtZero: true - } + beginAtZero: true } ] } diff --git a/test/fixtures/controller.bar/chart-area-clip.js b/test/fixtures/controller.bar/chart-area-clip.js index 2d552dcd4..6985abacd 100644 --- a/test/fixtures/controller.bar/chart-area-clip.js +++ b/test/fixtures/controller.bar/chart-area-clip.js @@ -29,7 +29,7 @@ module.exports = { }, scales: { xAxes: [{display: false}], - yAxes: [{display: false, ticks: {min: -10, max: 10}}] + yAxes: [{display: false, min: -10, max: 10}] } } }, diff --git a/test/fixtures/controller.bar/floatBar/float-bar-horizontal.json b/test/fixtures/controller.bar/floatBar/float-bar-horizontal.json index c54dea9ce..0a5986abb 100644 --- a/test/fixtures/controller.bar/floatBar/float-bar-horizontal.json +++ b/test/fixtures/controller.bar/floatBar/float-bar-horizontal.json @@ -20,10 +20,8 @@ "scales": { "xAxes": [{ "display": false, - "ticks": { - "min": -8, - "max": 12 - } + "min": -8, + "max": 12 }], "yAxes": [{ "display": false diff --git a/test/fixtures/controller.bar/floatBar/float-bar-stacked-horizontal.json b/test/fixtures/controller.bar/floatBar/float-bar-stacked-horizontal.json index 8322ef472..0715f7f8a 100644 --- a/test/fixtures/controller.bar/floatBar/float-bar-stacked-horizontal.json +++ b/test/fixtures/controller.bar/floatBar/float-bar-stacked-horizontal.json @@ -25,10 +25,8 @@ "yAxes": [{ "display": false, "stacked": true, - "ticks": { - "min": -8, - "max": 12 - } + "min": -8, + "max": 12 }] } } diff --git a/test/fixtures/controller.bar/floatBar/float-bar-stacked.json b/test/fixtures/controller.bar/floatBar/float-bar-stacked.json index d91b61f1b..8f808cef2 100644 --- a/test/fixtures/controller.bar/floatBar/float-bar-stacked.json +++ b/test/fixtures/controller.bar/floatBar/float-bar-stacked.json @@ -21,10 +21,8 @@ "xAxes": [{ "display": false, "stacked": true, - "ticks": { - "min": -8, - "max": 12 - } + "min": -8, + "max": 12 }], "yAxes": [{ "display": false, diff --git a/test/fixtures/controller.bar/floatBar/float-bar.json b/test/fixtures/controller.bar/floatBar/float-bar.json index caeaa2396..76e4d4066 100644 --- a/test/fixtures/controller.bar/floatBar/float-bar.json +++ b/test/fixtures/controller.bar/floatBar/float-bar.json @@ -20,10 +20,8 @@ "scales": { "xAxes": [{ "display": false, - "ticks": { - "min": -8, - "max": 12 - } + "min": -8, + "max": 12 }], "yAxes": [{ "display": false diff --git a/test/fixtures/controller.bar/stacking/order-default.json b/test/fixtures/controller.bar/stacking/order-default.json index 53f25a937..99ac49df2 100644 --- a/test/fixtures/controller.bar/stacking/order-default.json +++ b/test/fixtures/controller.bar/stacking/order-default.json @@ -26,9 +26,7 @@ "yAxes": [{ "display": false, "stacked": true, - "ticks": { - "beginAtZero": true - } + "beginAtZero": true }] } } diff --git a/test/fixtures/controller.bar/stacking/order-specified.json b/test/fixtures/controller.bar/stacking/order-specified.json index d4f497b02..23988211a 100644 --- a/test/fixtures/controller.bar/stacking/order-specified.json +++ b/test/fixtures/controller.bar/stacking/order-specified.json @@ -29,9 +29,7 @@ "yAxes": [{ "display": false, "stacked": true, - "ticks": { - "beginAtZero": true - } + "beginAtZero": true }] } } diff --git a/test/fixtures/controller.bubble/clip.js b/test/fixtures/controller.bubble/clip.js index 9502ad1cd..1af0dfc84 100644 --- a/test/fixtures/controller.bubble/clip.js +++ b/test/fixtures/controller.bubble/clip.js @@ -16,11 +16,11 @@ module.exports = { scales: { xAxes: [{ticks: {display: false}}], yAxes: [{ + min: 8, + max: 25, + beginAtZero: true, ticks: { - display: false, - min: 8, - max: 25, - beginAtZero: true + display: false } }] } diff --git a/test/fixtures/controller.bubble/point-style.json b/test/fixtures/controller.bubble/point-style.json index 9849eef8c..e1af5d550 100644 --- a/test/fixtures/controller.bubble/point-style.json +++ b/test/fixtures/controller.bubble/point-style.json @@ -96,10 +96,8 @@ "xAxes": [{"display": false}], "yAxes": [{ "display": false, - "ticks": { - "min": 0, - "max": 4 - } + "min": 0, + "max": 4 }] }, "elements": { diff --git a/test/fixtures/controller.line/backgroundColor/scriptable.js b/test/fixtures/controller.line/backgroundColor/scriptable.js index 2171e6696..3909168a9 100644 --- a/test/fixtures/controller.line/backgroundColor/scriptable.js +++ b/test/fixtures/controller.line/backgroundColor/scriptable.js @@ -45,9 +45,7 @@ module.exports = { yAxes: [ { display: false, - ticks: { - beginAtZero: true - } + beginAtZero: true } ] } diff --git a/test/fixtures/controller.line/borderCapStyle/scriptable.js b/test/fixtures/controller.line/borderCapStyle/scriptable.js index ee56376fc..c6221948e 100644 --- a/test/fixtures/controller.line/borderCapStyle/scriptable.js +++ b/test/fixtures/controller.line/borderCapStyle/scriptable.js @@ -51,9 +51,7 @@ module.exports = { yAxes: [ { display: false, - ticks: { - beginAtZero: true - } + beginAtZero: true } ] } diff --git a/test/fixtures/controller.line/borderColor/scriptable.js b/test/fixtures/controller.line/borderColor/scriptable.js index e767799ea..d35b4823d 100644 --- a/test/fixtures/controller.line/borderColor/scriptable.js +++ b/test/fixtures/controller.line/borderColor/scriptable.js @@ -48,9 +48,7 @@ module.exports = { yAxes: [ { display: false, - ticks: { - beginAtZero: true - } + beginAtZero: true } ] } diff --git a/test/fixtures/controller.line/borderDash/scriptable.js b/test/fixtures/controller.line/borderDash/scriptable.js index 4a5def54c..b19f17b79 100644 --- a/test/fixtures/controller.line/borderDash/scriptable.js +++ b/test/fixtures/controller.line/borderDash/scriptable.js @@ -39,9 +39,7 @@ module.exports = { yAxes: [ { display: false, - ticks: { - beginAtZero: true - } + beginAtZero: true } ] } diff --git a/test/fixtures/controller.line/borderWidth/scriptable.js b/test/fixtures/controller.line/borderWidth/scriptable.js index 34d736a19..cc959799e 100644 --- a/test/fixtures/controller.line/borderWidth/scriptable.js +++ b/test/fixtures/controller.line/borderWidth/scriptable.js @@ -46,9 +46,7 @@ module.exports = { yAxes: [ { display: false, - ticks: { - beginAtZero: true - } + beginAtZero: true } ] } diff --git a/test/fixtures/controller.line/clip/default-x-max.json b/test/fixtures/controller.line/clip/default-x-max.json index f69182d1f..91dc5178e 100644 --- a/test/fixtures/controller.line/clip/default-x-max.json +++ b/test/fixtures/controller.line/clip/default-x-max.json @@ -17,8 +17,8 @@ "title": false, "scales": { "xAxes": [{ + "max": 3, "ticks": { - "max": 3, "display": false } }], diff --git a/test/fixtures/controller.line/clip/default-x-min.json b/test/fixtures/controller.line/clip/default-x-min.json index b4a4b0c3e..ae229dba8 100644 --- a/test/fixtures/controller.line/clip/default-x-min.json +++ b/test/fixtures/controller.line/clip/default-x-min.json @@ -17,8 +17,8 @@ "title": false, "scales": { "xAxes": [{ + "min": -2, "ticks": { - "min": -2, "display": false } }], diff --git a/test/fixtures/controller.line/clip/default-x.json b/test/fixtures/controller.line/clip/default-x.json index 79dc08cd9..e74f0bc12 100644 --- a/test/fixtures/controller.line/clip/default-x.json +++ b/test/fixtures/controller.line/clip/default-x.json @@ -17,9 +17,9 @@ "title": false, "scales": { "xAxes": [{ + "min": -2, + "max": 3, "ticks": { - "min": -2, - "max": 3, "display": false } }], diff --git a/test/fixtures/controller.line/clip/default-y-max.json b/test/fixtures/controller.line/clip/default-y-max.json index 1ab631bb4..589fc1e71 100644 --- a/test/fixtures/controller.line/clip/default-y-max.json +++ b/test/fixtures/controller.line/clip/default-y-max.json @@ -18,8 +18,8 @@ "scales": { "xAxes": [{"ticks": {"display": false}}], "yAxes": [{ + "max": 6, "ticks": { - "max": 6, "display": false } }] diff --git a/test/fixtures/controller.line/clip/default-y-min.json b/test/fixtures/controller.line/clip/default-y-min.json index 7c6114a9c..3085fffa1 100644 --- a/test/fixtures/controller.line/clip/default-y-min.json +++ b/test/fixtures/controller.line/clip/default-y-min.json @@ -18,8 +18,8 @@ "scales": { "xAxes": [{"ticks": {"display": false}}], "yAxes": [{ + "min": 2, "ticks": { - "min": 2, "display": false } }] diff --git a/test/fixtures/controller.line/clip/default-y.json b/test/fixtures/controller.line/clip/default-y.json index 30751446a..06b634268 100644 --- a/test/fixtures/controller.line/clip/default-y.json +++ b/test/fixtures/controller.line/clip/default-y.json @@ -18,9 +18,9 @@ "scales": { "xAxes": [{"ticks": {"display": false}}], "yAxes": [{ + "min": 2, + "max": 6, "ticks": { - "min": 2, - "max": 6, "display": false } }] diff --git a/test/fixtures/controller.line/clip/specified.json b/test/fixtures/controller.line/clip/specified.json index 5885240c7..712dc5bf0 100644 --- a/test/fixtures/controller.line/clip/specified.json +++ b/test/fixtures/controller.line/clip/specified.json @@ -40,16 +40,16 @@ "title": false, "scales": { "xAxes": [{ + "min": -2, + "max": 2, "ticks": { - "min": -2, - "max": 2, "display": false } }], "yAxes": [{ + "min": -2, + "max": 2, "ticks": { - "min": -2, - "max": 2, "display": false } }] diff --git a/test/fixtures/controller.line/point-style.json b/test/fixtures/controller.line/point-style.json index ef295ad59..7e50e7210 100644 --- a/test/fixtures/controller.line/point-style.json +++ b/test/fixtures/controller.line/point-style.json @@ -67,10 +67,8 @@ "xAxes": [{"display": false}], "yAxes": [{ "display": false, - "ticks": { - "min": 0, - "max": 4 - } + "min": 0, + "max": 4 }] }, "elements": { diff --git a/test/fixtures/controller.line/pointBackgroundColor/scriptable.js b/test/fixtures/controller.line/pointBackgroundColor/scriptable.js index 6ede2cb0c..5edfbdcd5 100644 --- a/test/fixtures/controller.line/pointBackgroundColor/scriptable.js +++ b/test/fixtures/controller.line/pointBackgroundColor/scriptable.js @@ -44,9 +44,7 @@ module.exports = { yAxes: [ { display: false, - ticks: { - beginAtZero: true - } + beginAtZero: true } ] } diff --git a/test/fixtures/controller.line/pointBorderColor/scriptable.js b/test/fixtures/controller.line/pointBorderColor/scriptable.js index 04b123606..3be796895 100644 --- a/test/fixtures/controller.line/pointBorderColor/scriptable.js +++ b/test/fixtures/controller.line/pointBorderColor/scriptable.js @@ -44,9 +44,7 @@ module.exports = { yAxes: [ { display: false, - ticks: { - beginAtZero: true - } + beginAtZero: true } ] } diff --git a/test/fixtures/controller.line/pointBorderWidth/scriptable.js b/test/fixtures/controller.line/pointBorderWidth/scriptable.js index a40ac1cb0..01e2967ec 100644 --- a/test/fixtures/controller.line/pointBorderWidth/scriptable.js +++ b/test/fixtures/controller.line/pointBorderWidth/scriptable.js @@ -44,9 +44,7 @@ module.exports = { yAxes: [ { display: false, - ticks: { - beginAtZero: true - } + beginAtZero: true } ] } diff --git a/test/fixtures/controller.line/pointStyle/scriptable.js b/test/fixtures/controller.line/pointStyle/scriptable.js index c2a48ce82..05f8161d6 100644 --- a/test/fixtures/controller.line/pointStyle/scriptable.js +++ b/test/fixtures/controller.line/pointStyle/scriptable.js @@ -48,9 +48,7 @@ module.exports = { yAxes: [ { display: false, - ticks: { - beginAtZero: true - } + beginAtZero: true } ] } diff --git a/test/fixtures/controller.line/radius/scriptable.js b/test/fixtures/controller.line/radius/scriptable.js index 7e2068a4f..3d1f52907 100644 --- a/test/fixtures/controller.line/radius/scriptable.js +++ b/test/fixtures/controller.line/radius/scriptable.js @@ -43,9 +43,7 @@ module.exports = { yAxes: [ { display: false, - ticks: { - beginAtZero: true - } + beginAtZero: true } ] } diff --git a/test/fixtures/controller.line/rotation/scriptable.js b/test/fixtures/controller.line/rotation/scriptable.js index 5a130f29e..5d5b009e3 100644 --- a/test/fixtures/controller.line/rotation/scriptable.js +++ b/test/fixtures/controller.line/rotation/scriptable.js @@ -45,9 +45,7 @@ module.exports = { yAxes: [ { display: false, - ticks: { - beginAtZero: true - } + beginAtZero: true } ] } diff --git a/test/fixtures/controller.radar/backgroundColor/scriptable.js b/test/fixtures/controller.radar/backgroundColor/scriptable.js index 4c714a451..ee32bcf42 100644 --- a/test/fixtures/controller.radar/backgroundColor/scriptable.js +++ b/test/fixtures/controller.radar/backgroundColor/scriptable.js @@ -39,9 +39,7 @@ module.exports = { }, scale: { display: false, - ticks: { - min: -15 - } + min: -15 } } }, diff --git a/test/fixtures/controller.radar/backgroundColor/value.js b/test/fixtures/controller.radar/backgroundColor/value.js index d9347ee5d..0decaa6c0 100644 --- a/test/fixtures/controller.radar/backgroundColor/value.js +++ b/test/fixtures/controller.radar/backgroundColor/value.js @@ -28,9 +28,7 @@ module.exports = { }, scale: { display: false, - ticks: { - min: -15 - } + min: -15 } } }, diff --git a/test/fixtures/controller.radar/borderCapStyle/scriptable.js b/test/fixtures/controller.radar/borderCapStyle/scriptable.js index 128bf6e70..f0db0da67 100644 --- a/test/fixtures/controller.radar/borderCapStyle/scriptable.js +++ b/test/fixtures/controller.radar/borderCapStyle/scriptable.js @@ -48,9 +48,7 @@ module.exports = { }, scale: { display: false, - ticks: { - beginAtZero: true - } + beginAtZero: true } } }, diff --git a/test/fixtures/controller.radar/borderCapStyle/value.js b/test/fixtures/controller.radar/borderCapStyle/value.js index ad6aa1fed..6de72cba8 100644 --- a/test/fixtures/controller.radar/borderCapStyle/value.js +++ b/test/fixtures/controller.radar/borderCapStyle/value.js @@ -39,9 +39,7 @@ module.exports = { }, scale: { display: false, - ticks: { - beginAtZero: true - } + beginAtZero: true } } }, diff --git a/test/fixtures/controller.radar/borderColor/scriptable.js b/test/fixtures/controller.radar/borderColor/scriptable.js index e4b59c580..c1cdbb6f8 100644 --- a/test/fixtures/controller.radar/borderColor/scriptable.js +++ b/test/fixtures/controller.radar/borderColor/scriptable.js @@ -42,9 +42,7 @@ module.exports = { }, scale: { display: false, - ticks: { - min: -15 - } + min: -15 } } }, diff --git a/test/fixtures/controller.radar/borderColor/value.js b/test/fixtures/controller.radar/borderColor/value.js index c70ac6436..e0e677f26 100644 --- a/test/fixtures/controller.radar/borderColor/value.js +++ b/test/fixtures/controller.radar/borderColor/value.js @@ -30,9 +30,7 @@ module.exports = { }, scale: { display: false, - ticks: { - min: -15 - } + min: -15 } } }, diff --git a/test/fixtures/controller.radar/borderDash/scriptable.js b/test/fixtures/controller.radar/borderDash/scriptable.js index 0bee9a8a6..0feed22cc 100644 --- a/test/fixtures/controller.radar/borderDash/scriptable.js +++ b/test/fixtures/controller.radar/borderDash/scriptable.js @@ -33,9 +33,7 @@ module.exports = { }, scale: { display: false, - ticks: { - min: -15 - } + min: -15 } } }, diff --git a/test/fixtures/controller.radar/borderDash/value.js b/test/fixtures/controller.radar/borderDash/value.js index a5e7ee833..92439aab8 100644 --- a/test/fixtures/controller.radar/borderDash/value.js +++ b/test/fixtures/controller.radar/borderDash/value.js @@ -31,9 +31,7 @@ module.exports = { }, scale: { display: false, - ticks: { - min: -15 - } + min: -15 } } }, diff --git a/test/fixtures/controller.radar/borderDashOffset/scriptable.js b/test/fixtures/controller.radar/borderDashOffset/scriptable.js index 90cca36fe..9f8a6e879 100644 --- a/test/fixtures/controller.radar/borderDashOffset/scriptable.js +++ b/test/fixtures/controller.radar/borderDashOffset/scriptable.js @@ -40,9 +40,7 @@ module.exports = { }, scale: { display: false, - ticks: { - min: -1 - } + min: -1 } } }, diff --git a/test/fixtures/controller.radar/borderDashOffset/value.js b/test/fixtures/controller.radar/borderDashOffset/value.js index f96d4cd13..c26805e14 100644 --- a/test/fixtures/controller.radar/borderDashOffset/value.js +++ b/test/fixtures/controller.radar/borderDashOffset/value.js @@ -36,9 +36,7 @@ module.exports = { }, scale: { display: false, - ticks: { - min: -1 - } + min: -1 } } }, diff --git a/test/fixtures/controller.radar/borderJoinStyle/scriptable.js b/test/fixtures/controller.radar/borderJoinStyle/scriptable.js index ff33d60da..435af7230 100644 --- a/test/fixtures/controller.radar/borderJoinStyle/scriptable.js +++ b/test/fixtures/controller.radar/borderJoinStyle/scriptable.js @@ -48,9 +48,7 @@ module.exports = { }, scale: { display: false, - ticks: { - beginAtZero: true - } + beginAtZero: true } } }, diff --git a/test/fixtures/controller.radar/borderJoinStyle/value.js b/test/fixtures/controller.radar/borderJoinStyle/value.js index 04a6beb66..580ef743e 100644 --- a/test/fixtures/controller.radar/borderJoinStyle/value.js +++ b/test/fixtures/controller.radar/borderJoinStyle/value.js @@ -39,9 +39,7 @@ module.exports = { }, scale: { display: false, - ticks: { - beginAtZero: true - } + beginAtZero: true } } }, diff --git a/test/fixtures/controller.radar/borderWidth/scriptable.js b/test/fixtures/controller.radar/borderWidth/scriptable.js index d2399d798..adf8338b8 100644 --- a/test/fixtures/controller.radar/borderWidth/scriptable.js +++ b/test/fixtures/controller.radar/borderWidth/scriptable.js @@ -40,9 +40,7 @@ module.exports = { }, scale: { display: false, - ticks: { - min: -15 - } + min: -15 } } }, diff --git a/test/fixtures/controller.radar/borderWidth/value.js b/test/fixtures/controller.radar/borderWidth/value.js index 521cbf076..29c7e5780 100644 --- a/test/fixtures/controller.radar/borderWidth/value.js +++ b/test/fixtures/controller.radar/borderWidth/value.js @@ -31,9 +31,7 @@ module.exports = { }, scale: { display: false, - ticks: { - min: -15 - } + min: -15 } } }, diff --git a/test/fixtures/controller.radar/fill/scriptable.js b/test/fixtures/controller.radar/fill/scriptable.js index 3706bbff1..b57599c07 100644 --- a/test/fixtures/controller.radar/fill/scriptable.js +++ b/test/fixtures/controller.radar/fill/scriptable.js @@ -31,9 +31,7 @@ module.exports = { }, scale: { display: false, - ticks: { - min: -15 - } + min: -15 } } }, diff --git a/test/fixtures/controller.radar/fill/value.js b/test/fixtures/controller.radar/fill/value.js index 4db74dad1..f2c21f645 100644 --- a/test/fixtures/controller.radar/fill/value.js +++ b/test/fixtures/controller.radar/fill/value.js @@ -27,9 +27,7 @@ module.exports = { }, scale: { display: false, - ticks: { - min: -15 - } + min: -15 } } }, diff --git a/test/fixtures/controller.radar/point-style.json b/test/fixtures/controller.radar/point-style.json index 913c1cb87..8fea82502 100644 --- a/test/fixtures/controller.radar/point-style.json +++ b/test/fixtures/controller.radar/point-style.json @@ -68,10 +68,8 @@ "title": false, "scale": { "display": false, - "ticks": { - "min": 0, - "max": 3 - } + "min": 0, + "max": 3 }, "elements": { "line": { diff --git a/test/fixtures/controller.radar/pointBackgroundColor/indexable.js b/test/fixtures/controller.radar/pointBackgroundColor/indexable.js index 10148e65e..d3f44572c 100644 --- a/test/fixtures/controller.radar/pointBackgroundColor/indexable.js +++ b/test/fixtures/controller.radar/pointBackgroundColor/indexable.js @@ -43,9 +43,7 @@ module.exports = { }, scale: { display: false, - ticks: { - min: -15 - } + min: -15 } } }, diff --git a/test/fixtures/controller.radar/pointBackgroundColor/scriptable.js b/test/fixtures/controller.radar/pointBackgroundColor/scriptable.js index 07e1b129c..edc160eff 100644 --- a/test/fixtures/controller.radar/pointBackgroundColor/scriptable.js +++ b/test/fixtures/controller.radar/pointBackgroundColor/scriptable.js @@ -41,9 +41,7 @@ module.exports = { }, scale: { display: false, - ticks: { - min: -15 - } + min: -15 } } }, diff --git a/test/fixtures/controller.radar/pointBackgroundColor/value.js b/test/fixtures/controller.radar/pointBackgroundColor/value.js index 20af577ce..4688dc32a 100644 --- a/test/fixtures/controller.radar/pointBackgroundColor/value.js +++ b/test/fixtures/controller.radar/pointBackgroundColor/value.js @@ -29,9 +29,7 @@ module.exports = { }, scale: { display: false, - ticks: { - min: -15 - } + min: -15 } } }, diff --git a/test/fixtures/controller.radar/pointBorderColor/indexable.js b/test/fixtures/controller.radar/pointBorderColor/indexable.js index f7e0626d6..45fb8e275 100644 --- a/test/fixtures/controller.radar/pointBorderColor/indexable.js +++ b/test/fixtures/controller.radar/pointBorderColor/indexable.js @@ -44,9 +44,7 @@ module.exports = { }, scale: { display: false, - ticks: { - min: -15 - } + min: -15 } } }, diff --git a/test/fixtures/controller.radar/pointBorderColor/scriptable.js b/test/fixtures/controller.radar/pointBorderColor/scriptable.js index d9678c311..4e343c50a 100644 --- a/test/fixtures/controller.radar/pointBorderColor/scriptable.js +++ b/test/fixtures/controller.radar/pointBorderColor/scriptable.js @@ -42,9 +42,7 @@ module.exports = { }, scale: { display: false, - ticks: { - min: -15 - } + min: -15 } } }, diff --git a/test/fixtures/controller.radar/pointBorderColor/value.js b/test/fixtures/controller.radar/pointBorderColor/value.js index d639e2816..3e80106d0 100644 --- a/test/fixtures/controller.radar/pointBorderColor/value.js +++ b/test/fixtures/controller.radar/pointBorderColor/value.js @@ -30,9 +30,7 @@ module.exports = { }, scale: { display: false, - ticks: { - min: -15 - } + min: -15 } } }, diff --git a/test/fixtures/controller.radar/pointBorderWidth/indexable.js b/test/fixtures/controller.radar/pointBorderWidth/indexable.js index 1e60832e6..2c6b6b5ce 100644 --- a/test/fixtures/controller.radar/pointBorderWidth/indexable.js +++ b/test/fixtures/controller.radar/pointBorderWidth/indexable.js @@ -35,9 +35,7 @@ module.exports = { }, scale: { display: false, - ticks: { - min: -15 - } + min: -15 } } }, diff --git a/test/fixtures/controller.radar/pointBorderWidth/scriptable.js b/test/fixtures/controller.radar/pointBorderWidth/scriptable.js index 94ea514ca..51e77e4a7 100644 --- a/test/fixtures/controller.radar/pointBorderWidth/scriptable.js +++ b/test/fixtures/controller.radar/pointBorderWidth/scriptable.js @@ -41,9 +41,7 @@ module.exports = { }, scale: { display: false, - ticks: { - min: -15 - } + min: -15 } } }, diff --git a/test/fixtures/controller.radar/pointBorderWidth/value.js b/test/fixtures/controller.radar/pointBorderWidth/value.js index b486ea937..74bd41700 100644 --- a/test/fixtures/controller.radar/pointBorderWidth/value.js +++ b/test/fixtures/controller.radar/pointBorderWidth/value.js @@ -31,9 +31,7 @@ module.exports = { }, scale: { display: false, - ticks: { - min: -15 - } + min: -15 } } }, diff --git a/test/fixtures/controller.radar/pointStyle/indexable.js b/test/fixtures/controller.radar/pointStyle/indexable.js index 835cd2350..55b52a601 100644 --- a/test/fixtures/controller.radar/pointStyle/indexable.js +++ b/test/fixtures/controller.radar/pointStyle/indexable.js @@ -47,9 +47,7 @@ module.exports = { }, scale: { display: false, - ticks: { - min: -15 - } + min: -15 } } }, diff --git a/test/fixtures/controller.radar/pointStyle/scriptable.js b/test/fixtures/controller.radar/pointStyle/scriptable.js index 9301672fb..dbf2e9a26 100644 --- a/test/fixtures/controller.radar/pointStyle/scriptable.js +++ b/test/fixtures/controller.radar/pointStyle/scriptable.js @@ -45,9 +45,7 @@ module.exports = { }, scale: { display: false, - ticks: { - min: -15 - } + min: -15 } } }, diff --git a/test/fixtures/controller.radar/pointStyle/value.js b/test/fixtures/controller.radar/pointStyle/value.js index 31c2ff941..beab6ed68 100644 --- a/test/fixtures/controller.radar/pointStyle/value.js +++ b/test/fixtures/controller.radar/pointStyle/value.js @@ -31,9 +31,7 @@ module.exports = { }, scale: { display: false, - ticks: { - min: -15 - } + min: -15 } } }, diff --git a/test/fixtures/controller.radar/radius/indexable.js b/test/fixtures/controller.radar/radius/indexable.js index 7a106b587..b052d88b6 100644 --- a/test/fixtures/controller.radar/radius/indexable.js +++ b/test/fixtures/controller.radar/radius/indexable.js @@ -34,9 +34,7 @@ module.exports = { }, scale: { display: false, - ticks: { - min: -15 - } + min: -15 } } }, diff --git a/test/fixtures/controller.radar/radius/scriptable.js b/test/fixtures/controller.radar/radius/scriptable.js index bbc5cdeb2..69ca5777d 100644 --- a/test/fixtures/controller.radar/radius/scriptable.js +++ b/test/fixtures/controller.radar/radius/scriptable.js @@ -40,9 +40,7 @@ module.exports = { }, scale: { display: false, - ticks: { - min: -15 - } + min: -15 } } }, diff --git a/test/fixtures/controller.radar/radius/value.js b/test/fixtures/controller.radar/radius/value.js index d7f85687b..42a0cf00d 100644 --- a/test/fixtures/controller.radar/radius/value.js +++ b/test/fixtures/controller.radar/radius/value.js @@ -30,9 +30,7 @@ module.exports = { }, scale: { display: false, - ticks: { - min: -15 - } + min: -15 } } }, diff --git a/test/fixtures/controller.radar/rotation/indexable.js b/test/fixtures/controller.radar/rotation/indexable.js index f516ce75f..5b4f69dfc 100644 --- a/test/fixtures/controller.radar/rotation/indexable.js +++ b/test/fixtures/controller.radar/rotation/indexable.js @@ -36,9 +36,7 @@ module.exports = { }, scale: { display: false, - ticks: { - min: -15 - } + min: -15 } } }, diff --git a/test/fixtures/controller.radar/rotation/scriptable.js b/test/fixtures/controller.radar/rotation/scriptable.js index d85b7c97e..6a5d7f33f 100644 --- a/test/fixtures/controller.radar/rotation/scriptable.js +++ b/test/fixtures/controller.radar/rotation/scriptable.js @@ -42,9 +42,7 @@ module.exports = { }, scale: { display: false, - ticks: { - min: -15 - } + min: -15 } } }, diff --git a/test/fixtures/controller.radar/rotation/value.js b/test/fixtures/controller.radar/rotation/value.js index 4b9b17d08..b842151c8 100644 --- a/test/fixtures/controller.radar/rotation/value.js +++ b/test/fixtures/controller.radar/rotation/value.js @@ -32,9 +32,7 @@ module.exports = { }, scale: { display: false, - ticks: { - min: -15 - } + min: -15 } } }, diff --git a/test/fixtures/core.scale/tick-drawing.json b/test/fixtures/core.scale/tick-drawing.json index 7a0aa03ec..d7412edb3 100644 --- a/test/fixtures/core.scale/tick-drawing.json +++ b/test/fixtures/core.scale/tick-drawing.json @@ -38,10 +38,10 @@ "position": "left", "id": "y-axis-1", "type": "linear", + "min": -100, + "max": 100, "ticks": { - "display": false, - "min": -100, - "max": 100 + "display": false }, "gridLines":{ "drawOnChartArea": false, @@ -52,10 +52,10 @@ "type": "linear", "id": "y-axis-2", "position": "right", + "min": 0, + "max": 50, "ticks": { - "display": false, - "min": 0, - "max": 50 + "display": false }, "gridLines":{ "drawOnChartArea": false, diff --git a/test/fixtures/element.line/default.js b/test/fixtures/element.line/default.js index 718faa9cc..2cbbaed38 100644 --- a/test/fixtures/element.line/default.js +++ b/test/fixtures/element.line/default.js @@ -12,8 +12,8 @@ module.exports = { legend: false, title: false, scales: { - xAxes: [{type: 'linear', display: false, ticks: {min: 0, max: 20}}], - yAxes: [{display: false, ticks: {min: -15, max: 15}}] + xAxes: [{type: 'linear', display: false, min: 0, max: 20}], + yAxes: [{display: false, min: -15, max: 15}] } } }, diff --git a/test/fixtures/element.line/skip/all.js b/test/fixtures/element.line/skip/all.js index 1e65f6337..6f8b82299 100644 --- a/test/fixtures/element.line/skip/all.js +++ b/test/fixtures/element.line/skip/all.js @@ -15,8 +15,8 @@ module.exports = { legend: false, title: false, scales: { - xAxes: [{type: 'linear', display: false, ticks: {min: 0, max: 20}}], - yAxes: [{display: false, ticks: {min: -15, max: 15}}] + xAxes: [{type: 'linear', display: false, min: 0, max: 20}], + yAxes: [{display: false, min: -15, max: 15}] } } }, diff --git a/test/fixtures/element.line/skip/first-span.js b/test/fixtures/element.line/skip/first-span.js index 4e29d2828..a76e6dea8 100644 --- a/test/fixtures/element.line/skip/first-span.js +++ b/test/fixtures/element.line/skip/first-span.js @@ -16,8 +16,8 @@ module.exports = { legend: false, title: false, scales: { - xAxes: [{type: 'linear', display: false, ticks: {min: 0, max: 20}}], - yAxes: [{display: false, ticks: {min: -15, max: 15}}] + xAxes: [{type: 'linear', display: false, min: 0, max: 20}], + yAxes: [{display: false, min: -15, max: 15}] } } }, diff --git a/test/fixtures/element.line/skip/first.js b/test/fixtures/element.line/skip/first.js index 5637cb526..76f9d79e5 100644 --- a/test/fixtures/element.line/skip/first.js +++ b/test/fixtures/element.line/skip/first.js @@ -15,8 +15,8 @@ module.exports = { legend: false, title: false, scales: { - xAxes: [{type: 'linear', display: false, ticks: {min: 0, max: 20}}], - yAxes: [{display: false, ticks: {min: -15, max: 15}}] + xAxes: [{type: 'linear', display: false, min: 0, max: 20}], + yAxes: [{display: false, min: -15, max: 15}] } } }, diff --git a/test/fixtures/element.line/skip/last-span.js b/test/fixtures/element.line/skip/last-span.js index f479ea079..36ec82ad8 100644 --- a/test/fixtures/element.line/skip/last-span.js +++ b/test/fixtures/element.line/skip/last-span.js @@ -16,8 +16,8 @@ module.exports = { legend: false, title: false, scales: { - xAxes: [{type: 'linear', display: false, ticks: {min: 0, max: 20}}], - yAxes: [{display: false, ticks: {min: -15, max: 15}}] + xAxes: [{type: 'linear', display: false, min: 0, max: 20}], + yAxes: [{display: false, min: -15, max: 15}] } } }, diff --git a/test/fixtures/element.line/skip/last.js b/test/fixtures/element.line/skip/last.js index cb294564f..7d0a9b8b8 100644 --- a/test/fixtures/element.line/skip/last.js +++ b/test/fixtures/element.line/skip/last.js @@ -15,8 +15,8 @@ module.exports = { legend: false, title: false, scales: { - xAxes: [{type: 'linear', display: false, ticks: {min: 0, max: 20}}], - yAxes: [{display: false, ticks: {min: -15, max: 15}}] + xAxes: [{type: 'linear', display: false, min: 0, max: 20}], + yAxes: [{display: false, min: -15, max: 15}] } } }, diff --git a/test/fixtures/element.line/skip/middle-span.js b/test/fixtures/element.line/skip/middle-span.js index 75a3c155f..9f0798b43 100644 --- a/test/fixtures/element.line/skip/middle-span.js +++ b/test/fixtures/element.line/skip/middle-span.js @@ -16,8 +16,8 @@ module.exports = { legend: false, title: false, scales: { - xAxes: [{type: 'linear', display: false, ticks: {min: 0, max: 20}}], - yAxes: [{display: false, ticks: {min: -15, max: 15}}] + xAxes: [{type: 'linear', display: false, min: 0, max: 20}], + yAxes: [{display: false, min: -15, max: 15}] } } }, diff --git a/test/fixtures/element.line/skip/middle.js b/test/fixtures/element.line/skip/middle.js index 80411e9c8..a2392ea9e 100644 --- a/test/fixtures/element.line/skip/middle.js +++ b/test/fixtures/element.line/skip/middle.js @@ -15,8 +15,8 @@ module.exports = { legend: false, title: false, scales: { - xAxes: [{type: 'linear', display: false, ticks: {min: 0, max: 20}}], - yAxes: [{display: false, ticks: {min: -15, max: 15}}] + xAxes: [{type: 'linear', display: false, min: 0, max: 20}], + yAxes: [{display: false, min: -15, max: 15}] } } }, diff --git a/test/fixtures/element.line/stepped/after.js b/test/fixtures/element.line/stepped/after.js index 43e5668dc..fd7fbe693 100644 --- a/test/fixtures/element.line/stepped/after.js +++ b/test/fixtures/element.line/stepped/after.js @@ -16,8 +16,8 @@ module.exports = { legend: false, title: false, scales: { - xAxes: [{type: 'linear', display: false, ticks: {min: 0, max: 20}}], - yAxes: [{display: false, ticks: {min: -15, max: 15}}] + xAxes: [{type: 'linear', display: false, min: 0, max: 20}], + yAxes: [{display: false, min: -15, max: 15}] } } }, diff --git a/test/fixtures/element.line/stepped/before.js b/test/fixtures/element.line/stepped/before.js index e30447365..51c82c434 100644 --- a/test/fixtures/element.line/stepped/before.js +++ b/test/fixtures/element.line/stepped/before.js @@ -16,8 +16,8 @@ module.exports = { legend: false, title: false, scales: { - xAxes: [{type: 'linear', display: false, ticks: {min: 0, max: 20}}], - yAxes: [{display: false, ticks: {min: -15, max: 15}}] + xAxes: [{type: 'linear', display: false, min: 0, max: 20}], + yAxes: [{display: false, min: -15, max: 15}] } } }, diff --git a/test/fixtures/element.line/stepped/default.js b/test/fixtures/element.line/stepped/default.js index 88b286ffa..641b3a711 100644 --- a/test/fixtures/element.line/stepped/default.js +++ b/test/fixtures/element.line/stepped/default.js @@ -16,8 +16,8 @@ module.exports = { legend: false, title: false, scales: { - xAxes: [{type: 'linear', display: false, ticks: {min: 0, max: 20}}], - yAxes: [{display: false, ticks: {min: -15, max: 15}}] + xAxes: [{type: 'linear', display: false, min: 0, max: 20}], + yAxes: [{display: false, min: -15, max: 15}] } } }, diff --git a/test/fixtures/element.line/stepped/middle.js b/test/fixtures/element.line/stepped/middle.js index 3008aef6e..775e8a71c 100644 --- a/test/fixtures/element.line/stepped/middle.js +++ b/test/fixtures/element.line/stepped/middle.js @@ -16,8 +16,8 @@ module.exports = { legend: false, title: false, scales: { - xAxes: [{type: 'linear', display: false, ticks: {min: 0, max: 20}}], - yAxes: [{display: false, ticks: {min: -15, max: 15}}] + xAxes: [{type: 'linear', display: false, min: 0, max: 20}], + yAxes: [{display: false, min: -15, max: 15}] } } }, diff --git a/test/fixtures/element.line/tension/default.js b/test/fixtures/element.line/tension/default.js index c12485925..f91a6c446 100644 --- a/test/fixtures/element.line/tension/default.js +++ b/test/fixtures/element.line/tension/default.js @@ -14,8 +14,8 @@ module.exports = { legend: false, title: false, scales: { - xAxes: [{type: 'linear', display: false, ticks: {min: 0, max: 20}}], - yAxes: [{display: false, ticks: {min: -15, max: 15}}] + xAxes: [{type: 'linear', display: false, min: 0, max: 20}], + yAxes: [{display: false, min: -15, max: 15}] } } }, diff --git a/test/fixtures/element.line/tension/one.js b/test/fixtures/element.line/tension/one.js index 7210a7d6b..2ac89f8e5 100644 --- a/test/fixtures/element.line/tension/one.js +++ b/test/fixtures/element.line/tension/one.js @@ -15,8 +15,8 @@ module.exports = { legend: false, title: false, scales: { - xAxes: [{type: 'linear', display: false, ticks: {min: 0, max: 20}}], - yAxes: [{display: false, ticks: {min: -15, max: 15}}] + xAxes: [{type: 'linear', display: false, min: 0, max: 20}], + yAxes: [{display: false, min: -15, max: 15}] } } }, diff --git a/test/fixtures/element.line/tension/zero.js b/test/fixtures/element.line/tension/zero.js index 63fd548e2..915a9c3a0 100644 --- a/test/fixtures/element.line/tension/zero.js +++ b/test/fixtures/element.line/tension/zero.js @@ -15,8 +15,8 @@ module.exports = { legend: false, title: false, scales: { - xAxes: [{type: 'linear', display: false, ticks: {min: 0, max: 20}}], - yAxes: [{display: false, ticks: {min: -15, max: 15}}] + xAxes: [{type: 'linear', display: false, min: 0, max: 20}], + yAxes: [{display: false, min: -15, max: 15}] } } }, diff --git a/test/specs/controller.bar.tests.js b/test/specs/controller.bar.tests.js index 558770f7a..67f72d6bf 100644 --- a/test/specs/controller.bar.tests.js +++ b/test/specs/controller.bar.tests.js @@ -886,10 +886,8 @@ describe('Chart.controllers.bar', function() { type: 'linear', display: false, stacked: true, - ticks: { - min: 50, - max: 100 - } + min: 50, + max: 100 }] } } @@ -1514,10 +1512,8 @@ describe('Chart.controllers.bar', function() { options: { scales: { xAxes: [{ - ticks: { - min: 'March', - max: 'May', - }, + min: 'March', + max: 'May', }] } } @@ -1531,10 +1527,8 @@ describe('Chart.controllers.bar', function() { options: { scales: { xAxes: [{ - ticks: { - min: 'March', - max: 'May', - } + min: 'March', + max: 'May', }], yAxes: [{ stacked: true @@ -1592,10 +1586,8 @@ describe('Chart.controllers.bar', function() { options: { scales: { yAxes: [{ - ticks: { - min: 'March', - max: 'May', - }, + min: 'March', + max: 'May', }] } } @@ -1612,10 +1604,8 @@ describe('Chart.controllers.bar', function() { stacked: true }], yAxes: [{ - ticks: { - min: 'March', - max: 'May', - } + min: 'March', + max: 'May', }] } } diff --git a/test/specs/controller.line.tests.js b/test/specs/controller.line.tests.js index 5e811cb4d..39157bb8b 100644 --- a/test/specs/controller.line.tests.js +++ b/test/specs/controller.line.tests.js @@ -251,9 +251,7 @@ describe('Chart.controllers.line', function() { }], yAxes: [{ display: false, - ticks: { - beginAtZero: true - } + beginAtZero: true }] } } diff --git a/test/specs/core.controller.tests.js b/test/specs/core.controller.tests.js index 5dc8bf81a..e8a37da58 100644 --- a/test/specs/core.controller.tests.js +++ b/test/specs/core.controller.tests.js @@ -990,18 +990,16 @@ describe('Chart', function() { responsive: false, scales: { yAxes: [{ - ticks: { - min: 0, - max: 10 - } + min: 0, + max: 10 }] } }; chart.update(); var yScale = chart.scales['y-axis-0']; - expect(yScale.options.ticks.min).toBe(0); - expect(yScale.options.ticks.max).toBe(10); + expect(yScale.options.min).toBe(0); + expect(yScale.options.max).toBe(10); }); it ('should update scales options', function() { @@ -1018,13 +1016,13 @@ describe('Chart', function() { } }); - chart.options.scales.yAxes[0].ticks.min = 0; - chart.options.scales.yAxes[0].ticks.max = 10; + chart.options.scales.yAxes[0].min = 0; + chart.options.scales.yAxes[0].max = 10; chart.update(); var yScale = chart.scales['y-axis-0']; - expect(yScale.options.ticks.min).toBe(0); - expect(yScale.options.ticks.max).toBe(10); + expect(yScale.options.min).toBe(0); + expect(yScale.options.max).toBe(10); }); it ('should update scales options from new object', function() { @@ -1043,10 +1041,8 @@ describe('Chart', function() { var newScalesConfig = { yAxes: [{ - ticks: { - min: 0, - max: 10 - } + min: 0, + max: 10 }] }; chart.options.scales = newScalesConfig; @@ -1054,8 +1050,8 @@ describe('Chart', function() { chart.update(); var yScale = chart.scales['y-axis-0']; - expect(yScale.options.ticks.min).toBe(0); - expect(yScale.options.ticks.max).toBe(10); + expect(yScale.options.min).toBe(0); + expect(yScale.options.max).toBe(10); }); it ('should assign unique scale IDs', function() { @@ -1089,10 +1085,8 @@ describe('Chart', function() { scales: { yAxes: [{ id: 'yAxis0', - ticks: { - min: 0, - max: 10 - } + min: 0, + max: 10 }] } } @@ -1100,10 +1094,8 @@ describe('Chart', function() { var newScalesConfig = { yAxes: [{ - ticks: { - min: 0, - max: 10 - } + min: 0, + max: 10 }] }; chart.options.scales = newScalesConfig; @@ -1113,8 +1105,8 @@ describe('Chart', function() { var yScale = chart.scales.yAxis0; expect(yScale).toBeUndefined(); var newyScale = chart.scales['y-axis-0']; - expect(newyScale.options.ticks.min).toBe(0); - expect(newyScale.options.ticks.max).toBe(10); + expect(newyScale.options.min).toBe(0); + expect(newyScale.options.max).toBe(10); }); it ('should update tooltip options', function() { diff --git a/test/specs/core.scale.tests.js b/test/specs/core.scale.tests.js index 413b014ee..23fd5da82 100644 --- a/test/specs/core.scale.tests.js +++ b/test/specs/core.scale.tests.js @@ -598,10 +598,8 @@ describe('Core.scale', function() { xAxes: [{ id: 'x', type: 'linear', - ticks: { - min: -20, - max: 20 - } + min: -20, + max: 20 }], yAxes: [{ id: 'y', diff --git a/test/specs/core.ticks.tests.js b/test/specs/core.ticks.tests.js index 2dedaac11..459a9869b 100644 --- a/test/specs/core.ticks.tests.js +++ b/test/specs/core.ticks.tests.js @@ -69,9 +69,9 @@ describe('Test tick generators', function() { xAxes: [{ type: 'logarithmic', position: 'bottom', + min: 0.1, + max: 1, ticks: { - min: 0.1, - max: 1, callback: function(value) { return value.toString(); } @@ -79,9 +79,9 @@ describe('Test tick generators', function() { }], yAxes: [{ type: 'logarithmic', + min: 0.1, + max: 1, ticks: { - min: 0.1, - max: 1, callback: function(value) { return value.toString(); } diff --git a/test/specs/scale.category.tests.js b/test/specs/scale.category.tests.js index 99a7636e2..ca7c9e8e9 100644 --- a/test/specs/scale.category.tests.js +++ b/test/specs/scale.category.tests.js @@ -19,6 +19,8 @@ describe('Category scale tests', function() { var defaultConfig = Chart.scaleService.getScaleDefaults('category'); expect(defaultConfig).toEqual({ display: true, + reverse: false, + beginAtZero: false, gridLines: { color: 'rgba(0,0,0,0.1)', @@ -36,12 +38,10 @@ describe('Category scale tests', function() { offset: false, scaleLabel: Chart.defaults.scale.scaleLabel, ticks: { - beginAtZero: false, minRotation: 0, maxRotation: 50, mirror: false, padding: 0, - reverse: false, display: true, callback: defaultConfig.ticks.callback, // make this nicer, then check explicitly below autoSkip: true, @@ -281,10 +281,8 @@ describe('Category scale tests', function() { id: 'xScale0', type: 'category', position: 'bottom', - ticks: { - min: 'tick2', - max: 'tick4' - } + min: 'tick2', + max: 'tick4' }], yAxes: [{ id: 'yScale0', @@ -373,10 +371,8 @@ describe('Category scale tests', function() { id: 'yScale0', type: 'category', position: 'left', - ticks: { - min: '2', - max: '4' - } + min: '2', + max: '4' }] } } diff --git a/test/specs/scale.linear.tests.js b/test/specs/scale.linear.tests.js index 4e8a7c837..9a7c44fba 100644 --- a/test/specs/scale.linear.tests.js +++ b/test/specs/scale.linear.tests.js @@ -13,7 +13,6 @@ describe('Linear Scale', function() { var defaultConfig = Chart.scaleService.getScaleDefaults('linear'); expect(defaultConfig).toEqual({ display: true, - gridLines: { color: 'rgba(0,0,0,0.1)', drawBorder: true, @@ -28,14 +27,14 @@ describe('Linear Scale', function() { }, position: 'left', offset: false, + reverse: false, + beginAtZero: false, scaleLabel: Chart.defaults.scale.scaleLabel, ticks: { - beginAtZero: false, minRotation: 0, maxRotation: 50, mirror: false, padding: 0, - reverse: false, display: true, callback: defaultConfig.ticks.callback, // make this work nicer, then check below autoSkip: true, @@ -132,10 +131,8 @@ describe('Linear Scale', function() { yAxes: [{ id: 'yScale0', type: 'linear', - ticks: { - suggestedMin: -10, - suggestedMax: 15 - } + suggestedMin: -10, + suggestedMax: 15 }] } } @@ -469,9 +466,7 @@ describe('Linear Scale', function() { yAxes: [{ id: 'yScale0', type: 'linear', - ticks: { - beginAtZero: true - } + beginAtZero: true }] } } @@ -497,10 +492,8 @@ describe('Linear Scale', function() { yAxes: [{ id: 'yScale0', type: 'linear', - ticks: { - suggestedMax: 10, - suggestedMin: -10 - } + suggestedMax: 10, + suggestedMin: -10 }] } } @@ -526,10 +519,8 @@ describe('Linear Scale', function() { yAxes: [{ id: 'yScale0', type: 'linear', - ticks: { - max: 1010, - min: -1010 - } + max: 1010, + min: -1010 }] } } @@ -558,9 +549,9 @@ describe('Linear Scale', function() { yAxes: [{ id: 'yScale0', type: 'linear', + min: 1, + max: 11, ticks: { - min: 1, - max: 11, stepSize: 2 } }] @@ -687,7 +678,7 @@ describe('Linear Scale', function() { expect(chart.scales.yScale0).not.toEqual(undefined); // must construct expect(getLabels(chart.scales.yScale0)).toEqual(['50', '45', '40', '35', '30', '25', '20']); - chart.scales.yScale0.options.ticks.beginAtZero = true; + chart.scales.yScale0.options.beginAtZero = true; chart.update(); expect(getLabels(chart.scales.yScale0)).toEqual(['50', '45', '40', '35', '30', '25', '20', '15', '10', '5', '0']); @@ -695,7 +686,7 @@ describe('Linear Scale', function() { chart.update(); expect(getLabels(chart.scales.yScale0)).toEqual(['0', '-5', '-10', '-15', '-20', '-25', '-30', '-35', '-40', '-45', '-50']); - chart.scales.yScale0.options.ticks.beginAtZero = false; + chart.scales.yScale0.options.beginAtZero = false; chart.update(); expect(getLabels(chart.scales.yScale0)).toEqual(['-20', '-25', '-30', '-35', '-40', '-45', '-50']); }); @@ -715,9 +706,7 @@ describe('Linear Scale', function() { yAxes: [{ id: 'yScale0', type: 'linear', - ticks: { - reverse: true - } + reverse: true }] } } @@ -790,8 +779,8 @@ describe('Linear Scale', function() { expect(getLabels(chart.scales.yScale)).toEqual(['2.5', '2.0', '1.5', '1.0', '0.5']); - chart.options.scales.yAxes[0].ticks.min = 0.3; - chart.options.scales.yAxes[0].ticks.max = 2.8; + chart.options.scales.yAxes[0].min = 0.3; + chart.options.scales.yAxes[0].max = 2.8; chart.update(); expect(getLabels(chart.scales.yScale)).toEqual(['2.8', '2.5', '2.0', '1.5', '1.0', '0.5', '0.3']); @@ -1057,9 +1046,7 @@ describe('Linear Scale', function() { options: { scales: { xAxes: [{ - ticks: { - min: 20 - } + min: 20 }] } } @@ -1085,10 +1072,8 @@ describe('Linear Scale', function() { options: { scales: { xAxes: [{ - ticks: { - min: 0, - max: 3000 - } + min: 0, + max: 3000 }] } } @@ -1113,10 +1098,8 @@ describe('Linear Scale', function() { options: { scales: { xAxes: [{ - ticks: { - min: -3000, - max: 0 - } + min: -3000, + max: 0 }] } } @@ -1179,7 +1162,7 @@ describe('Linear Scale', function() { expect(scale.getValueForPixel(end)).toBeCloseTo(max, 4); expect(scale.getValueForPixel(start)).toBeCloseTo(min, 4); - scale.options.ticks.reverse = true; + scale.options.reverse = true; chart.update(); start = chart.chartArea.left; @@ -1220,7 +1203,7 @@ describe('Linear Scale', function() { expect(scale.getValueForPixel(end)).toBeCloseTo(max, 4); expect(scale.getValueForPixel(start)).toBeCloseTo(min, 4); - scale.options.ticks.reverse = true; + scale.options.reverse = true; chart.update(); start = chart.chartArea.bottom; diff --git a/test/specs/scale.logarithmic.tests.js b/test/specs/scale.logarithmic.tests.js index 78de94635..878ea545f 100644 --- a/test/specs/scale.logarithmic.tests.js +++ b/test/specs/scale.logarithmic.tests.js @@ -27,14 +27,14 @@ describe('Logarithmic Scale tests', function() { }, position: 'left', offset: false, + reverse: false, + beginAtZero: false, scaleLabel: Chart.defaults.scale.scaleLabel, ticks: { - beginAtZero: false, minRotation: 0, maxRotation: 50, mirror: false, padding: 0, - reverse: false, display: true, callback: defaultConfig.ticks.callback, // make this nicer, then check explicitly below autoSkip: true, @@ -457,9 +457,9 @@ describe('Logarithmic Scale tests', function() { yAxes: [{ id: 'yScale', type: 'logarithmic', + min: 10, + max: 1010, ticks: { - min: 10, - max: 1010, callback: function(value) { return value; } @@ -491,9 +491,9 @@ describe('Logarithmic Scale tests', function() { yAxes: [{ id: 'yScale', type: 'logarithmic', + min: -10, + max: -1010, ticks: { - min: -10, - max: -1010, callback: function(value) { return value; } @@ -522,9 +522,9 @@ describe('Logarithmic Scale tests', function() { yAxes: [{ id: 'yScale', type: 'logarithmic', + min: 'zero', + max: null, ticks: { - min: 'zero', - max: null, callback: function(value) { return value; } @@ -616,8 +616,8 @@ describe('Logarithmic Scale tests', function() { yAxes: [{ id: 'yScale', type: 'logarithmic', + reverse: true, ticks: { - reverse: true, callback: function(value) { return value; } @@ -647,8 +647,8 @@ describe('Logarithmic Scale tests', function() { yAxes: [{ id: 'yScale', type: 'logarithmic', + reverse: true, ticks: { - reverse: true, callback: function(value) { return value; } @@ -781,26 +781,22 @@ describe('Logarithmic Scale tests', function() { axis: 'y', scale: { yAxes: [{ - ticks: { - min: 0 - } + min: 0 }] }, firstTick: 0, - describe: 'all stacks are defined and ticks.min: 0' + describe: 'all stacks are defined and min: 0' }, { axis: 'y', data: dataWithEmptyStacks, scale: { yAxes: [{ - ticks: { - min: 0 - } + min: 0 }] }, firstTick: 0, - describe: 'not stacks are defined and ticks.min: 0' + describe: 'not stacks are defined and min: 0' }, { axis: 'x', @@ -817,26 +813,22 @@ describe('Logarithmic Scale tests', function() { axis: 'x', scale: { xAxes: [{ - ticks: { - min: 0 - } + min: 0 }] }, firstTick: 0, - describe: 'all stacks are defined and ticks.min: 0' + describe: 'all stacks are defined and min: 0' }, { axis: 'x', data: dataWithEmptyStacks, scale: { xAxes: [{ - ticks: { - min: 0 - } + min: 0 }] }, firstTick: 0, - describe: 'not all stacks are defined and ticks.min: 0' + describe: 'not all stacks are defined and min: 0' }, ]; config.forEach(function(setup) { @@ -886,7 +878,7 @@ describe('Logarithmic Scale tests', function() { expect(scale.getValueForPixel(start)).toBeCloseTo(firstTick, 4); expect(scale.getValueForPixel(end)).toBeCloseTo(lastTick, 4); - chart.scales[axisID].options.ticks.reverse = true; // Reverse mode + chart.scales[axisID].options.reverse = true; // Reverse mode chart.update(); // chartArea might have been resized in update @@ -909,14 +901,14 @@ describe('Logarithmic Scale tests', function() { dataset: [], firstTick: 1, // value of the first tick lastTick: 10, // value of the last tick - describe: 'empty dataset, without ticks.min/max' + describe: 'empty dataset, without min/max' }, { dataset: [], scale: {stacked: true}, firstTick: 1, lastTick: 10, - describe: 'empty dataset, without ticks.min/max, with stacked: true' + describe: 'empty dataset, without min/max, with stacked: true' }, { data: { @@ -928,7 +920,7 @@ describe('Logarithmic Scale tests', function() { type: 'bar', firstTick: 1, lastTick: 10, - describe: 'empty dataset with stack option, without ticks.min/max' + describe: 'empty dataset with stack option, without min/max' }, { data: { @@ -940,28 +932,28 @@ describe('Logarithmic Scale tests', function() { type: 'horizontalBar', firstTick: 1, lastTick: 10, - describe: 'empty dataset with stack option, without ticks.min/max' + describe: 'empty dataset with stack option, without min/max' }, { dataset: [], - scale: {ticks: {min: 1}}, + scale: {min: 1}, firstTick: 1, lastTick: 10, - describe: 'empty dataset, ticks.min: 1, without ticks.max' + describe: 'empty dataset, min: 1, without max' }, { dataset: [], - scale: {ticks: {max: 80}}, + scale: {max: 80}, firstTick: 1, lastTick: 80, - describe: 'empty dataset, ticks.max: 80, without ticks.min' + describe: 'empty dataset, max: 80, without min' }, { dataset: [], - scale: {ticks: {max: 0.8}}, + scale: {max: 0.8}, firstTick: 0.01, lastTick: 0.8, - describe: 'empty dataset, ticks.max: 0.8, without ticks.min' + describe: 'empty dataset, max: 0.8, without min' }, { dataset: [{x: 10, y: 10}, {x: 5, y: 5}, {x: 1, y: 1}, {x: 25, y: 25}, {x: 78, y: 78}], @@ -1029,7 +1021,7 @@ describe('Logarithmic Scale tests', function() { expect(scale.getValueForPixel(start)).toBeCloseTo(firstTick, 4); expect(scale.getValueForPixel(end)).toBeCloseTo(lastTick, 4); - chart.scales[axisID].options.ticks.reverse = true; // Reverse mode + chart.scales[axisID].options.reverse = true; // Reverse mode chart.update(); // chartArea might have been resized in update @@ -1051,24 +1043,24 @@ describe('Logarithmic Scale tests', function() { var config = [ { dataset: [], - scale: {ticks: {min: 0}}, + scale: {min: 0}, firstTick: 1, // value of the first tick lastTick: 10, // value of the last tick - describe: 'empty dataset, ticks.min: 0, without ticks.max' + describe: 'empty dataset, min: 0, without max' }, { dataset: [], - scale: {ticks: {min: 0, max: 80}}, + scale: {min: 0, max: 80}, firstTick: 1, lastTick: 80, - describe: 'empty dataset, ticks.min: 0, ticks.max: 80' + describe: 'empty dataset, min: 0, max: 80' }, { dataset: [], - scale: {ticks: {min: 0, max: 0.8}}, + scale: {min: 0, max: 0.8}, firstTick: 0.1, lastTick: 0.8, - describe: 'empty dataset, ticks.min: 0, ticks.max: 0.8' + describe: 'empty dataset, min: 0, max: 0.8' }, { dataset: [{x: 0, y: 0}, {x: 10, y: 10}, {x: 1.2, y: 1.2}, {x: 25, y: 25}, {x: 78, y: 78}], @@ -1084,17 +1076,17 @@ describe('Logarithmic Scale tests', function() { }, { dataset: [{x: 10, y: 10}, {x: 1.2, y: 1.2}, {x: 25, y: 25}, {x: 78, y: 78}], - scale: {ticks: {min: 0}}, + scale: {min: 0}, firstTick: 1, lastTick: 80, - describe: 'dataset min point {x: 1.2, y: 1.2}, max point {x:78, y:78}, ticks.min: 0' + describe: 'dataset min point {x: 1.2, y: 1.2}, max point {x:78, y:78}, min: 0' }, { dataset: [{x: 10, y: 10}, {x: 6.3, y: 6.3}, {x: 25, y: 25}, {x: 78, y: 78}], - scale: {ticks: {min: 0}}, + scale: {min: 0}, firstTick: 6, lastTick: 80, - describe: 'dataset min point {x: 6.3, y: 6.3}, max point {x:78, y:78}, ticks.min: 0' + describe: 'dataset min point {x: 6.3, y: 6.3}, max point {x:78, y:78}, min: 0' }, ]; config.forEach(function(setup) { @@ -1159,7 +1151,7 @@ describe('Logarithmic Scale tests', function() { expect(scale.getValueForPixel(end)).toBeCloseTo(lastTick, 4); expect(scale.getValueForPixel(start + sign * fontSize)).toBeCloseTo(firstTick, 4); - chart.scales[axisID].options.ticks.reverse = true; // Reverse mode + chart.scales[axisID].options.reverse = true; // Reverse mode chart.update(); // chartArea might have been resized in update diff --git a/test/specs/scale.radialLinear.tests.js b/test/specs/scale.radialLinear.tests.js index b8ae7c8d8..c25dc18d7 100644 --- a/test/specs/scale.radialLinear.tests.js +++ b/test/specs/scale.radialLinear.tests.js @@ -44,17 +44,17 @@ describe('Test the radial linear scale', function() { }, position: 'chartArea', offset: false, + reverse: false, + beginAtZero: false, scaleLabel: Chart.defaults.scale.scaleLabel, ticks: { backdropColor: 'rgba(255,255,255,0.75)', backdropPaddingY: 2, backdropPaddingX: 2, - beginAtZero: false, minRotation: 0, maxRotation: 50, mirror: false, padding: 0, - reverse: false, showLabelBackdrop: true, display: true, callback: defaultConfig.ticks.callback, // make this nicer, then check explicitly below @@ -183,10 +183,8 @@ describe('Test the radial linear scale', function() { }, options: { scale: { - ticks: { - suggestedMin: -10, - suggestedMax: 10 - } + suggestedMin: -10, + suggestedMax: 10 } } }); @@ -206,10 +204,8 @@ describe('Test the radial linear scale', function() { }, options: { scale: { - ticks: { - min: -1010, - max: 1010 - } + min: -1010, + max: 1010 } } }); @@ -230,16 +226,14 @@ describe('Test the radial linear scale', function() { }, options: { scale: { - ticks: { - beginAtZero: false - } + beginAtZero: false } } }); expect(getLabels(chart.scale)).toEqual(['20', '25', '30', '35', '40', '45', '50']); - chart.scale.options.ticks.beginAtZero = true; + chart.scale.options.beginAtZero = true; chart.update(); expect(getLabels(chart.scale)).toEqual(['0', '5', '10', '15', '20', '25', '30', '35', '40', '45', '50']); @@ -249,7 +243,7 @@ describe('Test the radial linear scale', function() { expect(getLabels(chart.scale)).toEqual(['-50', '-45', '-40', '-35', '-30', '-25', '-20', '-15', '-10', '-5', '0']); - chart.scale.options.ticks.beginAtZero = false; + chart.scale.options.beginAtZero = false; chart.update(); expect(getLabels(chart.scale)).toEqual(['-50', '-45', '-40', '-35', '-30', '-25', '-20']); @@ -266,9 +260,7 @@ describe('Test the radial linear scale', function() { }, options: { scale: { - ticks: { - reverse: true - } + reverse: true } } }); @@ -308,8 +300,8 @@ describe('Test the radial linear scale', function() { expect(getLabels(chart.scale)).toEqual(['0.5', '1.0', '1.5', '2.0', '2.5']); - chart.options.scale.ticks.min = 0.3; - chart.options.scale.ticks.max = 2.8; + chart.options.scale.min = 0.3; + chart.options.scale.max = 2.8; chart.update(); expect(getLabels(chart.scale)).toEqual(['0.3', '0.5', '1.0', '1.5', '2.0', '2.5', '2.8']); @@ -450,7 +442,7 @@ describe('Test the radial linear scale', function() { expect(position.x).toBeCloseToPixel(270); expect(position.y).toBeCloseToPixel(278); - chart.scale.options.ticks.reverse = true; + chart.scale.options.reverse = true; chart.update(); expect(chart.scale.getDistanceFromCenterForValue(chart.scale.min)).toBe(227); diff --git a/test/specs/scale.time.tests.js b/test/specs/scale.time.tests.js index f314af77a..40f397b02 100755 --- a/test/specs/scale.time.tests.js +++ b/test/specs/scale.time.tests.js @@ -74,18 +74,18 @@ describe('Time scale tests', function() { }, position: 'bottom', offset: false, + reverse: false, + beginAtZero: false, scaleLabel: Chart.defaults.scale.scaleLabel, bounds: 'data', distribution: 'linear', adapters: {}, ticks: { - beginAtZero: false, minRotation: 0, maxRotation: 50, mirror: false, source: 'auto', padding: 0, - reverse: false, display: true, callback: defaultConfig.ticks.callback, // make this nicer, then check explicitly below, autoSkip: false, @@ -419,28 +419,28 @@ describe('Time scale tests', function() { }); it('should use the min option when less than first label for building ticks', function() { - config.ticks.min = '2014-12-29T04:00:00'; + config.min = '2014-12-29T04:00:00'; var labels = getLabels(createScale(mockData, config)); expect(labels[0]).toEqual('Jan 1'); }); it('should use the min option when greater than first label for building ticks', function() { - config.ticks.min = '2015-01-02T04:00:00'; + config.min = '2015-01-02T04:00:00'; var labels = getLabels(createScale(mockData, config)); expect(labels[0]).toEqual('Jan 2'); }); it('should use the max option when greater than last label for building ticks', function() { - config.ticks.max = '2015-01-05T06:00:00'; + config.max = '2015-01-05T06:00:00'; var labels = getLabels(createScale(mockData, config)); expect(labels[labels.length - 1]).toEqual('Jan 3'); }); it('should use the max option when less than last label for building ticks', function() { - config.ticks.max = '2015-01-02T23:00:00'; + config.max = '2015-01-02T23:00:00'; var labels = getLabels(createScale(mockData, config)); expect(labels[labels.length - 1]).toEqual('Jan 2'); @@ -460,28 +460,28 @@ describe('Time scale tests', function() { }); it('should use the min option when less than first label for building ticks', function() { - config.ticks.min = '2014-12-29T04:00:00'; + config.min = '2014-12-29T04:00:00'; var labels = getLabels(createScale(mockData, config)); expect(labels[0]).toEqual('Jan 1'); }); it('should use the min option when greater than first label for building ticks', function() { - config.ticks.min = '2015-01-02T04:00:00'; + config.min = '2015-01-02T04:00:00'; var labels = getLabels(createScale(mockData, config)); expect(labels[0]).toEqual('Jan 2'); }); it('should use the max option when greater than last label for building ticks', function() { - config.ticks.max = '2015-01-05T06:00:00'; + config.max = '2015-01-05T06:00:00'; var labels = getLabels(createScale(mockData, config)); expect(labels[labels.length - 1]).toEqual('Jan 3'); }); it('should use the max option when less than last label for building ticks', function() { - config.ticks.max = '2015-01-02T23:00:00'; + config.max = '2015-01-02T23:00:00'; var labels = getLabels(createScale(mockData, config)); expect(labels[labels.length - 1]).toEqual('Jan 2'); @@ -958,8 +958,8 @@ describe('Time scale tests', function() { var scale = chart.scales.x; var options = chart.options.scales.xAxes[0]; - options.ticks.min = '2012'; - options.ticks.max = '2051'; + options.min = '2012'; + options.max = '2051'; chart.update(); expect(scale.min).toEqual(+moment('2012', 'YYYY')); @@ -972,8 +972,8 @@ describe('Time scale tests', function() { var scale = chart.scales.x; var options = chart.options.scales.xAxes[0]; - options.ticks.min = '2017'; - options.ticks.max = '2042'; + options.min = '2017'; + options.max = '2042'; chart.update(); expect(scale.min).toEqual(+moment('2017', 'YYYY')); @@ -1052,8 +1052,8 @@ describe('Time scale tests', function() { var scale = chart.scales.x; var options = chart.options.scales.xAxes[0]; - options.ticks.min = '2012'; - options.ticks.max = '2051'; + options.min = '2012'; + options.max = '2051'; chart.update(); expect(scale.min).toEqual(+moment('2012', 'YYYY')); @@ -1066,8 +1066,8 @@ describe('Time scale tests', function() { var scale = chart.scales.x; var options = chart.options.scales.xAxes[0]; - options.ticks.min = '2017'; - options.ticks.max = '2043'; + options.min = '2017'; + options.max = '2043'; chart.update(); expect(scale.min).toEqual(+moment('2017', 'YYYY')); @@ -1151,7 +1151,7 @@ describe('Time scale tests', function() { var scale = chart.scales.x; var options = chart.options.scales.xAxes[0]; - options.ticks.min = '2012'; + options.min = '2012'; chart.update(); var start = scale.left; @@ -1165,7 +1165,7 @@ describe('Time scale tests', function() { var scale = chart.scales.x; var options = chart.options.scales.xAxes[0]; - options.ticks.max = '2050'; + options.max = '2050'; chart.update(); var start = scale.left; @@ -1179,8 +1179,8 @@ describe('Time scale tests', function() { var scale = chart.scales.x; var options = chart.options.scales.xAxes[0]; - options.ticks.min = '2012'; - options.ticks.max = '2050'; + options.min = '2012'; + options.max = '2050'; chart.update(); var start = scale.left; @@ -1235,8 +1235,8 @@ describe('Time scale tests', function() { var scale = chart.scales.x; var options = chart.options.scales.xAxes[0]; - options.ticks.min = '2012'; - options.ticks.max = '2050'; + options.min = '2012'; + options.max = '2050'; chart.update(); var start = scale.left; @@ -1328,7 +1328,7 @@ describe('Time scale tests', function() { }); }); - describe('when ticks.min and/or ticks.max are defined', function() { + describe('when min and/or max are defined', function() { ['auto', 'data', 'labels'].forEach(function(source) { ['data', 'ticks'].forEach(function(bounds) { describe('and ticks.source is "' + source + '" and bounds "' + bounds + '"', function() { @@ -1368,8 +1368,8 @@ describe('Time scale tests', function() { var min = '02/19 07:00'; var max = '02/24 08:00'; - options.ticks.min = min; - options.ticks.max = max; + options.min = min; + options.max = max; chart.update(); expect(scale.min).toEqual(+moment(min, 'MM/DD HH:mm')); @@ -1388,8 +1388,8 @@ describe('Time scale tests', function() { var min = '02/21 07:00'; var max = '02/22 20:00'; - options.ticks.min = min; - options.ticks.max = max; + options.min = min; + options.max = max; chart.update(); expect(scale.min).toEqual(+moment(min, 'MM/DD HH:mm')); @@ -1462,8 +1462,8 @@ describe('Time scale tests', function() { var scale = chart.scales.x; var options = chart.options.scales.xAxes[0]; - options.ticks.min = '2012'; - options.ticks.max = '2051'; + options.min = '2012'; + options.max = '2051'; chart.update(); expect(scale.getPixelForValue('2012')).toBeCloseToPixel(scale.left); @@ -1506,8 +1506,8 @@ describe('Time scale tests', function() { var scale = chart.scales.x; var options = chart.options.scales.xAxes[0]; - options.ticks.min = '2012'; - options.ticks.max = '2051'; + options.min = '2012'; + options.max = '2051'; options.offset = true; chart.update(); @@ -1521,7 +1521,7 @@ describe('Time scale tests', function() { }); }); - describe('when ticks.reverse', function() { + describe('when reverse', function() { describe('is "true"', function() { beforeEach(function() { this.chart = window.acquireChart({ @@ -1535,12 +1535,12 @@ describe('Time scale tests', function() { xAxes: [{ id: 'x', type: 'time', + reverse: true, time: { parser: 'YYYY', }, ticks: { source: 'labels', - reverse: true } }], yAxes: [{ @@ -1609,7 +1609,7 @@ describe('Time scale tests', function() { }); }); - describe('when ticks.reverse is "true" and distribution', function() { + describe('when reverse is "true" and distribution', function() { describe('is "series"', function() { beforeEach(function() { this.chart = window.acquireChart({ @@ -1627,9 +1627,9 @@ describe('Time scale tests', function() { parser: 'YYYY' }, distribution: 'series', + reverse: true, ticks: { - source: 'labels', - reverse: true + source: 'labels' } }], yAxes: [{ @@ -1657,7 +1657,7 @@ describe('Time scale tests', function() { var scale = chart.scales.x; var options = chart.options.scales.xAxes[0]; - options.ticks.min = '2012'; + options.min = '2012'; chart.update(); var start = scale.left; @@ -1672,7 +1672,7 @@ describe('Time scale tests', function() { var scale = chart.scales.x; var options = chart.options.scales.xAxes[0]; - options.ticks.max = '2050'; + options.max = '2050'; chart.update(); var start = scale.left; @@ -1687,8 +1687,8 @@ describe('Time scale tests', function() { var scale = chart.scales.x; var options = chart.options.scales.xAxes[0]; - options.ticks.min = '2012'; - options.ticks.max = '2050'; + options.min = '2012'; + options.max = '2050'; chart.update(); var start = scale.left; @@ -1715,9 +1715,9 @@ describe('Time scale tests', function() { parser: 'YYYY' }, distribution: 'linear', + reverse: true, ticks: { - source: 'labels', - reverse: true + source: 'labels' } }], yAxes: [{ @@ -1745,8 +1745,8 @@ describe('Time scale tests', function() { var scale = chart.scales.x; var options = chart.options.scales.xAxes[0]; - options.ticks.min = '2012'; - options.ticks.max = '2050'; + options.min = '2012'; + options.max = '2050'; chart.update(); var start = scale.left;