language stringclasses 1
value | owner stringlengths 2 15 | repo stringlengths 2 21 | sha stringlengths 45 45 | message stringlengths 7 36.3k | path stringlengths 1 199 | patch stringlengths 15 102k | is_multipart bool 2
classes |
|---|---|---|---|---|---|---|---|
Other | chartjs | Chart.js | fe3931b0775a91b1661df8ca708c572d571f4b73.json | Reduce scope of imports (#7000) | src/controllers/controller.line.js | @@ -2,7 +2,8 @@
import DatasetController from '../core/core.datasetController';
import defaults from '../core/core.defaults';
-import elements from '../elements';
+import Line from '../elements/element.line';
+import Point from '../elements/element.point';
import helpers from '../helpers';
const valueOrDefault ... | true |
Other | chartjs | Chart.js | fe3931b0775a91b1661df8ca708c572d571f4b73.json | Reduce scope of imports (#7000) | src/controllers/controller.polarArea.js | @@ -2,7 +2,7 @@
import DatasetController from '../core/core.datasetController';
import defaults from '../core/core.defaults';
-import elements from '../elements';
+import Arc from '../elements/element.arc';
import helpers from '../helpers';
const resolve = helpers.options.resolve;
@@ -93,7 +93,7 @@ function get... | true |
Other | chartjs | Chart.js | fe3931b0775a91b1661df8ca708c572d571f4b73.json | Reduce scope of imports (#7000) | src/controllers/controller.radar.js | @@ -2,7 +2,8 @@
import DatasetController from '../core/core.datasetController';
import defaults from '../core/core.defaults';
-import elements from '../elements';
+import Line from '../elements/element.line';
+import Point from '../elements/element.point';
import helpers from '../helpers';
const valueOrDefault ... | true |
Other | chartjs | Chart.js | fe3931b0775a91b1661df8ca708c572d571f4b73.json | Reduce scope of imports (#7000) | src/core/core.plugins.js | @@ -1,7 +1,7 @@
'use strict';
import defaults from './core.defaults';
-import helpers from '../helpers/';
+import {clone} from '../helpers/helpers.core';
defaults._set('plugins', {});
@@ -142,7 +142,7 @@ export default {
}
if (opts === true) {
- opts = helpers.clone(defaults.plugins[id]);
+ opt... | true |
Other | chartjs | Chart.js | fe3931b0775a91b1661df8ca708c572d571f4b73.json | Reduce scope of imports (#7000) | src/core/core.scaleService.js | @@ -1,7 +1,7 @@
'use strict';
import defaults from './core.defaults';
-import helpers from '../helpers';
+import {clone, each, extend, merge} from '../helpers/helpers.core';
import layouts from './core.layouts';
export default {
@@ -15,24 +15,24 @@ export default {
defaults: {},
registerScaleType: function(... | true |
Other | chartjs | Chart.js | 7eb0c2ca684b9ee32d2e6a826abf9bb3fc771b96.json | Allow specifying spanGaps as number (max distance) (#6993) | docs/charts/line.md | @@ -77,7 +77,7 @@ The line chart allows a number of properties to be specified for each dataset. T
| [`pointRotation`](#point-styling) | `number` | Yes | Yes | `0`
| [`pointStyle`](#point-styling) | <code>string|Image</code> | Yes | Yes | `'circle'`
| [`showLine`](#line-styling) | `boolean` | - | - | `undefined... | true |
Other | chartjs | Chart.js | 7eb0c2ca684b9ee32d2e6a826abf9bb3fc771b96.json | Allow specifying spanGaps as number (max distance) (#6993) | samples/samples.js | @@ -121,6 +121,9 @@
}, {
title: 'Line (point data)',
path: 'scales/time/line-point-data.html'
+ }, {
+ title: 'Line (break on 2 day gap)',
+ path: 'scales/time/line-max-span.html'
}, {
title: 'Time Series',
path: 'scales/time/financial.html' | true |
Other | chartjs | Chart.js | 7eb0c2ca684b9ee32d2e6a826abf9bb3fc771b96.json | Allow specifying spanGaps as number (max distance) (#6993) | samples/scales/time/line-max-span.html | @@ -0,0 +1,150 @@
+<!doctype html>
+<html>
+
+<head>
+ <title>Time Scale Point Data</title>
+ <script src="https://cdn.jsdelivr.net/npm/moment@2.24.0/moment.min.js"></script>
+ <script src="../../../dist/Chart.min.js"></script>
+ <script src="../../utils.js"></script>
+ <style>
+ canvas {
+ -moz-user-select: none;
+... | true |
Other | chartjs | Chart.js | 7eb0c2ca684b9ee32d2e6a826abf9bb3fc771b96.json | Allow specifying spanGaps as number (max distance) (#6993) | src/controllers/controller.line.js | @@ -98,6 +98,9 @@ export default DatasetController.extend({
const firstOpts = me._resolveDataElementOptions(start, mode);
const sharedOptions = me._getSharedOptions(mode, points[start], firstOpts);
const includeOptions = me._includeOptions(mode, sharedOptions);
+ const spanGaps = valueOrDefault(me._config.spa... | true |
Other | chartjs | Chart.js | 7eb0c2ca684b9ee32d2e6a826abf9bb3fc771b96.json | Allow specifying spanGaps as number (max distance) (#6993) | src/helpers/helpers.segment.js | @@ -179,11 +179,11 @@ function solidSegments(points, start, max, loop) {
for (end = start + 1; end <= max; ++end) {
const cur = points[end % count];
- if (cur.skip) {
+ if (cur.skip || cur.stop) {
if (!prev.skip) {
loop = false;
result.push({start: start % count, end: (end - 1) % count, loop});
-... | true |
Other | chartjs | Chart.js | 9fda5ec667848f12d732a4ca1e89088ac30f2a69.json | Use binary search for interpolations (#6958) | src/core/core.datasetController.js | @@ -980,6 +980,10 @@ helpers.extend(DatasetController.prototype, {
* @private
*/
_getSharedOptions: function(mode, el, options) {
+ if (!mode) {
+ // store element option sharing status for usage in interactions
+ this._sharedOptions = options && options.$shared;
+ }
if (mode !== 'reset' && options && ... | true |
Other | chartjs | Chart.js | 9fda5ec667848f12d732a4ca1e89088ac30f2a69.json | Use binary search for interpolations (#6958) | src/core/core.interaction.js | @@ -1,8 +1,8 @@
'use strict';
import helpers from '../helpers/index';
-import {isNumber} from '../helpers/helpers.math';
import {_isPointInArea} from '../helpers/helpers.canvas';
+import {_lookup, _rlookup} from '../helpers/helpers.collection';
/**
* Helper function to get relative position for an event
@@ -4... | true |
Other | chartjs | Chart.js | 9fda5ec667848f12d732a4ca1e89088ac30f2a69.json | Use binary search for interpolations (#6958) | src/elements/element.point.js | @@ -77,6 +77,11 @@ class Point extends Element {
helpers.canvas.drawPoint(ctx, options, me.x, me.y);
}
}
+
+ getRange() {
+ const options = this.options || {};
+ return options.radius + options.hitRadius;
+ }
}
Point.prototype._type = 'point'; | true |
Other | chartjs | Chart.js | 9fda5ec667848f12d732a4ca1e89088ac30f2a69.json | Use binary search for interpolations (#6958) | src/elements/element.rectangle.js | @@ -181,6 +181,10 @@ class Rectangle extends Element {
y: this.y
};
}
+
+ getRange(axis) {
+ return axis === 'x' ? this.width / 2 : this.height / 2;
+ }
}
Rectangle.prototype._type = 'rectangle'; | true |
Other | chartjs | Chart.js | 9fda5ec667848f12d732a4ca1e89088ac30f2a69.json | Use binary search for interpolations (#6958) | src/helpers/helpers.collection.js | @@ -0,0 +1,49 @@
+'use strict';
+
+/**
+ * Binary search
+ * @param {array} table - the table search. must be sorted!
+ * @param {string} key - property name for the value in each entry
+ * @param {number} value - value to find
+ * @private
+ */
+export function _lookup(table, key, value) {
+ let hi = table.length - 1;... | true |
Other | chartjs | Chart.js | 9fda5ec667848f12d732a4ca1e89088ac30f2a69.json | Use binary search for interpolations (#6958) | src/scales/scale.time.js | @@ -5,6 +5,7 @@ import defaults from '../core/core.defaults';
import helpers from '../helpers/index';
import {toRadians} from '../helpers/helpers.math';
import Scale from '../core/core.scale';
+import {_lookup} from '../helpers/helpers.collection';
const resolve = helpers.options.resolve;
const valueOrDefault = ... | true |
Other | chartjs | Chart.js | 14df2c6722ea521a57ceceadb75dade7d100ae34.json | Enable imports for tests (#6997) | karma.conf.js | @@ -59,6 +59,7 @@ module.exports = function(karma) {
].concat((args.inputs || 'test/specs/**/*.js').split(';')),
preprocessors: {
+ 'test/specs/**/*.js': ['rollup'],
'test/index.js': ['rollup'],
'src/index.js': ['sources']
}, | true |
Other | chartjs | Chart.js | 14df2c6722ea521a57ceceadb75dade7d100ae34.json | Enable imports for tests (#6997) | test/specs/helpers.math.tests.js | @@ -1,8 +1,8 @@
'use strict';
+import * as math from '../../src/helpers/helpers.math';
describe('Chart.helpers.math', function() {
- var math = Chart.helpers.math;
var factorize = math._factorize;
var decimalPlaces = math._decimalPlaces;
| true |
Other | chartjs | Chart.js | fd7cf48806a55f79a56f9613db6ab4e87c8241bb.json | Update version in package-lock (#6994) | package-lock.json | @@ -1,6 +1,6 @@
{
"name": "chart.js",
- "version": "2.9.1",
+ "version": "3.0.0-dev",
"lockfileVersion": 1,
"requires": true,
"dependencies": { | false |
Other | chartjs | Chart.js | fb19b77e4bc0e3f097386caf21aed6fa2fd2b03d.json | Fix tooltip for 'dataset' mode (#6961) | src/core/core.controller.js | @@ -888,10 +888,6 @@ class Chart {
if (mode === 'dataset') {
meta = this.getDatasetMeta(items[0].datasetIndex);
meta.controller['_' + prefix + 'DatasetHoverStyle']();
- for (i = 0, ilen = meta.data.length; i < ilen; ++i) {
- meta.controller[prefix + 'HoverStyle'](meta.data[i], items[0].datasetIndex, i);... | true |
Other | chartjs | Chart.js | fb19b77e4bc0e3f097386caf21aed6fa2fd2b03d.json | Fix tooltip for 'dataset' mode (#6961) | src/core/core.interaction.js | @@ -228,7 +228,12 @@ export default {
let items = options.intersect ? getIntersectItems(chart, position, axis) : getNearestItems(chart, position, axis);
if (items.length > 0) {
- items = [{datasetIndex: items[0].datasetIndex}]; // when mode: 'dataset' we only need to return datasetIndex
+ const datasetI... | true |
Other | chartjs | Chart.js | fb19b77e4bc0e3f097386caf21aed6fa2fd2b03d.json | Fix tooltip for 'dataset' mode (#6961) | test/specs/core.interaction.tests.js | @@ -227,8 +227,8 @@ describe('Core.Interaction', function() {
y: point.y
};
- var elements = Chart.Interaction.modes.dataset(chart, evt, {intersect: true});
- expect(elements).toEqual([{datasetIndex: 0}]);
+ var elements = Chart.Interaction.modes.dataset(chart, evt, {intersect: true}).map(item => ... | true |
Other | chartjs | Chart.js | 5aaff3a1aa38ad8f807d676d26dbac933c8f2d6e.json | Convert Tooltip to a plugin (#6990)
* Convert Tooltip to a plugin
* code review feedback
* Update docs. Convert positioners map to be on the plugin directly | docs/configuration/tooltip.md | @@ -61,13 +61,14 @@ Example:
```javascript
/**
* Custom positioner
- * @function Chart.Tooltip.positioners.custom
+ * @function Tooltip.positioners.custom
* @param elements {Chart.Element[]} the tooltip elements
* @param eventPosition {Point} the position of the event in canvas coordinates
* @returns {Point} ... | true |
Other | chartjs | Chart.js | 5aaff3a1aa38ad8f807d676d26dbac933c8f2d6e.json | Convert Tooltip to a plugin (#6990)
* Convert Tooltip to a plugin
* code review feedback
* Update docs. Convert positioners map to be on the plugin directly | docs/getting-started/v3-migration.md | @@ -79,6 +79,7 @@ Animation system was completely rewritten in Chart.js v3. Each property can now
* `Chart.Controller`
* `Chart.prototype.generateLegend`
* `Chart.types`
+* `Chart.Tooltip` is now provided by the tooltip plugin. The positioners can be accessed from `tooltipPlugin.positioners`
* `DatasetController.ad... | true |
Other | chartjs | Chart.js | 5aaff3a1aa38ad8f807d676d26dbac933c8f2d6e.json | Convert Tooltip to a plugin (#6990)
* Convert Tooltip to a plugin
* code review feedback
* Update docs. Convert positioners map to be on the plugin directly | src/core/core.controller.js | @@ -9,7 +9,6 @@ import layouts from './core.layouts';
import platform from '../platforms/platform';
import plugins from './core.plugins';
import scaleService from '../core/core.scaleService';
-import Tooltip from './core.tooltip';
const valueOrDefault = helpers.valueOrDefault;
@@ -117,8 +116,6 @@ function updat... | true |
Other | chartjs | Chart.js | 5aaff3a1aa38ad8f807d676d26dbac933c8f2d6e.json | Convert Tooltip to a plugin (#6990)
* Convert Tooltip to a plugin
* code review feedback
* Update docs. Convert positioners map to be on the plugin directly | src/core/core.plugins.js | @@ -200,6 +200,13 @@ export default {
* @param {Chart.Controller} chart - The chart instance.
* @param {object} options - The plugin options.
*/
+/**
+ * @method IPlugin#reset
+ * @desc Called during chart reset
+ * @param {Chart.Controller} chart - The chart instance.
+ * @param {object} options - The plugin opt... | true |
Other | chartjs | Chart.js | 5aaff3a1aa38ad8f807d676d26dbac933c8f2d6e.json | Convert Tooltip to a plugin (#6990)
* Convert Tooltip to a plugin
* code review feedback
* Update docs. Convert positioners map to be on the plugin directly | src/index.js | @@ -20,7 +20,6 @@ import pluginsCore from './core/core.plugins';
import Scale from './core/core.scale';
import scaleService from './core/core.scaleService';
import Ticks from './core/core.ticks';
-import Tooltip from './core/core.tooltip';
Chart.helpers = helpers;
Chart._adapters = _adapters;
@@ -39,7 +38,6 @@ C... | true |
Other | chartjs | Chart.js | 5aaff3a1aa38ad8f807d676d26dbac933c8f2d6e.json | Convert Tooltip to a plugin (#6990)
* Convert Tooltip to a plugin
* code review feedback
* Update docs. Convert positioners map to be on the plugin directly | src/plugins/index.js | @@ -3,9 +3,11 @@
import filler from './plugin.filler';
import legend from './plugin.legend';
import title from './plugin.title';
+import tooltip from './plugin.tooltip';
export default {
filler,
legend,
- title
+ title,
+ tooltip
}; | true |
Other | chartjs | Chart.js | 5aaff3a1aa38ad8f807d676d26dbac933c8f2d6e.json | Convert Tooltip to a plugin (#6990)
* Convert Tooltip to a plugin
* code review feedback
* Update docs. Convert positioners map to be on the plugin directly | src/plugins/plugin.tooltip.js | @@ -1,9 +1,10 @@
'use strict';
-import defaults from './core.defaults';
-import Element from './core.element';
+import Animations from '../core/core.animations';
+import defaults from '../core/core.defaults';
+import Element from '../core/core.element';
+import plugins from '../core/core.plugins';
import helpers fr... | true |
Other | chartjs | Chart.js | 5aaff3a1aa38ad8f807d676d26dbac933c8f2d6e.json | Convert Tooltip to a plugin (#6990)
* Convert Tooltip to a plugin
* code review feedback
* Update docs. Convert positioners map to be on the plugin directly | test/specs/global.namespace.tests.js | @@ -16,8 +16,6 @@ describe('Chart namespace', function() {
expect(Chart.Scale instanceof Object).toBeTruthy();
expect(Chart.scaleService instanceof Object).toBeTruthy();
expect(Chart.Ticks instanceof Object).toBeTruthy();
- expect(Chart.Tooltip instanceof Object).toBeTruthy();
- expect(Chart.Tooltip.pos... | true |
Other | chartjs | Chart.js | 5aaff3a1aa38ad8f807d676d26dbac933c8f2d6e.json | Convert Tooltip to a plugin (#6990)
* Convert Tooltip to a plugin
* code review feedback
* Update docs. Convert positioners map to be on the plugin directly | test/specs/plugin.tooltip.tests.js | @@ -1,4 +1,7 @@
// Test the rectangle element
+const tooltipPlugin = Chart.plugins.getAll().find(p => p.id === 'tooltip');
+const Tooltip = tooltipPlugin._element;
+
describe('Core.Tooltip', function() {
describe('auto', jasmine.fixture.specs('core.tooltip'));
@@ -890,11 +893,11 @@ describe('Core.Tooltip', functi... | true |
Other | chartjs | Chart.js | fac507819f7ab4838f1d8b423d803232be93987d.json | Use import statements in test code (#6977) | src/adapters/adapter.moment.js | @@ -2,10 +2,10 @@
'use strict';
-var moment = require('moment');
-var adapters = require('../core/core.adapters');
+import moment from 'moment';
+import adapters from '../core/core.adapters';
-var FORMATS = {
+const FORMATS = {
datetime: 'MMM D, YYYY, h:mm:ss a',
millisecond: 'h:mm:ss.SSS a',
second: 'h:mm... | true |
Other | chartjs | Chart.js | fac507819f7ab4838f1d8b423d803232be93987d.json | Use import statements in test code (#6977) | src/adapters/index.js | @@ -7,4 +7,4 @@
// Built-in moment adapter that we need to keep for backward compatibility
// https://github.com/chartjs/Chart.js/issues/5542
-require('./adapter.moment');
+import './adapter.moment'; | true |
Other | chartjs | Chart.js | fac507819f7ab4838f1d8b423d803232be93987d.json | Use import statements in test code (#6977) | src/core/core.adapters.js | @@ -6,7 +6,7 @@
'use strict';
-var helpers = require('../helpers/index');
+import helpers from '../helpers';
function abstract() {
throw new Error(
@@ -105,4 +105,6 @@ DateAdapter.override = function(members) {
helpers.extend(DateAdapter.prototype, members);
};
-module.exports._date = DateAdapter;
+expor... | true |
Other | chartjs | Chart.js | fac507819f7ab4838f1d8b423d803232be93987d.json | Use import statements in test code (#6977) | test/fixture.js | @@ -2,7 +2,7 @@
'use strict';
-var utils = require('./utils');
+import utils from './utils';
function readFile(url, callback) {
var request = new XMLHttpRequest();
@@ -79,7 +79,6 @@ function specsFromFixtures(path) {
};
}
-module.exports = {
+export default {
specs: specsFromFixtures
};
- | true |
Other | chartjs | Chart.js | fac507819f7ab4838f1d8b423d803232be93987d.json | Use import statements in test code (#6977) | test/index.js | @@ -1,9 +1,9 @@
'use strict';
-var fixture = require('./fixture');
-var Context = require('./context');
-var matchers = require('./matchers');
-var utils = require('./utils');
+import fixture from './fixture';
+import Context from './context';
+import matchers from './matchers';
+import utils from './utils';
(fun... | true |
Other | chartjs | Chart.js | fac507819f7ab4838f1d8b423d803232be93987d.json | Use import statements in test code (#6977) | test/matchers.js | @@ -1,7 +1,7 @@
'use strict';
-var pixelmatch = require('pixelmatch');
-var utils = require('./utils');
+import pixelmatch from 'pixelmatch';
+import utils from './utils';
function toPercent(value) {
return Math.round(value * 10000) / 100;
@@ -196,7 +196,7 @@ function toEqualImageData() {
};
}
-module.expo... | true |
Other | chartjs | Chart.js | 2e880ed99d65435837cb71611a8565604e5b6d15.json | Rebuild legend after datasets are updated (#6969) | src/plugins/plugin.legend.js | @@ -688,7 +688,7 @@ export default {
}
},
- beforeUpdate: function(chart) {
+ afterUpdate: function(chart) {
var legendOpts = chart.options.legend;
var legend = chart.legend;
@@ -698,6 +698,7 @@ export default {
if (legend) {
layouts.configure(chart, legend, legendOpts);
legend.options = le... | false |
Other | chartjs | Chart.js | 02279b38fcf561224cca02f8eb5fc3131081f48a.json | Fix reference to distanceBetweenPoints (#6962) | src/core/core.tooltip.js | @@ -159,7 +159,7 @@ var positioners = {
var el = elements[i].element;
if (el && el.hasValue()) {
var center = el.getCenterPoint();
- var d = helpers.distanceBetweenPoints(eventPosition, center);
+ var d = helpers.math.distanceBetweenPoints(eventPosition, center);
if (d < minDistance) {
m... | false |
Other | chartjs | Chart.js | a1c2dd6fb64ba128db95ac4ea2c46a064959bb47.json | Throttle all events (to 1 / frame each) (#6953)
* Throttle all events
* Asynchronize event tests | src/platforms/platform.dom.js | @@ -422,9 +422,9 @@ export default {
var expando = listener[EXPANDO_KEY] || (listener[EXPANDO_KEY] = {});
var proxies = expando.proxies || (expando.proxies = {});
- var proxy = proxies[chart.id + '_' + type] = function(event) {
+ var proxy = proxies[chart.id + '_' + type] = throttled(function(event) {
lis... | true |
Other | chartjs | Chart.js | a1c2dd6fb64ba128db95ac4ea2c46a064959bb47.json | Throttle all events (to 1 / frame each) (#6953)
* Throttle all events
* Asynchronize event tests | test/.eslintrc.yml | @@ -7,6 +7,7 @@ env:
globals:
acquireChart: true
+ afterEvent: true
Chart: true
moment: true
waitForResize: true | true |
Other | chartjs | Chart.js | a1c2dd6fb64ba128db95ac4ea2c46a064959bb47.json | Throttle all events (to 1 / frame each) (#6953)
* Throttle all events
* Asynchronize event tests | test/index.js | @@ -30,6 +30,7 @@ var utils = require('./utils');
window.devicePixelRatio = 1;
window.acquireChart = acquireChart;
+ window.afterEvent = utils.afterEvent;
window.releaseChart = releaseChart;
window.waitForResize = utils.waitForResize;
window.createMockContext = createMockContext; | true |
Other | chartjs | Chart.js | a1c2dd6fb64ba128db95ac4ea2c46a064959bb47.json | Throttle all events (to 1 / frame each) (#6953)
* Throttle all events
* Asynchronize event tests | test/specs/controller.bubble.tests.js | @@ -288,24 +288,30 @@ describe('Chart.controllers.bubble', function() {
});
});
- it ('should handle default hover styles', function() {
+ it ('should handle default hover styles', function(done) {
var chart = this.chart;
var point = chart.getDatasetMeta(0).data[0];
+ afterEvent(chart, 'mousemove... | true |
Other | chartjs | Chart.js | a1c2dd6fb64ba128db95ac4ea2c46a064959bb47.json | Throttle all events (to 1 / frame each) (#6953)
* Throttle all events
* Asynchronize event tests | test/specs/controller.doughnut.tests.js | @@ -347,22 +347,28 @@ describe('Chart.controllers.doughnut', function() {
});
});
- it ('should handle default hover styles', function() {
+ it ('should handle default hover styles', function(done) {
var chart = this.chart;
var arc = chart.getDatasetMeta(0).data[0];
+ afterEvent(chart, 'mousemove... | true |
Other | chartjs | Chart.js | a1c2dd6fb64ba128db95ac4ea2c46a064959bb47.json | Throttle all events (to 1 / frame each) (#6953)
* Throttle all events
* Asynchronize event tests | test/specs/controller.line.tests.js | @@ -790,24 +790,31 @@ describe('Chart.controllers.line', function() {
});
});
- it ('should handle default hover styles', function() {
+ it ('should handle default hover styles', function(done) {
var chart = this.chart;
var point = chart.getDatasetMeta(0).data[0];
- jasmine.triggerMouseEvent(char... | true |
Other | chartjs | Chart.js | a1c2dd6fb64ba128db95ac4ea2c46a064959bb47.json | Throttle all events (to 1 / frame each) (#6953)
* Throttle all events
* Asynchronize event tests | test/specs/controller.polarArea.tests.js | @@ -260,22 +260,28 @@ describe('Chart.controllers.polarArea', function() {
});
});
- it ('should handle default hover styles', function() {
+ it ('should handle default hover styles', function(done) {
var chart = this.chart;
var arc = chart.getDatasetMeta(0).data[0];
+ afterEvent(chart, 'mousemov... | true |
Other | chartjs | Chart.js | a1c2dd6fb64ba128db95ac4ea2c46a064959bb47.json | Throttle all events (to 1 / frame each) (#6953)
* Throttle all events
* Asynchronize event tests | test/specs/controller.radar.tests.js | @@ -252,24 +252,30 @@ describe('Chart.controllers.radar', function() {
});
});
- it ('should handle default hover styles', function() {
+ it ('should handle default hover styles', function(done) {
var chart = this.chart;
var point = chart.getDatasetMeta(0).data[0];
+ afterEvent(chart, 'mousemove'... | true |
Other | chartjs | Chart.js | a1c2dd6fb64ba128db95ac4ea2c46a064959bb47.json | Throttle all events (to 1 / frame each) (#6953)
* Throttle all events
* Asynchronize event tests | test/specs/controller.scatter.tests.js | @@ -3,7 +3,7 @@ describe('Chart.controllers.scatter', function() {
expect(typeof Chart.controllers.scatter).toBe('function');
});
- it('should test default tooltip callbacks', function() {
+ it('should test default tooltip callbacks', function(done) {
var chart = window.acquireChart({
type: 'scatter',
... | true |
Other | chartjs | Chart.js | a1c2dd6fb64ba128db95ac4ea2c46a064959bb47.json | Throttle all events (to 1 / frame each) (#6953)
* Throttle all events
* Asynchronize event tests | test/specs/core.controller.tests.js | @@ -1104,7 +1104,7 @@ describe('Chart', function() {
expect(chart.tooltip.options).toEqual(jasmine.objectContaining(newTooltipConfig));
});
- it ('should update the tooltip on update', function() {
+ it ('should update the tooltip on update', function(done) {
var chart = acquireChart({
type: 'line',... | true |
Other | chartjs | Chart.js | a1c2dd6fb64ba128db95ac4ea2c46a064959bb47.json | Throttle all events (to 1 / frame each) (#6953)
* Throttle all events
* Asynchronize event tests | test/specs/core.tooltip.tests.js | @@ -29,7 +29,7 @@ describe('Core.Tooltip', function() {
});
describe('index mode', function() {
- it('Should only use x distance when intersect is false', function() {
+ it('Should only use x distance when intersect is false', function(done) {
var chart = window.acquireChart({
type: 'line',
data: ... | true |
Other | chartjs | Chart.js | a1c2dd6fb64ba128db95ac4ea2c46a064959bb47.json | Throttle all events (to 1 / frame each) (#6953)
* Throttle all events
* Asynchronize event tests | test/specs/platform.dom.tests.js | @@ -356,7 +356,7 @@ describe('Platform.dom', function() {
});
describe('event handling', function() {
- it('should notify plugins about events', function() {
+ it('should notify plugins about events', function(done) {
var notifiedEvent;
var plugin = {
afterEvent: function(chart, e) {
@@ -377,32 +37... | true |
Other | chartjs | Chart.js | a1c2dd6fb64ba128db95ac4ea2c46a064959bb47.json | Throttle all events (to 1 / frame each) (#6953)
* Throttle all events
* Asynchronize event tests | test/specs/plugin.legend.tests.js | @@ -602,7 +602,7 @@ describe('Legend block tests', function() {
});
describe('callbacks', function() {
- it('should call onClick, onHover and onLeave at the correct times', function() {
+ it('should call onClick, onHover and onLeave at the correct times', function(done) {
var clickItem = null;
var hover... | true |
Other | chartjs | Chart.js | a1c2dd6fb64ba128db95ac4ea2c46a064959bb47.json | Throttle all events (to 1 / frame each) (#6953)
* Throttle all events
* Asynchronize event tests | test/utils.js | @@ -106,6 +106,18 @@ function waitForResize(chart, callback) {
};
}
+function afterEvent(chart, type, callback) {
+ var override = chart.eventHandler;
+ chart.eventHandler = function(event) {
+ override.call(this, event);
+ if (event.type === type) {
+ chart.eventHandler = override;
+ // eslint-disable-next-... | true |
Other | chartjs | Chart.js | 9bd2af9e9b7bd2ad586fb17d7a47f72e055c0144.json | Move location of dataset options (#6955)
* Move location of dataset options
* Fix misplaced period | docs/configuration/README.md | @@ -37,8 +37,8 @@ var chartDifferentHoverMode = new Chart(ctx, {
Options may be configured directly on the dataset. The dataset options can be changed at 3 different levels and are evaluated with the following priority:
- per dataset: dataset.*
-- per chart: options.datasets[type].*
-- or globally: Chart.defaults.d... | true |
Other | chartjs | Chart.js | 9bd2af9e9b7bd2ad586fb17d7a47f72e055c0144.json | Move location of dataset options (#6955)
* Move location of dataset options
* Fix misplaced period | docs/developers/charts.md | @@ -81,10 +81,6 @@ For example, to derive a new chart type that extends from a bubble chart, you wo
// It looks like a bug exists when the defaults don't exist
Chart.defaults.derivedBubble = Chart.defaults.bubble;
-// Sets the default dataset config for 'derivedBubble' to be the same as the bubble dataset defaults.... | true |
Other | chartjs | Chart.js | 9bd2af9e9b7bd2ad586fb17d7a47f72e055c0144.json | Move location of dataset options (#6955)
* Move location of dataset options
* Fix misplaced period | docs/getting-started/v3-migration.md | @@ -45,6 +45,7 @@ Chart.js 3.0 introduces a number of breaking changes. Chart.js 2.0 was released
### Options
+* Dataset options are now configured as `options[type].datasets` rather than `options.datasets[type]`
* `Polar area` `startAngle` option is now consistent with `Radar`, 0 is at top and value is in degree... | true |
Other | chartjs | Chart.js | 9bd2af9e9b7bd2ad586fb17d7a47f72e055c0144.json | Move location of dataset options (#6955)
* Move location of dataset options
* Fix misplaced period | src/controllers/controller.bar.js | @@ -12,6 +12,17 @@ defaults._set('bar', {
mode: 'index'
},
+ datasets: {
+ categoryPercentage: 0.8,
+ barPercentage: 0.9,
+ animation: {
+ numbers: {
+ type: 'number',
+ properties: ['x', 'y', 'base', 'width', 'height']
+ }
+ }
+ },
+
scales: {
x: {
type: 'category',
@@ -27,19 +38,6 @@ def... | true |
Other | chartjs | Chart.js | 9bd2af9e9b7bd2ad586fb17d7a47f72e055c0144.json | Move location of dataset options (#6955)
* Move location of dataset options
* Fix misplaced period | src/controllers/controller.horizontalBar.js | @@ -25,6 +25,11 @@ defaults._set('horizontalBar', {
}
},
+ datasets: {
+ categoryPercentage: 0.8,
+ barPercentage: 0.9
+ },
+
elements: {
rectangle: {
borderSkipped: 'left'
@@ -37,13 +42,6 @@ defaults._set('horizontalBar', {
}
});
-defaults._set('datasets', {
- horizontalBar: {
- categoryPercent... | true |
Other | chartjs | Chart.js | 9bd2af9e9b7bd2ad586fb17d7a47f72e055c0144.json | Move location of dataset options (#6955)
* Move location of dataset options
* Fix misplaced period | src/controllers/controller.scatter.js | @@ -15,6 +15,10 @@ defaults._set('scatter', {
}
},
+ datasets: {
+ showLine: false
+ },
+
tooltips: {
callbacks: {
title: function() {
@@ -27,11 +31,5 @@ defaults._set('scatter', {
}
});
-defaults._set('datasets', {
- scatter: {
- showLine: false
- }
-});
-
// Scatter charts use line controllers... | true |
Other | chartjs | Chart.js | 9bd2af9e9b7bd2ad586fb17d7a47f72e055c0144.json | Move location of dataset options (#6955)
* Move location of dataset options
* Fix misplaced period | src/core/core.datasetController.js | @@ -476,7 +476,7 @@ helpers.extend(DatasetController.prototype, {
_configure: function() {
const me = this;
me._config = helpers.merge({}, [
- me.chart.options.datasets[me._type],
+ me.chart.options[me._type].datasets,
me.getDataset(),
], {
merger: function(key, target, source) { | true |
Other | chartjs | Chart.js | 9bd2af9e9b7bd2ad586fb17d7a47f72e055c0144.json | Move location of dataset options (#6955)
* Move location of dataset options
* Fix misplaced period | test/fixtures/controller.bar/bar-thickness-multiple.json | @@ -18,8 +18,8 @@
"responsive": false,
"legend": false,
"title": false,
- "datasets": {
- "bar": {
+ "bar": {
+ "datasets": {
"barPercentage": 1,
"categoryPercentage": 1
... | true |
Other | chartjs | Chart.js | 9bd2af9e9b7bd2ad586fb17d7a47f72e055c0144.json | Move location of dataset options (#6955)
* Move location of dataset options
* Fix misplaced period | test/fixtures/controller.bar/bar-thickness-no-overlap.json | @@ -18,8 +18,8 @@
"responsive": false,
"legend": false,
"title": false,
- "datasets": {
- "bar": {
+ "bar": {
+ "datasets": {
"barPercentage": 1,
"categoryPercentage": 1
... | true |
Other | chartjs | Chart.js | 9bd2af9e9b7bd2ad586fb17d7a47f72e055c0144.json | Move location of dataset options (#6955)
* Move location of dataset options
* Fix misplaced period | test/fixtures/controller.bar/bar-thickness-offset.json | @@ -18,8 +18,8 @@
"responsive": false,
"legend": false,
"title": false,
- "datasets": {
- "bar": {
+ "bar": {
+ "datasets": {
"barPercentage": 1,
"categoryPercentage": 1
... | true |
Other | chartjs | Chart.js | 9bd2af9e9b7bd2ad586fb17d7a47f72e055c0144.json | Move location of dataset options (#6955)
* Move location of dataset options
* Fix misplaced period | test/fixtures/controller.bar/bar-thickness-reverse.json | @@ -18,8 +18,8 @@
"responsive": false,
"legend": false,
"title": false,
- "datasets": {
- "bar": {
+ "bar": {
+ "datasets": {
"barPercentage": 1,
"categoryPercentage": 1
... | true |
Other | chartjs | Chart.js | 9bd2af9e9b7bd2ad586fb17d7a47f72e055c0144.json | Move location of dataset options (#6955)
* Move location of dataset options
* Fix misplaced period | test/fixtures/controller.bar/bar-thickness-stacked.json | @@ -18,8 +18,8 @@
"responsive": false,
"legend": false,
"title": false,
- "datasets": {
- "bar": {
+ "bar": {
+ "datasets": {
"barPercentage": 1,
"categoryPercentage": 1
... | true |
Other | chartjs | Chart.js | 9bd2af9e9b7bd2ad586fb17d7a47f72e055c0144.json | Move location of dataset options (#6955)
* Move location of dataset options
* Fix misplaced period | test/fixtures/controller.bar/stacking/logarithmic-strings.js | @@ -14,8 +14,8 @@ module.exports = {
options: {
legend: false,
title: false,
- datasets: {
- bar: {
+ bar: {
+ datasets: {
barPercentage: 1,
}
}, | true |
Other | chartjs | Chart.js | 9bd2af9e9b7bd2ad586fb17d7a47f72e055c0144.json | Move location of dataset options (#6955)
* Move location of dataset options
* Fix misplaced period | test/fixtures/controller.bar/stacking/logarithmic.js | @@ -14,8 +14,8 @@ module.exports = {
options: {
legend: false,
title: false,
- datasets: {
- bar: {
+ bar: {
+ datasets: {
barPercentage: 1,
}
}, | true |
Other | chartjs | Chart.js | 9bd2af9e9b7bd2ad586fb17d7a47f72e055c0144.json | Move location of dataset options (#6955)
* Move location of dataset options
* Fix misplaced period | test/fixtures/plugin.filler/fill-line-dataset-interpolated.js | @@ -41,8 +41,8 @@ module.exports = {
responsive: false,
legend: false,
title: false,
- datasets: {
- line: {
+ line: {
+ datasets: {
lineTension: 0.4,
borderWidth: 1,
pointRadius: 1.5, | true |
Other | chartjs | Chart.js | 9bd2af9e9b7bd2ad586fb17d7a47f72e055c0144.json | Move location of dataset options (#6955)
* Move location of dataset options
* Fix misplaced period | test/specs/controller.bar.tests.js | @@ -1387,7 +1387,7 @@ describe('Chart.controllers.bar', function() {
var chart = window.acquireChart(this.config);
var meta = chart.getDatasetMeta(0);
var xScale = chart.scales[meta.xAxisID];
- var options = Chart.defaults.datasets.bar;
+ var options = Chart.defaults.bar.datasets;
var categoryPerc... | true |
Other | chartjs | Chart.js | 9bd2af9e9b7bd2ad586fb17d7a47f72e055c0144.json | Move location of dataset options (#6955)
* Move location of dataset options
* Fix misplaced period | test/specs/controller.line.tests.js | @@ -559,18 +559,18 @@ describe('Chart.controllers.line', function() {
describe('dataset global defaults', function() {
beforeEach(function() {
- this._defaults = Chart.helpers.clone(Chart.defaults.datasets.line);
+ this._defaults = Chart.helpers.clone(Chart.defaults.line.datasets);
});
afterEach(func... | true |
Other | chartjs | Chart.js | 5e6fb37646d7d04465c3cd094f724228e2078639.json | Detect stack change (#6947)
* Detect stack change
* Add test | src/core/core.datasetController.js | @@ -443,13 +443,30 @@ helpers.extend(DatasetController.prototype, {
const labelsChanged = me._labelCheck();
const scaleChanged = me._scaleCheck();
const meta = me._cachedMeta;
+ const dataset = me.getDataset();
+ let stackChanged = false;
// make sure cached _stacked status is current
meta._stacked =... | true |
Other | chartjs | Chart.js | 5e6fb37646d7d04465c3cd094f724228e2078639.json | Detect stack change (#6947)
* Detect stack change
* Add test | test/specs/core.datasetController.tests.js | @@ -388,6 +388,50 @@ describe('Chart.DatasetController', function() {
expect(meta.yAxisID).toBe('secondYScaleID');
});
+ it('should re-synchronize stacks when stack is changed', function() {
+ var chart = acquireChart({
+ type: 'bar',
+ data: {
+ labels: ['a', 'b'],
+ datasets: [{
+ data: [1, 10],... | true |
Other | chartjs | Chart.js | f1677b6652328f449c1995f3e551c1b666eb2c8f.json | Limit interactions to chartArea (+/-0.5px) (#6943)
Limit interactions to chartArea (+/-0.5px) | docs/getting-started/v3-migration.md | @@ -19,6 +19,7 @@ Chart.js 3.0 introduces a number of breaking changes. Chart.js 2.0 was released
### Interactions
+* `interactions` are now limited to the chart area
* `{mode: 'label'}` was replaced with `{mode: 'index'}`
* `{mode: 'single'}` was replaced with `{mode: 'nearest', intersect: true}`
* `modes['X-a... | true |
Other | chartjs | Chart.js | f1677b6652328f449c1995f3e551c1b666eb2c8f.json | Limit interactions to chartArea (+/-0.5px) (#6943)
Limit interactions to chartArea (+/-0.5px) | src/controllers/controller.horizontalBar.js | @@ -12,7 +12,8 @@ defaults._set('horizontalBar', {
scales: {
x: {
type: 'linear',
- position: 'bottom'
+ position: 'bottom',
+ beginAtZero: true
},
y: {
type: 'category', | true |
Other | chartjs | Chart.js | f1677b6652328f449c1995f3e551c1b666eb2c8f.json | Limit interactions to chartArea (+/-0.5px) (#6943)
Limit interactions to chartArea (+/-0.5px) | src/core/core.interaction.js | @@ -2,6 +2,7 @@
import helpers from '../helpers/index';
import {isNumber} from '../helpers/helpers.math';
+import {_isPointInArea} from '../helpers/helpers.canvas';
/**
* Helper function to get relative position for an event
@@ -43,6 +44,8 @@ function evaluateAllVisibleItems(chart, handler) {
/**
* Helper f... | true |
Other | chartjs | Chart.js | f1677b6652328f449c1995f3e551c1b666eb2c8f.json | Limit interactions to chartArea (+/-0.5px) (#6943)
Limit interactions to chartArea (+/-0.5px) | src/core/core.tooltip.js | @@ -219,10 +219,10 @@ function createTooltipItem(chart, item) {
const {label, value} = chart.getDatasetMeta(datasetIndex).controller._getLabelAndValue(index);
return {
- label: label,
- value: value,
- index: index,
- datasetIndex: datasetIndex
+ label,
+ value,
+ index,
+ datasetIndex
};
}
@@ -452,7... | true |
Other | chartjs | Chart.js | f1677b6652328f449c1995f3e551c1b666eb2c8f.json | Limit interactions to chartArea (+/-0.5px) (#6943)
Limit interactions to chartArea (+/-0.5px) | src/helpers/helpers.canvas.js | @@ -153,7 +153,7 @@ export function drawPoint(ctx, style, radius, x, y, rotation) {
* @private
*/
export function _isPointInArea(point, area) {
- var epsilon = 1e-6; // 1e-6 is margin in pixels for accumulated error.
+ const epsilon = 0.5; // margin - to match rounded decimals
return point.x > area.left - epsi... | true |
Other | chartjs | Chart.js | f1677b6652328f449c1995f3e551c1b666eb2c8f.json | Limit interactions to chartArea (+/-0.5px) (#6943)
Limit interactions to chartArea (+/-0.5px) | test/specs/controller.line.tests.js | @@ -773,6 +773,11 @@ describe('Chart.controllers.line', function() {
}]
},
options: {
+ scales: {
+ x: {
+ offset: true
+ }
+ },
elements: {
point: {
backgroundColor: 'rgb(100, 150, 200)', | true |
Other | chartjs | Chart.js | f1677b6652328f449c1995f3e551c1b666eb2c8f.json | Limit interactions to chartArea (+/-0.5px) (#6943)
Limit interactions to chartArea (+/-0.5px) | test/specs/core.controller.tests.js | @@ -1130,12 +1130,12 @@ describe('Chart', function() {
var tooltip = chart.tooltip;
expect(chart.lastActive[0].element).toEqual(point);
- expect(tooltip._lastActive[0].element).toEqual(point);
+ expect(tooltip._active[0].element).toEqual(point);
// Update and confirm tooltip is updated
chart.upd... | true |
Other | chartjs | Chart.js | f1677b6652328f449c1995f3e551c1b666eb2c8f.json | Limit interactions to chartArea (+/-0.5px) (#6943)
Limit interactions to chartArea (+/-0.5px) | test/specs/core.interaction.tests.js | @@ -143,8 +143,8 @@ describe('Core.Interaction', function() {
type: 'click',
chart: chart,
native: true, // needed otherwise things its a DOM event
- x: 0,
- y: 0
+ x: chart.chartArea.left,
+ y: chart.chartArea.top
};
var elements = Chart.Interaction.modes.index(chart, evt,... | true |
Other | chartjs | Chart.js | f1677b6652328f449c1995f3e551c1b666eb2c8f.json | Limit interactions to chartArea (+/-0.5px) (#6943)
Limit interactions to chartArea (+/-0.5px) | test/specs/core.tooltip.tests.js | @@ -70,7 +70,7 @@ describe('Core.Tooltip', function() {
bubbles: true,
cancelable: true,
clientX: rect.left + point.x,
- clientY: 0
+ clientY: rect.top + chart.chartArea.top + 5 // +5 to make tests work consistently
});
// Manually trigger rather than having an async test | true |
Other | chartjs | Chart.js | f1677b6652328f449c1995f3e551c1b666eb2c8f.json | Limit interactions to chartArea (+/-0.5px) (#6943)
Limit interactions to chartArea (+/-0.5px) | test/specs/helpers.canvas.tests.js | @@ -32,8 +32,8 @@ describe('Chart.helpers.canvas', function() {
expect(isPointInArea({x: -1e-12, y: -1e-12}, area)).toBe(true);
expect(isPointInArea({x: 512, y: 256}, area)).toBe(true);
expect(isPointInArea({x: 512 + 1e-12, y: 256 + 1e-12}, area)).toBe(true);
- expect(isPointInArea({x: -1e-3, y: 0}, area)... | true |
Other | chartjs | Chart.js | a6a12282c49e006d3a6fc06297f39b84fe409deb.json | Fix memory leak on destroy (#8438) | src/core/core.config.js | @@ -156,9 +156,13 @@ export default class Config {
update(options) {
const config = this._config;
+ this.clearCache();
+ config.options = initOptions(config, options);
+ }
+
+ clearCache() {
this._scopeCache.clear();
this._resolverCache.clear();
- config.options = initOptions(config, opti... | true |
Other | chartjs | Chart.js | a6a12282c49e006d3a6fc06297f39b84fe409deb.json | Fix memory leak on destroy (#8438) | src/core/core.controller.js | @@ -831,6 +831,8 @@ class Chart {
me._destroyDatasetMeta(i);
}
+ me.config.clearCache();
+
if (canvas) {
me.unbindEvents();
clearCanvas(canvas, ctx); | true |
Other | chartjs | Chart.js | 81e28c9895ad685b2b567a5de4b70ea591d275ae.json | Add a note about hover options (#8436) | docs/docs/general/interactions/index.md | @@ -9,3 +9,5 @@ The interaction configuration is passed into the `options.interaction` namespace
| `mode` | `string` | `'nearest'` | Sets which elements appear in the tooltip. See [Interaction Modes](./modes.md#interaction-modes) for details.
| `intersect` | `boolean` | `true` | if true, the hover mode only applies w... | false |
Other | chartjs | Chart.js | 19a91bebfbed1ed5c57ccda02563147512350569.json | Remove unused typedoc option that is deprecated (#8433)
* Remove unused typedoc option that is deprecated
* Improved filtering for top level file changes | .github/workflows/ci.yml | @@ -34,13 +34,19 @@ jobs:
filters: |
docs:
- 'docs/**'
+ - 'package.json'
+ - 'tsconfig.json'
src:
- 'src/**'
+ - 'package.json'
test:
- 'test/**'
- 'karma.conf.js'
+ - 'package.json... | true |
Other | chartjs | Chart.js | 19a91bebfbed1ed5c57ccda02563147512350569.json | Remove unused typedoc option that is deprecated (#8433)
* Remove unused typedoc option that is deprecated
* Improved filtering for top level file changes | tsconfig.json | @@ -14,7 +14,6 @@
"name": "Chart.js",
"entryPoints": ["src/index.esm.js"],
"excludeExternals": true,
- "excludeNotExported": true,
"includeVersion": true,
"out": "./dist/docs/typedoc"
}, | true |
Other | chartjs | Chart.js | 505afa7f1323cf6e7975369eba30056977085eaa.json | Fix element creation for large dataset (#8388)
* Fix element creation for large dataset
* Fix syncing
* Remove duplication | src/core/core.datasetController.js | @@ -990,18 +990,25 @@ export default class DatasetController {
*/
_insertElements(start, count, resetNewElements = true) {
const me = this;
- const elements = new Array(count);
const meta = me._cachedMeta;
const data = meta.data;
+ const end = start + count;
let i;
- for (i = 0; i < count; ++i) {
... | true |
Other | chartjs | Chart.js | 505afa7f1323cf6e7975369eba30056977085eaa.json | Fix element creation for large dataset (#8388)
* Fix element creation for large dataset
* Fix syncing
* Remove duplication | test/specs/controller.line.tests.js | @@ -907,4 +907,30 @@ describe('Chart.controllers.line', function() {
expect(meta.data[2].options.borderWidth).toBe(3);
expect(meta.data[3].options.borderWidth).toBe(4);
});
+
+ it('should render a million points', function() {
+ var data = [];
+ for (let x = 0; x < 1e6; x++) {
+ data.push({x, y: Math.sin(x ... | true |
Other | chartjs | Chart.js | 650956b2e1ec8a9591135476cc61f64ddaad7f12.json | Create a new hook to enable data decimation (#8255)
* Create a new hook to enable data decimation
The `beforeElementUpdate` hook can be used to decimate data. The chart
elements will not be created until after this hook has fired ensuring that
if decimation occurs, only the needed elements will be created.
* A... | docs/docs/configuration/decimation.md | @@ -0,0 +1,33 @@
+---
+title: Data Decimation
+---
+
+The decimation plugin can be used with line charts to automatically decimate data at the start of the chart lifecycle. Before enabling this plugin, review the [requirements](#requirements) to ensure that it will work with the chart you want to create.
+
+## Configur... | true |
Other | chartjs | Chart.js | 650956b2e1ec8a9591135476cc61f64ddaad7f12.json | Create a new hook to enable data decimation (#8255)
* Create a new hook to enable data decimation
The `beforeElementUpdate` hook can be used to decimate data. The chart
elements will not be created until after this hook has fired ensuring that
if decimation occurs, only the needed elements will be created.
* A... | docs/docs/general/performance.md | @@ -18,7 +18,7 @@ Chart.js is fastest if you provide data with indices that are unique, sorted, an
Decimating your data will achieve the best results. When there is a lot of data to display on the graph, it doesn't make sense to show tens of thousands of data points on a graph that is only a few hundred pixels wide.... | true |
Other | chartjs | Chart.js | 650956b2e1ec8a9591135476cc61f64ddaad7f12.json | Create a new hook to enable data decimation (#8255)
* Create a new hook to enable data decimation
The `beforeElementUpdate` hook can be used to decimate data. The chart
elements will not be created until after this hook has fired ensuring that
if decimation occurs, only the needed elements will be created.
* A... | docs/sidebars.js | @@ -30,7 +30,8 @@ module.exports = {
'configuration/legend',
'configuration/title',
'configuration/tooltip',
- 'configuration/elements'
+ 'configuration/elements',
+ 'configuration/decimation'
],
'Chart Types': [
'charts/line', | true |
Other | chartjs | Chart.js | 650956b2e1ec8a9591135476cc61f64ddaad7f12.json | Create a new hook to enable data decimation (#8255)
* Create a new hook to enable data decimation
The `beforeElementUpdate` hook can be used to decimate data. The chart
elements will not be created until after this hook has fired ensuring that
if decimation occurs, only the needed elements will be created.
* A... | src/core/core.controller.js | @@ -466,9 +466,15 @@ class Chart {
// Make sure dataset controllers are updated and new controllers are reset
const newControllers = me.buildOrUpdateControllers();
+ me.notifyPlugins('beforeElementsUpdate');
+
// Make sure all dataset controllers have correct meta data counts
for (i = 0, ilen = me.data.d... | true |
Other | chartjs | Chart.js | 650956b2e1ec8a9591135476cc61f64ddaad7f12.json | Create a new hook to enable data decimation (#8255)
* Create a new hook to enable data decimation
The `beforeElementUpdate` hook can be used to decimate data. The chart
elements will not be created until after this hook has fired ensuring that
if decimation occurs, only the needed elements will be created.
* A... | src/core/core.datasetController.js | @@ -349,19 +349,12 @@ export default class DatasetController {
me._dataCheck();
- const data = me._data;
- const metaData = meta.data = new Array(data.length);
-
- for (let i = 0, ilen = data.length; i < ilen; ++i) {
- metaData[i] = new me.dataElementType();
- }
-
if (me.datasetElementType) {
meta.d... | true |
Other | chartjs | Chart.js | 650956b2e1ec8a9591135476cc61f64ddaad7f12.json | Create a new hook to enable data decimation (#8255)
* Create a new hook to enable data decimation
The `beforeElementUpdate` hook can be used to decimate data. The chart
elements will not be created until after this hook has fired ensuring that
if decimation occurs, only the needed elements will be created.
* A... | src/plugins/index.js | @@ -1,3 +1,4 @@
+export {default as Decimation} from './plugin.decimation';
export {default as Filler} from './plugin.filler';
export {default as Legend} from './plugin.legend';
export {default as Title} from './plugin.title'; | true |
Other | chartjs | Chart.js | 650956b2e1ec8a9591135476cc61f64ddaad7f12.json | Create a new hook to enable data decimation (#8255)
* Create a new hook to enable data decimation
The `beforeElementUpdate` hook can be used to decimate data. The chart
elements will not be created until after this hook has fired ensuring that
if decimation occurs, only the needed elements will be created.
* A... | src/plugins/plugin.decimation.js | @@ -0,0 +1,135 @@
+import {isNullOrUndef, resolve} from '../helpers';
+
+function minMaxDecimation(data, availableWidth) {
+ let i, point, x, y, prevX, minIndex, maxIndex, minY, maxY;
+ const decimated = [];
+
+ const xMin = data[0].x;
+ const xMax = data[data.length - 1].x;
+ const dx = xMax - xMin;
+
+ for (i = 0; i ... | true |
Other | chartjs | Chart.js | 650956b2e1ec8a9591135476cc61f64ddaad7f12.json | Create a new hook to enable data decimation (#8255)
* Create a new hook to enable data decimation
The `beforeElementUpdate` hook can be used to decimate data. The chart
elements will not be created until after this hook has fired ensuring that
if decimation occurs, only the needed elements will be created.
* A... | types/index.esm.d.ts | @@ -539,7 +539,7 @@ export class DatasetController<TElement extends Element = Element, TDatasetEleme
configure(): void;
initialize(): void;
addElements(): void;
- buildOrUpdateElements(): void;
+ buildOrUpdateElements(resetNewElements?: boolean): void;
getStyle(index: number, active: boolean): any;
protecte... | true |
Other | chartjs | Chart.js | ad84d285d841cefc8fef6a8e8e301bd5a68c010e.json | Rename LayoutItem.fullWidth to fullSize (#8358) | docs/docs/configuration/legend.md | @@ -15,7 +15,7 @@ The legend configuration is passed into the `options.plugins.legend` namespace.
| `align` | `string` | `'center'` | Alignment of the legend. [more...](#align)
| `maxHeight` | `number` | | Maximum height of the legend, in pixels
| `maxWidth` | `number` | | Maximum width of the legend, in pixels
-| `... | true |
Other | chartjs | Chart.js | ad84d285d841cefc8fef6a8e8e301bd5a68c010e.json | Rename LayoutItem.fullWidth to fullSize (#8358) | docs/docs/getting-started/v3-migration.md | @@ -402,6 +402,7 @@ The following properties were renamed during v3 development:
* `helpers.callCallback` was renamed to `helpers.callback`
* `helpers.drawRoundedRectangle` was renamed to `helpers.roundedRect`
* `helpers.getValueOrDefault` was renamed to `helpers.valueOrDefault`
+* `LayoutItem.fullWidth` was renamed... | true |
Other | chartjs | Chart.js | ad84d285d841cefc8fef6a8e8e301bd5a68c010e.json | Rename LayoutItem.fullWidth to fullSize (#8358) | src/core/core.controller.js | @@ -324,7 +324,7 @@ class Chart {
each(scales, (scale) => {
// Set LayoutItem parameters for backwards compatibility
- scale.fullWidth = scale.options.fullWidth;
+ scale.fullSize = scale.options.fullSize;
scale.position = scale.options.position;
scale.weight = scale.options.weight;
layouts.addB... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.