]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Small chores (#8408)
authorJukka Kurkela <jukka.kurkela@gmail.com>
Wed, 10 Feb 2021 16:06:48 +0000 (18:06 +0200)
committerGitHub <noreply@github.com>
Wed, 10 Feb 2021 16:06:48 +0000 (18:06 +0200)
.editorconfig
docs/docs/general/options.md
src/controllers/controller.polarArea.js
src/controllers/controller.radar.js
src/core/core.controller.js

index a992ef3911cc045d652dcc490675b38eb2defb1a..a56f2d2d266d31e97085e9c4d05d527ba75cfccc 100644 (file)
@@ -2,21 +2,9 @@
 root = true
 
 [*]
-indent_style = tab
-indent_size = 4
+indent_style = space
+indent_size = 2
 end_of_line = lf
 charset = utf-8
 trim_trailing_whitespace = true
 insert_final_newline = true
-
-[*.yml]
-indent_style = space
-indent_size = 2
-
-[*.json]
-indent_style = space
-indent_size = 2
-
-[*.mdx]
-indent_style = space
-indent_size = 2
index d0e54ac5e93f58b951ee5b1a36b5b6c6ee7bfbab..7776138532286b19830c59f220b915a791909d25 100644 (file)
@@ -41,11 +41,11 @@ The object is preserved, so it can be used to store and pass information between
 
 There are multiple levels of context objects:
 
-- `chart`
-  - `dataset`
-    - `data`
-  - `scale`
-    - `tick`
+* `chart`
+  * `dataset`
+    * `data`
+  * `scale`
+    * `tick`
 
 Each level inherits its parent(s) and any contextual information stored in the parent is available through the child.
 
@@ -53,42 +53,42 @@ The context object contains the following properties:
 
 ### chart
 
-- `chart`: the associated chart
-- `type`: `'chart'`
+* `chart`: the associated chart
+* `type`: `'chart'`
 
 ### dataset
 
 In addition to [chart](#chart)
 
-- `active`: true if element is active (hovered)
-- `dataset`: dataset at index `datasetIndex`
-- `datasetIndex`: index of the current dataset
-- `index`: getter for `datasetIndex`
-- `type`: `'dataset'`
+* `active`: true if element is active (hovered)
+* `dataset`: dataset at index `datasetIndex`
+* `datasetIndex`: index of the current dataset
+* `index`: getter for `datasetIndex`
+* `type`: `'dataset'`
 
 ### data
 
 In addition to [dataset](#dataset)
 
-- `active`: true if element is active (hovered)
-- `dataIndex`: index of the current data
-- `parsed`: the parsed data values for the given `dataIndex` and `datasetIndex`
-- `raw`: the raw data values for the given `dataIndex` and `datasetIndex`
-- `element`: the element (point, arc, bar, etc.) for this data
-- `index`: getter for `dataIndex`
-- `type`: `'data'`
+* `active`: true if element is active (hovered)
+* `dataIndex`: index of the current data
+* `parsed`: the parsed data values for the given `dataIndex` and `datasetIndex`
+* `raw`: the raw data values for the given `dataIndex` and `datasetIndex`
+* `element`: the element (point, arc, bar, etc.) for this data
+* `index`: getter for `dataIndex`
+* `type`: `'data'`
 
 ### scale
 
 In addition to [chart](#chart)
 
-- `scale`: the associated scale
-- `type`: `'scale'`
+* `scale`: the associated scale
+* `type`: `'scale'`
 
 ### tick
 
 In addition to [scale](#scale)
 
-- `tick`: the associated tick object
-- `index`: tick index
-- `type`: `'tick'`
+* `tick`: the associated tick object
+* `index`: tick index
+* `type`: `'tick'`
index d322e70a3e60e4784f256705224e9a73724d3fef..0ce190395e2bd0ce8faa369456e51a056e6bcb32 100644 (file)
@@ -152,9 +152,7 @@ PolarAreaController.defaults = {
     animateScale: true
   },
   aspectRatio: 1,
-  datasets: {
-    indexAxis: 'r'
-  },
+  indexAxis: 'r',
   scales: {
     r: {
       type: 'radialLinear',
index e197f32827863433197256df84d78089e036f9ab..a2b8a2b12603777b2b5d241c5a06bb73dd0a992b 100644 (file)
@@ -129,9 +129,7 @@ RadarController.defaults = {
       type: 'radialLinear',
     }
   },
-  datasets: {
-    indexAxis: 'r'
-  },
+  indexAxis: 'r',
   elements: {
     line: {
       fill: 'start',
index cf0b75867e24b7299310d5a9e269df2197615ead..04ec4c191c5cefaee3f6a72abd0a946186fceb62 100644 (file)
@@ -238,15 +238,10 @@ class Chart {
   ensureScalesHaveIDs() {
     const options = this.options;
     const scalesOptions = options.scales || {};
-    const scaleOptions = options.scale;
 
     each(scalesOptions, (axisOptions, axisID) => {
       axisOptions.id = axisID;
     });
-
-    if (scaleOptions) {
-      scaleOptions.id = scaleOptions.id || 'scale';
-    }
   }
 
   /**
@@ -256,7 +251,7 @@ class Chart {
     const me = this;
     const options = me.options;
     const scaleOpts = options.scales;
-    const scales = me.scales || {};
+    const scales = me.scales;
     const updated = Object.keys(scales).reduce((obj, id) => {
       obj[id] = false;
       return obj;
@@ -313,8 +308,6 @@ class Chart {
       }
     });
 
-    me.scales = scales;
-
     each(scales, (scale) => {
       layouts.configure(me, scale, scale.options);
       layouts.addBox(me, scale);
@@ -435,7 +428,6 @@ class Chart {
 
   update(mode) {
     const me = this;
-    let i, ilen;
 
     each(me.scales, (scale) => {
       layouts.removeBox(me, scale);
@@ -462,7 +454,7 @@ class Chart {
     me.notifyPlugins('beforeElementsUpdate');
 
     // Make sure all dataset controllers have correct meta data counts
-    for (i = 0, ilen = me.data.datasets.length; i < ilen; i++) {
+    for (let i = 0, ilen = me.data.datasets.length; i < ilen; i++) {
       const {controller} = me.getDatasetMeta(i);
       const reset = !animsDisabled && newControllers.indexOf(controller) === -1;
       // New controllers will be reset after the layout pass, so we only want to modify
@@ -1078,7 +1070,7 @@ class Chart {
     }
 
     // Invoke onHover hook
-    callCallback(options.onHover || options.hover.onHover, [e, active, me], me);
+    callCallback(options.onHover || hoverOptions.onHover, [e, active, me], me);
 
     if (e.type === 'mouseup' || e.type === 'click' || e.type === 'contextmenu') {
       if (_isPointInArea(e, me.chartArea)) {