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 | 23bf7c0c89bd3e5ed4cbc2709a08eac63ad1c67d.json | Preserve scriptable context (#7981)
* Preserve scriptable context
* CC, utilize `index` in tests
* Update example to utilize context | test/fixtures/controller.radar/borderColor/scriptable.js | @@ -8,7 +8,7 @@ module.exports = {
// option in dataset
data: [0, 5, 10, null, -10, -5],
borderColor: function(ctx) {
- var index = (ctx.dataIndex === undefined ? ctx.datasetIndex : ctx.dataIndex);
+ var index = ctx.index;
return index === 0 ? '#ff0000'
: index === 1 ? '#00ff0... | true |
Other | chartjs | Chart.js | 23bf7c0c89bd3e5ed4cbc2709a08eac63ad1c67d.json | Preserve scriptable context (#7981)
* Preserve scriptable context
* CC, utilize `index` in tests
* Update example to utilize context | test/fixtures/controller.radar/borderWidth/scriptable.js | @@ -9,7 +9,7 @@ module.exports = {
data: [0, 5, 10, null, -10, -5],
borderColor: '#0000ff',
borderWidth: function(ctx) {
- var index = (ctx.dataIndex === undefined ? ctx.datasetIndex : ctx.dataIndex);
+ var index = ctx.index;
return index % 2 ? 10 : 20;
},
pointBorderColor... | true |
Other | chartjs | Chart.js | 72dc37581c13362ee7bee60610cf42ae9e0fad4d.json | Fix typo in test options (#7987) | test/specs/controller.bar.tests.js | @@ -1219,7 +1219,7 @@ describe('Chart.controllers.bar', function() {
},
options: {
elements: {
- bars: {
+ bar: {
backgroundColor: 'rgb(255, 0, 0)',
borderColor: 'rgb(0, 0, 255)',
borderWidth: 2, | false |
Other | chartjs | Chart.js | 4f2511aff345c3f0ce6afb8f2e87fe043f50117b.json | Relocate dataset defaults to defaults.controllers (#7979) | docs/docs/charts/bar.mdx | @@ -79,7 +79,7 @@ the color of the bars is generally set this way.
| Name | Type | [Scriptable](../general/options.md#scriptable-options) | [Indexable](../general/options.md#indexable-options) | Default
| ---- | ---- | :----: | :----: | ----
| [`backgroundColor`](#styling) | [`Color`](../general/colors.md) | Yes | Y... | true |
Other | chartjs | Chart.js | 4f2511aff345c3f0ce6afb8f2e87fe043f50117b.json | Relocate dataset defaults to defaults.controllers (#7979) | docs/docs/charts/doughnut.mdx | @@ -169,7 +169,7 @@ These are the customisation options specific to Pie & Doughnut charts. These opt
## Default Options
-We can also change these default values for each Doughnut type that is created, this object is available at `Chart.defaults.doughnut`. Pie charts also have a clone of these defaults available to... | true |
Other | chartjs | Chart.js | 4f2511aff345c3f0ce6afb8f2e87fe043f50117b.json | Relocate dataset defaults to defaults.controllers (#7979) | docs/docs/charts/line.mdx | @@ -184,12 +184,12 @@ The line chart defines the following configuration options. These options are me
## Default Options
-It is common to want to apply a configuration setting to all created line charts. The global line chart settings are stored in `Chart.defaults.line`. Changing the global options only affects c... | true |
Other | chartjs | Chart.js | 4f2511aff345c3f0ce6afb8f2e87fe043f50117b.json | Relocate dataset defaults to defaults.controllers (#7979) | docs/docs/charts/polar.mdx | @@ -119,12 +119,12 @@ The polar area chart uses the [radialLinear](../axes/radial/linear.md) scale. Ad
## Default Options
-We can also change these default values for each PolarArea type that is created, this object is available at `Chart.defaults.polarArea`. Changing the global options only affects charts created... | true |
Other | chartjs | Chart.js | 4f2511aff345c3f0ce6afb8f2e87fe043f50117b.json | Relocate dataset defaults to defaults.controllers (#7979) | docs/docs/charts/radar.mdx | @@ -191,7 +191,7 @@ options = {
## Default Options
-It is common to want to apply a configuration setting to all created radar charts. The global radar chart settings are stored in `Chart.defaults.radar`. Changing the global options only affects charts created after the change. Existing charts are not changed.
+It... | true |
Other | chartjs | Chart.js | 4f2511aff345c3f0ce6afb8f2e87fe043f50117b.json | Relocate dataset defaults to defaults.controllers (#7979) | docs/docs/configuration/index.md | @@ -40,7 +40,7 @@ Options may be configured directly on the dataset. The dataset options can be ch
- per dataset: dataset.*
- per chart: options[type].datasets.*
-- or globally: Chart.defaults[type].datasets.*
+- or globally: Chart.defaults.controllers[type].datasets.*
where type corresponds to the dataset type.... | true |
Other | chartjs | Chart.js | 4f2511aff345c3f0ce6afb8f2e87fe043f50117b.json | Relocate dataset defaults to defaults.controllers (#7979) | docs/docs/getting-started/v3-migration.md | @@ -100,6 +100,7 @@ A number of changes were made to the configuration options passed to the `Chart`
#### Defaults
* `global` namespace was removed from `defaults`. So `Chart.defaults.global` is now `Chart.defaults`
+* Dataset controller defaults were relocate to `controllers`. For example `Chart.defaults.line` is ... | true |
Other | chartjs | Chart.js | 4f2511aff345c3f0ce6afb8f2e87fe043f50117b.json | Relocate dataset defaults to defaults.controllers (#7979) | samples/charts/multi-series-pie.html | @@ -47,7 +47,7 @@
labels: {
generateLabels: function(chart) {
// Get the default label list
- var original = Chart.defaults.pie.legend.labels.generateLabels;
+ var original = Chart.defaults.controllers.pie.legend.labels.generateLabels;
var labels = original.call(this, chart);
... | true |
Other | chartjs | Chart.js | 4f2511aff345c3f0ce6afb8f2e87fe043f50117b.json | Relocate dataset defaults to defaults.controllers (#7979) | src/core/core.config.js | @@ -3,7 +3,7 @@ import defaults from './core.defaults';
import {mergeIf, merge, _merger} from '../helpers/helpers.core';
export function getIndexAxis(type, options) {
- const typeDefaults = defaults[type] || {};
+ const typeDefaults = defaults.controllers[type] || {};
const datasetDefaults = typeDefaults.datasets... | true |
Other | chartjs | Chart.js | 4f2511aff345c3f0ce6afb8f2e87fe043f50117b.json | Relocate dataset defaults to defaults.controllers (#7979) | src/core/core.controller.js | @@ -384,7 +384,7 @@ class Chart {
meta.controller.updateIndex(i);
meta.controller.linkScales();
} else {
- const controllerDefaults = defaults[type];
+ const controllerDefaults = defaults.controllers[type];
const ControllerClass = registry.getController(type);
Object.assign(ControllerClass... | true |
Other | chartjs | Chart.js | 4f2511aff345c3f0ce6afb8f2e87fe043f50117b.json | Relocate dataset defaults to defaults.controllers (#7979) | src/core/core.datasetController.js | @@ -1,4 +1,5 @@
import Animations from './core.animations';
+import defaults from './core.defaults';
import {isObject, merge, _merger, isArray, valueOrDefault, mergeIf, resolveObjectKey, _capitalize} from '../helpers/helpers.core';
import {listenArrayEvents, unlistenArrayEvents} from '../helpers/helpers.collection';... | true |
Other | chartjs | Chart.js | 4f2511aff345c3f0ce6afb8f2e87fe043f50117b.json | Relocate dataset defaults to defaults.controllers (#7979) | src/core/core.registry.js | @@ -10,7 +10,7 @@ import {each, callback as call, _capitalize} from '../helpers/helpers.core';
*/
export class Registry {
constructor() {
- this.controllers = new TypedRegistry(DatasetController, '');
+ this.controllers = new TypedRegistry(DatasetController, 'controllers');
this.elements = new TypedRegistry(E... | true |
Other | chartjs | Chart.js | 4f2511aff345c3f0ce6afb8f2e87fe043f50117b.json | Relocate dataset defaults to defaults.controllers (#7979) | test/specs/controller.bar.tests.js | @@ -1286,7 +1286,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.bar.datasets;
+ var options = Chart.defaults.controllers.bar.datasets;
var ... | true |
Other | chartjs | Chart.js | 4f2511aff345c3f0ce6afb8f2e87fe043f50117b.json | Relocate dataset defaults to defaults.controllers (#7979) | test/specs/controller.line.tests.js | @@ -499,18 +499,18 @@ describe('Chart.controllers.line', function() {
describe('dataset global defaults', function() {
beforeEach(function() {
- this._defaults = Chart.helpers.clone(Chart.defaults.line.datasets);
+ this._defaults = Chart.helpers.clone(Chart.defaults.controllers.line.datasets);
});
af... | true |
Other | chartjs | Chart.js | 4f2511aff345c3f0ce6afb8f2e87fe043f50117b.json | Relocate dataset defaults to defaults.controllers (#7979) | test/specs/core.controller.tests.js | @@ -92,59 +92,59 @@ describe('Chart', function() {
it('should initialize config with default interaction options', function() {
var callback = function() {};
var defaults = Chart.defaults;
- var defaultMode = defaults.line.interaction.mode;
+ var defaultMode = defaults.controllers.line.interaction.mode;
... | true |
Other | chartjs | Chart.js | 4f2511aff345c3f0ce6afb8f2e87fe043f50117b.json | Relocate dataset defaults to defaults.controllers (#7979) | test/specs/core.registry.tests.js | @@ -6,12 +6,12 @@ describe('Chart.registry', function() {
CustomController.prototype = Object.create(Chart.controllers.line.prototype);
CustomController.prototype.constructor = CustomController;
CustomController.id = 'myline';
- CustomController.defaults = Chart.defaults.line;
+ CustomController.defaults = C... | true |
Other | chartjs | Chart.js | 4f2511aff345c3f0ce6afb8f2e87fe043f50117b.json | Relocate dataset defaults to defaults.controllers (#7979) | test/specs/global.defaults.tests.js | @@ -33,7 +33,7 @@ describe('Default Configs', function() {
describe('Doughnut Chart', function() {
it('should return correct tooltip strings', function() {
- var config = Chart.defaults.doughnut;
+ var config = Chart.defaults.controllers.doughnut;
var chart = window.acquireChart({
type: 'doughnut',
... | true |
Other | chartjs | Chart.js | 4f2511aff345c3f0ce6afb8f2e87fe043f50117b.json | Relocate dataset defaults to defaults.controllers (#7979) | test/specs/platform.dom.tests.js | @@ -119,8 +119,8 @@ describe('Platform.dom', function() {
});
it('should use default "chart" aspect ratio for render and display sizes', function() {
- var ratio = Chart.defaults.doughnut.aspectRatio;
- Chart.defaults.doughnut.aspectRatio = 1;
+ var ratio = Chart.defaults.controllers.doughnut.aspectRatio;... | true |
Other | chartjs | Chart.js | bc59038772b74bff64127098115604520fbf769f.json | Allow 1px margin to getRelativePosition test (#7984) | test/specs/helpers.dom.tests.js | @@ -317,10 +317,9 @@ describe('DOM helpers tests', function() {
};
const rect = chart.canvas.getBoundingClientRect();
- expect(helpers.getRelativePosition(event, chart)).toEqual({
- x: Math.round(event.clientX - rect.x),
- y: Math.round(event.clientY - rect.y)
- });
+ const pos = helpers.getRelati... | false |
Other | chartjs | Chart.js | 68bae7906d93784618bd7d2ef4f760db09a31088.json | fix return type for setActiveElements (#7961) | types/core/index.d.ts | @@ -299,7 +299,7 @@ export declare class Chart<
show(datasetIndex: number): void;
getActiveElements(): ActiveElement[];
- setActiveElements(active: ActiveDataPoint[]);
+ setActiveElements(active: ActiveDataPoint[]): void;
destroy(): void;
toBase64Image(type?: string, quality?: any): string; | true |
Other | chartjs | Chart.js | 68bae7906d93784618bd7d2ef4f760db09a31088.json | fix return type for setActiveElements (#7961) | types/plugins/index.d.ts | @@ -295,7 +295,7 @@ export const Tooltip: IPlugin & {
};
getActiveElements(): ActiveElement[];
- setActiveElements(active: ActiveDataPoint[], eventPosition: { x: number, y: number });
+ setActiveElements(active: ActiveDataPoint[], eventPosition: { x: number, y: number }): void;
};
export interface IToolti... | true |
Other | chartjs | Chart.js | 2e43f787de354427a0ec96c505e8934072702ad9.json | Fix small bugs when animations are disabled (#8253)
* Fix small bugs when animations are disabled
* Update test | src/core/core.controller.js | @@ -1002,13 +1002,13 @@ class Chart {
/**
* @private
*/
- _updateHoverStyles(active, lastActive) {
+ _updateHoverStyles(active, lastActive, replay) {
const me = this;
const options = me.options || {};
const hoverOptions = options.hover;
const diff = (a, b) => a.filter(x => !b.some(y => x.datasetInde... | true |
Other | chartjs | Chart.js | 2e43f787de354427a0ec96c505e8934072702ad9.json | Fix small bugs when animations are disabled (#8253)
* Fix small bugs when animations are disabled
* Update test | src/core/core.element.js | @@ -37,7 +37,7 @@ export default class Element {
}
const ret = {};
props.forEach(prop => {
- ret[prop] = anims[prop] && anims[prop].active ? anims[prop]._to : me[prop];
+ ret[prop] = anims[prop] && anims[prop].active() ? anims[prop]._to : me[prop];
});
return ret;
} | true |
Other | chartjs | Chart.js | 2e43f787de354427a0ec96c505e8934072702ad9.json | Fix small bugs when animations are disabled (#8253)
* Fix small bugs when animations are disabled
* Update test | src/helpers/helpers.extras.js | @@ -65,5 +65,5 @@ export const _alignStartEnd = (align, start, end) => align === 'start' ? start :
*/
export function _coordsAnimated(element) {
const anims = element && element.$animations;
- return anims && ((anims.x && anims.x.active) || (anims.y && anims.y.active));
+ return anims && ((anims.x && anims.x.activ... | true |
Other | chartjs | Chart.js | 2e43f787de354427a0ec96c505e8934072702ad9.json | Fix small bugs when animations are disabled (#8253)
* Fix small bugs when animations are disabled
* Update test | test/specs/core.element.tests.js | @@ -8,7 +8,7 @@ describe('Chart.element', function() {
expect(elem.getProps(['x', 'y'])).toEqual(jasmine.objectContaining({x: 10, y: 1.5}));
expect(elem.getProps(['x', 'y'], true)).toEqual(jasmine.objectContaining({x: 10, y: 1.5}));
- elem.$animations = {x: {active: true, _to: 20}};
+ elem.$animations = {... | true |
Other | chartjs | Chart.js | 59000abd1d96c4e29c6687967f948b47a7db3948.json | Use cached Intl.NumberFormat everywhere (#8244) | src/controllers/controller.doughnut.js | @@ -1,4 +1,5 @@
import DatasetController from '../core/core.datasetController';
+import {formatNumber} from '../core/core.intl';
import {isArray, valueOrDefault} from '../helpers/helpers.core';
import {toRadians, PI, TAU, HALF_PI} from '../helpers/helpers.math';
@@ -235,7 +236,7 @@ export default class DoughnutCon... | true |
Other | chartjs | Chart.js | 59000abd1d96c4e29c6687967f948b47a7db3948.json | Use cached Intl.NumberFormat everywhere (#8244) | src/core/core.intl.js | @@ -0,0 +1,17 @@
+
+const intlCache = new Map();
+
+export function getNumberFormat(locale, options) {
+ options = options || {};
+ const cacheKey = locale + JSON.stringify(options);
+ let formatter = intlCache.get(cacheKey);
+ if (!formatter) {
+ formatter = new Intl.NumberFormat(locale, options);
+ intlCache.set(ca... | true |
Other | chartjs | Chart.js | 59000abd1d96c4e29c6687967f948b47a7db3948.json | Use cached Intl.NumberFormat everywhere (#8244) | src/core/core.ticks.js | @@ -1,7 +1,7 @@
import {isArray} from '../helpers/helpers.core';
import {log10} from '../helpers/helpers.math';
+import {formatNumber} from './core.intl';
-const intlCache = new Map();
/**
* Namespace to hold formatters for different types of ticks
* @namespace Chart.Ticks.formatters
@@ -55,14 +55,7 @@ const f... | true |
Other | chartjs | Chart.js | 59000abd1d96c4e29c6687967f948b47a7db3948.json | Use cached Intl.NumberFormat everywhere (#8244) | src/scales/scale.linearbase.js | @@ -1,6 +1,7 @@
import {isNullOrUndef, valueOrDefault} from '../helpers/helpers.core';
import {almostEquals, almostWhole, log10, _decimalPlaces, _setMinAndMaxByKey, sign} from '../helpers/helpers.math';
import Scale from '../core/core.scale';
+import {formatNumber} from '../core/core.intl';
/**
* Implementation... | true |
Other | chartjs | Chart.js | 59000abd1d96c4e29c6687967f948b47a7db3948.json | Use cached Intl.NumberFormat everywhere (#8244) | src/scales/scale.logarithmic.js | @@ -3,6 +3,7 @@ import {_setMinAndMaxByKey, log10} from '../helpers/helpers.math';
import Scale from '../core/core.scale';
import LinearScaleBase from './scale.linearbase';
import Ticks from '../core/core.ticks';
+import {formatNumber} from '../core/core.intl';
function isMajor(tickVal) {
const remain = tickVal... | true |
Other | chartjs | Chart.js | e530a4d1a0bd264885a559b1bb5213e26d898454.json | Line: Use Path2D as cache (#8239)
* Line: Use Path2D as cache
* Add comment, move to helpers, first and last point | src/elements/element.line.js | @@ -3,6 +3,7 @@ import {_bezierInterpolation, _pointInLine, _steppedInterpolation} from '../help
import {_computeSegments, _boundSegments} from '../helpers/helpers.segment';
import {_steppedLineTo, _bezierCurveTo} from '../helpers/helpers.canvas';
import {_updateBezierControlPoints} from '../helpers/helpers.curve';
... | true |
Other | chartjs | Chart.js | e530a4d1a0bd264885a559b1bb5213e26d898454.json | Line: Use Path2D as cache (#8239)
* Line: Use Path2D as cache
* Add comment, move to helpers, first and last point | src/helpers/helpers.extras.js | @@ -1,3 +1,4 @@
+
export function fontString(pixelSize, fontStyle, fontFamily) {
return fontStyle + ' ' + pixelSize + 'px ' + fontFamily;
}
@@ -55,3 +56,14 @@ export const _toLeftRightCenter = (align) => align === 'start' ? 'left' : align
* @private
*/
export const _alignStartEnd = (align, start, end) => align... | true |
Other | chartjs | Chart.js | e6dfc47927508c79aa5495be65e8bda32fffddcf.json | Update spelling of cancellable (#8236) | src/core/core.controller.js | @@ -462,7 +462,7 @@ class Chart {
// https://github.com/chartjs/Chart.js/issues/5111#issuecomment-355934167
me._plugins.invalidate();
- if (me.notifyPlugins('beforeUpdate', {mode, cancelable: true}) === false) {
+ if (me.notifyPlugins('beforeUpdate', {mode, cancellable: true}) === false) {
return;
}
... | true |
Other | chartjs | Chart.js | e6dfc47927508c79aa5495be65e8bda32fffddcf.json | Update spelling of cancellable (#8236) | src/core/core.plugins.js | @@ -50,7 +50,7 @@ export default class PluginService {
const plugin = descriptor.plugin;
const method = plugin[hook];
const params = [chart, args, descriptor.options];
- if (callCallback(method, params, plugin) === false && args.cancelable) {
+ if (callCallback(method, params, plugin) === false && args.... | true |
Other | chartjs | Chart.js | e6dfc47927508c79aa5495be65e8bda32fffddcf.json | Update spelling of cancellable (#8236) | test/specs/core.plugin.tests.js | @@ -151,7 +151,7 @@ describe('Chart.plugins', function() {
spyOn(plugin, 'hook').and.callThrough();
});
- var ret = chart.notifyPlugins('hook', {cancelable: true});
+ var ret = chart.notifyPlugins('hook', {cancellable: true});
expect(ret).toBeFalsy();
expect(plugins[0].hook).toHaveBeenCalled();
... | true |
Other | chartjs | Chart.js | 78e78256a5e2630b2bba644a8d48ec1674220179.json | Cache the lineheight regex (#8240) | src/helpers/helpers.options.js | @@ -2,6 +2,8 @@ import defaults from '../core/core.defaults';
import {isArray, isObject, valueOrDefault} from './helpers.core';
import {toFontString} from './helpers.canvas';
+const LINE_HEIGHT = new RegExp(/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/);
+
/**
* @alias Chart.helpers.options
* @namespace
@@ -15,7 +17,... | false |
Other | chartjs | Chart.js | 55dd7ded0e7c6133c615c28aa3d46ab97ea08a82.json | Remove duplicate Scriptable definitions (#8223) | types/index.esm.d.ts | @@ -16,11 +16,31 @@ import { TimeUnit } from "./adapters";
import { AnimationEvent } from './animation';
import { Element }from './element';
import { ChartArea, Point } from './geometric';
+import {
+ Scriptable,
+ ScriptableOptions,
+ ScriptableAndArrayOptions
+} from './scriptable';
export { DateAdapterBase,... | true |
Other | chartjs | Chart.js | 55dd7ded0e7c6133c615c28aa3d46ab97ea08a82.json | Remove duplicate Scriptable definitions (#8223) | types/scriptable.d.ts | @@ -0,0 +1,4 @@
+export type Scriptable<T, TContext> = T | ((ctx: TContext) => T);
+export type ScriptableOptions<T, TContext> = { [P in keyof T]: Scriptable<T[P], TContext> };
+export type ScriptableAndArray<T, TContext> = readonly T[] | Scriptable<T, TContext>;
+export type ScriptableAndArrayOptions<T, TContext> = { ... | true |
Other | chartjs | Chart.js | 491f871218d94889c9c929a19973c852e5cdc6e5.json | Add note about loading fonts and chart updates (#8214) | docs/docs/general/fonts.md | @@ -37,3 +37,7 @@ let chart = new Chart(ctx, {
## Missing Fonts
If a font is specified for a chart that does exist on the system, the browser will not apply the font when it is set. If you notice odd fonts appearing in your charts, check that the font you are applying exists on your system. See [issue 3318](https:/... | false |
Other | chartjs | Chart.js | e529775d5ed82c431e60fc8ef5c64b39ff0c69d8.json | Update showLine location in defaults (#8199)
Current defaults was wrong.
Working example: https://jsfiddle.net/Leelenaleee/vL7d6yp0/5/ | docs/docs/configuration/index.md | @@ -50,7 +50,7 @@ The following example would set the `showLine` option to 'false' for all line da
```javascript
// Do not show lines for all datasets by default
-Chart.defaults.datasets.line.showLine = false;
+Chart.defaults.controllers.line.showLine = false;
// This chart would show a line only for the third d... | false |
Other | chartjs | Chart.js | b55b361f97461996eec01c6013c6617601c77b12.json | Reject pending promises when animation is updated (#8184)
* Reject pending promises when animation is updated
* Add tests | src/core/core.animation.js | @@ -46,6 +46,8 @@ export default class Animation {
update(cfg, to, date) {
const me = this;
if (me._active) {
+ me._notify(false);
+
const currentValue = me._target[me._prop];
const elapsed = date - me._start;
const remain = me._duration - elapsed; | true |
Other | chartjs | Chart.js | b55b361f97461996eec01c6013c6617601c77b12.json | Reject pending promises when animation is updated (#8184)
* Reject pending promises when animation is updated
* Add tests | src/core/core.animations.js | @@ -131,6 +131,8 @@ export default class Animations {
// So any new updates to the shared options are observed
awaitAll(target.options.$animations, newOptions).then(() => {
target.options = newOptions;
+ }, () => {
+ // rejected, noop
});
}
| true |
Other | chartjs | Chart.js | b55b361f97461996eec01c6013c6617601c77b12.json | Reject pending promises when animation is updated (#8184)
* Reject pending promises when animation is updated
* Add tests | test/specs/core.animations.tests.js | @@ -96,4 +96,93 @@ describe('Chart.animations', function() {
done();
}, 300);
});
+
+ it('should not assign shared options to target when animations are cancelled', function(done) {
+ const chart = {
+ draw: function() {},
+ options: {
+ animation: {
+ debug: false
+ }
+ }
+ };
+ const anims... | true |
Other | chartjs | Chart.js | 3c79d104d97aa7ed25ba4e9fc134809078a2f324.json | Add ArcElement to getting-started.md (#8174)
* fix: add ArcElement to getting-started.md
* fix: add all possible imports
* fix: add text to integration.md | docs/docs/getting-started/integration.md | @@ -24,10 +24,58 @@ var myChart = new Chart(ctx, {...});
Chart.js 3 is tree-shakeable, so it is necessary to import and register the controllers, elements, scales and plugins you are going to use.
+For all available imports see the example below.
```javascript
-import { Chart, LineController, LineElement, PointEl... | false |
Other | chartjs | Chart.js | f191f2f5f9a1e1e1a95f1722b41d168244b1d554.json | Remove dataset while hovered (#8181) | src/core/core.controller.js | @@ -725,7 +725,7 @@ class Chart {
hidden: null, // See isDatasetVisible() comment
xAxisID: null,
yAxisID: null,
- order: dataset.order || 0,
+ order: dataset && dataset.order || 0,
index: datasetIndex,
_dataset: dataset,
_parsed: [],
@@ -808,7 +808,7 @@ class Chart {
const me = ... | false |
Other | chartjs | Chart.js | 8ab62f57be0c65f16520ede167590a95ef76c8cf.json | Use correct color for legend labels (#8167)
* Legend colors fallback
* Update test | docs/docs/configuration/legend.md | @@ -52,6 +52,7 @@ The legend label configuration is nested below the legend configuration using th
| ---- | ---- | ------- | -----------
| `boxWidth` | `number` | `40` | Width of coloured box.
| `boxHeight` | `number` | fontSize | Height of the coloured box.
+| `color` |[`Color`](../general/colors.md) | `defaults.co... | true |
Other | chartjs | Chart.js | 8ab62f57be0c65f16520ede167590a95ef76c8cf.json | Use correct color for legend labels (#8167)
* Legend colors fallback
* Update test | src/plugins/plugin.legend.js | @@ -611,5 +611,10 @@ export default {
position: 'center',
text: '',
}
+ },
+
+ defaultRoutes: {
+ 'labels.color': 'color',
+ 'title.color': 'color'
}
}; | true |
Other | chartjs | Chart.js | 8ab62f57be0c65f16520ede167590a95ef76c8cf.json | Use correct color for legend labels (#8167)
* Legend colors fallback
* Update test | test/specs/plugin.legend.tests.js | @@ -17,12 +17,14 @@ describe('Legend block tests', function() {
onLeave: null,
labels: {
+ color: Chart.defaults.color,
boxWidth: 40,
padding: 10,
generateLabels: jasmine.any(Function)
},
title: {
+ color: Chart.defaults.color,
display: false,
position: 'center',
... | true |
Other | chartjs | Chart.js | dc00ed08cb7753a8df61edda1e5c660c71f7ec57.json | Update docs on printing (#8149)
From what I can tell from testing locally, Chrome doesn't reliably trigger resize events for the final print layout, so using `.resize()` with no parameters doesn't generally work.
I'm not sure if there are circumstances in which the original docs' suggestion of using `.resize()` wit... | docs/docs/general/responsive.md | @@ -41,7 +41,7 @@ Note that in order for the above code to correctly resize the chart height, the
## Printing Resizable Charts
-CSS media queries allow changing styles when printing a page. The CSS applied from these media queries may cause charts to need to resize. However, the resize won't happen automatically. ... | true |
Other | chartjs | Chart.js | dc00ed08cb7753a8df61edda1e5c660c71f7ec57.json | Update docs on printing (#8149)
From what I can tell from testing locally, Chrome doesn't reliably trigger resize events for the final print layout, so using `.resize()` with no parameters doesn't generally work.
I'm not sure if there are circumstances in which the original docs' suggestion of using `.resize()` wit... | types/core/index.d.ts | @@ -197,7 +197,7 @@ export declare class Chart<
clear(): this;
stop(): this;
- resize(width: number, height: number): void;
+ resize(width?: number, height?: number): void;
ensureScalesHaveIDs(): void;
buildOrUpdateScales(): void;
buildOrUpdateControllers(): void; | true |
Other | chartjs | Chart.js | ae04fcf3c3818a2ceb67556a9bde8da29d42b2c3.json | fix default font color for legend (#8139)
* fix default font color for legend
* adjusted docs to be consistent with fontColor to color | docs/docs/configuration/legend.md | @@ -125,7 +125,7 @@ var chart = new Chart(ctx, {
legend: {
display: true,
labels: {
- fontColor: 'rgb(255, 99, 132)'
+ color: 'rgb(255, 99, 132)'
}
}
} | true |
Other | chartjs | Chart.js | ae04fcf3c3818a2ceb67556a9bde8da29d42b2c3.json | fix default font color for legend (#8139)
* fix default font color for legend
* adjusted docs to be consistent with fontColor to color | src/plugins/plugin.legend.js | @@ -311,7 +311,7 @@ export class Legend extends Element {
const rtlHelper = getRtlAdapter(opts.rtl, me.left, me._minSize.width);
const ctx = me.ctx;
const labelFont = toFont(labelOpts.font, me.chart.options.font);
- const fontColor = labelOpts.color;
+ const fontColor = labelOpts.color || defaultColor;
co... | true |
Other | chartjs | Chart.js | 39c2b92bb2858cdc381a5ec8fbbc5a27af7cb6cd.json | Fix the needs job name (#8129) | .github/workflows/release.yml | @@ -49,7 +49,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish:
- needs: [version, draft]
+ needs: [version, notes]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2 | false |
Other | chartjs | Chart.js | c1aeba1e67593d0cf1bd75b50fb2c7724f768cee.json | Add new scale hooks for plugins (#8112)
* Add new scale hooks for plugins
* Add notes
* cc
* cancelability | src/core/core.controller.js | @@ -440,7 +440,6 @@ class Chart {
update(mode) {
const me = this;
- const args = {mode};
let i, ilen;
each(me.scales, (scale) => {
@@ -458,7 +457,7 @@ class Chart {
// https://github.com/chartjs/Chart.js/issues/5111#issuecomment-355934167
me._plugins.invalidate();
- if (me.notifyPlugins('before... | true |
Other | chartjs | Chart.js | c1aeba1e67593d0cf1bd75b50fb2c7724f768cee.json | Add new scale hooks for plugins (#8112)
* Add new scale hooks for plugins
* Add notes
* cc
* cancelability | src/core/core.plugins.js | @@ -49,7 +49,7 @@ export default class PluginService {
const plugin = descriptor.plugin;
const method = plugin[hook];
const params = [chart, args, descriptor.options];
- if (callCallback(method, params, plugin) === false) {
+ if (callCallback(method, params, plugin) === false && args.cancelable) {
... | true |
Other | chartjs | Chart.js | c1aeba1e67593d0cf1bd75b50fb2c7724f768cee.json | Add new scale hooks for plugins (#8112)
* Add new scale hooks for plugins
* Add notes
* cc
* cancelability | src/core/core.scale.js | @@ -649,18 +649,24 @@ export default class Scale extends Element {
call(this.options.afterSetDimensions, [this]);
}
+ _callHooks(name) {
+ const me = this;
+ me.chart.notifyPlugins(name, me.getContext());
+ call(me.options[name], [me]);
+ }
+
// Data limits
beforeDataLimits() {
- call(this.options.before... | true |
Other | chartjs | Chart.js | c1aeba1e67593d0cf1bd75b50fb2c7724f768cee.json | Add new scale hooks for plugins (#8112)
* Add new scale hooks for plugins
* Add notes
* cc
* cancelability | test/specs/core.controller.tests.js | @@ -1396,6 +1396,14 @@ describe('Chart', function() {
update: [
'beforeUpdate',
'beforeLayout',
+ 'beforeDataLimits',
+ 'afterDataLimits',
+ 'beforeBuildTicks',
+ 'afterBuildTicks',
+ 'beforeDataLimits',
+ 'afterDataLimits',
+ 'beforeBuildTicks',
+ 'afterBuildTicks',
'afterLay... | true |
Other | chartjs | Chart.js | c1aeba1e67593d0cf1bd75b50fb2c7724f768cee.json | Add new scale hooks for plugins (#8112)
* Add new scale hooks for plugins
* Add notes
* cc
* cancelability | test/specs/core.plugin.tests.js | @@ -151,7 +151,7 @@ describe('Chart.plugins', function() {
spyOn(plugin, 'hook').and.callThrough();
});
- var ret = chart.notifyPlugins('hook');
+ var ret = chart.notifyPlugins('hook', {cancelable: true});
expect(ret).toBeFalsy();
expect(plugins[0].hook).toHaveBeenCalled();
expect(plugins[1].... | true |
Other | chartjs | Chart.js | c1aeba1e67593d0cf1bd75b50fb2c7724f768cee.json | Add new scale hooks for plugins (#8112)
* Add new scale hooks for plugins
* Add notes
* cc
* cancelability | types/core/index.d.ts | @@ -597,14 +597,14 @@ export interface Plugin<O = {}> {
* @param {object} args - The call arguments.
* @param {object} options - The plugin options.
*/
- beforeInit?(chart: Chart, args: {}, options: O): boolean | void;
+ beforeInit?(chart: Chart, args: {}, options: O): void;
/**
* @desc Called after `char... | true |
Other | chartjs | Chart.js | 6814b79b65afeeab09d3f03151ec0458be10686f.json | Fix CategoryScale.getValueForPixel with autoSkip (#8101) | src/scales/scale.category.js | @@ -111,8 +111,7 @@ export default class CategoryScale extends Scale {
getValueForPixel(pixel) {
const me = this;
- const value = Math.round(me._startValue + me.getDecimalForPixel(pixel) * me._valueRange);
- return Math.min(Math.max(value, 0), me.ticks.length - 1);
+ return Math.round(me._startValue + me.getD... | true |
Other | chartjs | Chart.js | 6814b79b65afeeab09d3f03151ec0458be10686f.json | Fix CategoryScale.getValueForPixel with autoSkip (#8101) | test/specs/scale.category.tests.js | @@ -476,6 +476,35 @@ describe('Category scale tests', function() {
expect(yScale.getPixelForValue(4)).toBeCloseToPixel(538);
});
+ it('Should be consistent on pixels and values with autoSkipped ticks', function() {
+ var labels = [];
+ for (let i = 0; i < 50; i++) {
+ labels.push('very long label ' + i);
+ ... | true |
Other | chartjs | Chart.js | 78dbeea1f0f09e2681ec3de55bbebb2f0ba71565.json | Add new hooks for plugins (#8103)
* Notify beforeUpdate on disabled plugins
cc?
cc2
cc3
typo
* init, unInit, enabled, disabled
self review :)
update the new hook signatures to unified
merge error
* Review update
* start/stop, cc
* types, jsdoc
* stop between destroy and uninstall | docs/docs/getting-started/v3-migration.md | @@ -499,3 +499,4 @@ All helpers are now exposed in a flat hierarchy, e.g., `Chart.helpers.canvas.cli
* `afterDatasetsUpdate`, `afterUpdate`, `beforeDatasetsUpdate`, and `beforeUpdate` now receive `args` object as second argument. `options` argument is always the last and thus was moved from 2nd to 3rd place.
* `after... | true |
Other | chartjs | Chart.js | 78dbeea1f0f09e2681ec3de55bbebb2f0ba71565.json | Add new hooks for plugins (#8103)
* Notify beforeUpdate on disabled plugins
cc?
cc2
cc3
typo
* init, unInit, enabled, disabled
self review :)
update the new hook signatures to unified
merge error
* Review update
* start/stop, cc
* types, jsdoc
* stop between destroy and uninstall | src/core/core.plugins.js | @@ -1,6 +1,6 @@
import defaults from './core.defaults';
import registry from './core.registry';
-import {mergeIf, valueOrDefault} from '../helpers/helpers.core';
+import {callback as callCallback, mergeIf, valueOrDefault} from '../helpers/helpers.core';
/**
* @typedef { import("./core.controller").default } Char... | true |
Other | chartjs | Chart.js | 78dbeea1f0f09e2681ec3de55bbebb2f0ba71565.json | Add new hooks for plugins (#8103)
* Notify beforeUpdate on disabled plugins
cc?
cc2
cc3
typo
* init, unInit, enabled, disabled
self review :)
update the new hook signatures to unified
merge error
* Review update
* start/stop, cc
* types, jsdoc
* stop between destroy and uninstall | src/plugins/plugin.legend.js | @@ -653,12 +653,14 @@ export default {
*/
_element: Legend,
- beforeInit(chart) {
+ start(chart) {
const legendOpts = resolveOptions(chart.options.plugins.legend);
+ createNewLegendAndAttach(chart, legendOpts);
+ },
- if (legendOpts) {
- createNewLegendAndAttach(chart, legendOpts);
- }
+ stop(chart) {
... | true |
Other | chartjs | Chart.js | 78dbeea1f0f09e2681ec3de55bbebb2f0ba71565.json | Add new hooks for plugins (#8103)
* Notify beforeUpdate on disabled plugins
cc?
cc2
cc3
typo
* init, unInit, enabled, disabled
self review :)
update the new hook signatures to unified
merge error
* Review update
* start/stop, cc
* types, jsdoc
* stop between destroy and uninstall | src/plugins/plugin.title.js | @@ -184,11 +184,17 @@ export default {
*/
_element: Title,
- beforeInit(chart, options) {
+ start(chart, _args, options) {
createTitle(chart, options);
},
- beforeUpdate(chart, args, options) {
+ stop(chart) {
+ const titleBlock = chart.titleBlock;
+ layouts.removeBox(chart, titleBlock);
+ delete chart... | true |
Other | chartjs | Chart.js | 78dbeea1f0f09e2681ec3de55bbebb2f0ba71565.json | Add new hooks for plugins (#8103)
* Notify beforeUpdate on disabled plugins
cc?
cc2
cc3
typo
* init, unInit, enabled, disabled
self review :)
update the new hook signatures to unified
merge error
* Review update
* start/stop, cc
* types, jsdoc
* stop between destroy and uninstall | test/specs/core.controller.tests.js | @@ -1383,44 +1383,49 @@ describe('Chart', function() {
});
describe('plugin.extensions', function() {
+ var hooks = {
+ install: ['install'],
+ uninstall: ['uninstall'],
+ init: [
+ 'beforeInit',
+ 'resize',
+ 'afterInit'
+ ],
+ start: ['start'],
+ stop: ['stop'],
+ update: [
+ 'beforeU... | true |
Other | chartjs | Chart.js | 78dbeea1f0f09e2681ec3de55bbebb2f0ba71565.json | Add new hooks for plugins (#8103)
* Notify beforeUpdate on disabled plugins
cc?
cc2
cc3
typo
* init, unInit, enabled, disabled
self review :)
update the new hook signatures to unified
merge error
* Review update
* start/stop, cc
* types, jsdoc
* stop between destroy and uninstall | test/specs/plugin.legend.tests.js | @@ -760,7 +760,7 @@ describe('Legend block tests', function() {
expect(chart.legend.weight).toBe(42);
});
- xit ('should remove the legend if the new options are false', function() {
+ it ('should remove the legend if the new options are false', function() {
var chart = acquireChart({
type: 'line',
... | true |
Other | chartjs | Chart.js | 78dbeea1f0f09e2681ec3de55bbebb2f0ba71565.json | Add new hooks for plugins (#8103)
* Notify beforeUpdate on disabled plugins
cc?
cc2
cc3
typo
* init, unInit, enabled, disabled
self review :)
update the new hook signatures to unified
merge error
* Review update
* start/stop, cc
* types, jsdoc
* stop between destroy and uninstall | test/specs/plugin.title.tests.js | @@ -295,7 +295,7 @@ describe('Title block tests', function() {
expect(chart.titleBlock.weight).toBe(42);
});
- xit ('should remove the title if the new options are false', function() {
+ it ('should remove the title if the new options are false', function() {
var chart = acquireChart({
type: 'line',... | true |
Other | chartjs | Chart.js | 78dbeea1f0f09e2681ec3de55bbebb2f0ba71565.json | Add new hooks for plugins (#8103)
* Notify beforeUpdate on disabled plugins
cc?
cc2
cc3
typo
* init, unInit, enabled, disabled
self review :)
update the new hook signatures to unified
merge error
* Review update
* start/stop, cc
* types, jsdoc
* stop between destroy and uninstall | types/core/index.d.ts | @@ -567,6 +567,30 @@ export const layouts: {
export interface Plugin<O = {}> {
id: string;
+ /**
+ * @desc Called when plugin is installed for this chart instance. This hook is also invoked for disabled plugins (options === false).
+ * @param {Chart} chart - The chart instance.
+ * @param {object} args - The ca... | true |
Other | chartjs | Chart.js | f0148738644244fccd362abd2492a2244e8b2d08.json | fix color type & add background and border color (#8110) | types/core/interfaces.d.ts | @@ -99,7 +99,17 @@ export interface CoreChartOptions extends ParsingOptions {
* base color
* @see Defaults.color
*/
- color: string;
+ color: Color;
+ /**
+ * base background color
+ * @see Defaults.backgroundColor
+ */
+ backgroundColor: Color;
+ /**
+ * base border color
+ * @see Defaul... | false |
Other | chartjs | Chart.js | c5dcf5a20d0f86015491766b3c581e182c878d16.json | Update chart extension docs + add samples (#8540)
* Update docs on chart extensions
* Working sample for derived chart types
* Add derived axis example
* Remove duplicated line | docs/docs/developers/charts.md | @@ -26,17 +26,21 @@ Dataset controllers must implement the following interface.
```javascript
{
- // Create elements for each piece of data in the dataset. Store elements in an array on the dataset as dataset.metaData
- addElements: function() {},
-
- // Draw the representation of the dataset
- draw: fu... | true |
Other | chartjs | Chart.js | c5dcf5a20d0f86015491766b3c581e182c878d16.json | Update chart extension docs + add samples (#8540)
* Update docs on chart extensions
* Working sample for derived chart types
* Add derived axis example
* Remove duplicated line | samples/advanced/derived-axis-type.html | @@ -0,0 +1,136 @@
+<!doctype html>
+<html>
+
+<head>
+ <title>Logarithmic Line Chart</title>
+ <script src="../../dist/chart.min.js"></script>
+ <script src="../utils.js"></script>
+ <style>
+ canvas {
+ -moz-user-select: none;
+ -webkit-user-select: none;
+ -ms-user-select: none;
+ }
+ </style>
+</head>
+
+<body>
+... | true |
Other | chartjs | Chart.js | c5dcf5a20d0f86015491766b3c581e182c878d16.json | Update chart extension docs + add samples (#8540)
* Update docs on chart extensions
* Working sample for derived chart types
* Add derived axis example
* Remove duplicated line | samples/advanced/derived-chart-type.html | @@ -0,0 +1,106 @@
+<!doctype html>
+<html>
+
+<head>
+ <title>Derived Chart Type</title>
+ <script src="../../dist/chart.min.js"></script>
+ <script src="../utils.js"></script>
+ <style type="text/css">
+ canvas{
+ -moz-user-select: none;
+ -webkit-user-select: none;
+ -ms-user-select: none;
+ }
+ </style>
+</h... | true |
Other | chartjs | Chart.js | c5dcf5a20d0f86015491766b3c581e182c878d16.json | Update chart extension docs + add samples (#8540)
* Update docs on chart extensions
* Working sample for derived chart types
* Add derived axis example
* Remove duplicated line | samples/samples.js | @@ -268,6 +268,12 @@
}, {
title: 'Programmatic Event Triggers',
path: 'advanced/programmatic-events.html'
+ }, {
+ title: 'Derived Chart Type',
+ path: 'advanced/derived-chart-type.html'
+ }, {
+ title: 'Derived Axis Type',
+ path: 'advanced/derived-axis-type.html'
}]
}];
| true |
Other | chartjs | Chart.js | 3460ef126e77c9a6ab83f5f03cdcc28e1aaeec84.json | Types: Add couple of tests, move utils to new file (#8526) | types/index.esm.d.ts | @@ -12,6 +12,8 @@
* }
*/
+import { DeepPartial, DistributiveArray } from './utils';
+
import { TimeUnit } from './adapters';
import { AnimationEvent } from './animation';
import { AnyObject, EmptyObject } from './basic';
@@ -3085,21 +3087,6 @@ export const RadialLinearScale: ChartComponent & {
new <O extend... | true |
Other | chartjs | Chart.js | 3460ef126e77c9a6ab83f5f03cdcc28e1aaeec84.json | Types: Add couple of tests, move utils to new file (#8526) | types/tests/parsed.data.type.ts | @@ -0,0 +1,18 @@
+import { ParsedDataType } from '../index.esm';
+
+interface test {
+ pie: ParsedDataType<'pie'>,
+ line: ParsedDataType<'line'>,
+ testA: ParsedDataType<'pie' | 'line' | 'bar'>
+ testB: ParsedDataType<'pie' | 'line' | 'bar'>
+ testC: ParsedDataType<'pie' | 'line' | 'bar'>
+}
+
+export const testI... | true |
Other | chartjs | Chart.js | 3460ef126e77c9a6ab83f5f03cdcc28e1aaeec84.json | Types: Add couple of tests, move utils to new file (#8526) | types/tests/scriptable.ts | @@ -0,0 +1,21 @@
+import { Scriptable } from '../index.esm';
+
+interface test {
+ pie?: Scriptable<number, 'pie'>,
+ line?: Scriptable<number, 'line'>,
+ testA?: Scriptable<number, 'pie' | 'line' | 'bar'>
+ testB?: Scriptable<number, 'pie' | 'line' | 'bar'>
+ testC?: Scriptable<number, 'pie' | 'line' | 'bar'>
+}
... | true |
Other | chartjs | Chart.js | 3460ef126e77c9a6ab83f5f03cdcc28e1aaeec84.json | Types: Add couple of tests, move utils to new file (#8526) | types/utils.d.ts | @@ -0,0 +1,15 @@
+
+// DeepPartial implementation taken from the utility-types NPM package, which is
+// Copyright (c) 2016 Piotr Witek <piotrek.witek@gmail.com> (http://piotrwitek.github.io)
+// and used under the terms of the MIT license
+export type DeepPartial<T> = T extends Function
+ ? T
+ : T extends Array<inf... | true |
Other | chartjs | Chart.js | 7c75310a0c048546591745840b0ece15b7868718.json | Use null for skipped values instead of NaN (#8510)
* Use null for skipped values instead of NaN
* Document skipped values when parsing is false
* Update src/core/core.datasetController.js
Co-authored-by: Jukka Kurkela <jukka.kurkela@gmail.com>
* Update src/core/core.datasetController.js
Co-authored-by: ... | docs/docs/charts/line.mdx | @@ -137,7 +137,7 @@ The style of the line can be controlled with the following properties:
| `fill` | How to fill the area under the line. See [area charts](area.md).
| `tension` | Bezier curve tension of the line. Set to 0 to draw straightlines. This option is ignored if monotone cubic interpolation is used.
| `sho... | true |
Other | chartjs | Chart.js | 7c75310a0c048546591745840b0ece15b7868718.json | Use null for skipped values instead of NaN (#8510)
* Use null for skipped values instead of NaN
* Document skipped values when parsing is false
* Update src/core/core.datasetController.js
Co-authored-by: Jukka Kurkela <jukka.kurkela@gmail.com>
* Update src/core/core.datasetController.js
Co-authored-by: ... | docs/docs/charts/radar.mdx | @@ -149,7 +149,7 @@ The style of the line can be controlled with the following properties:
| `borderWidth` | The line width (in pixels).
| `fill` | How to fill the area under the line. See [area charts](area.md).
| `tension` | Bezier curve tension of the line. Set to 0 to draw straight lines.
-| `spanGaps` | If true... | true |
Other | chartjs | Chart.js | 7c75310a0c048546591745840b0ece15b7868718.json | Use null for skipped values instead of NaN (#8510)
* Use null for skipped values instead of NaN
* Document skipped values when parsing is false
* Update src/core/core.datasetController.js
Co-authored-by: Jukka Kurkela <jukka.kurkela@gmail.com>
* Update src/core/core.datasetController.js
Co-authored-by: ... | docs/docs/configuration/tooltip.md | @@ -139,7 +139,7 @@ var chart = new Chart(ctx, {
if (label) {
label += ': ';
}
- if (!isNaN(context.parsed.y)) {
+ if (context.parsed.y !== null) {
label += new Intl.... | true |
Other | chartjs | Chart.js | 7c75310a0c048546591745840b0ece15b7868718.json | Use null for skipped values instead of NaN (#8510)
* Use null for skipped values instead of NaN
* Document skipped values when parsing is false
* Update src/core/core.datasetController.js
Co-authored-by: Jukka Kurkela <jukka.kurkela@gmail.com>
* Update src/core/core.datasetController.js
Co-authored-by: ... | docs/docs/developers/axes.md | @@ -132,13 +132,6 @@ The Core.Scale base class also has some utility functions that you may find usef
// Returns true if the scale instance is horizontal
isHorizontal: function() {},
- // Get the correct value from the value from this.chart.data.datasets[x].data[]
- // If dataValue is an object, retur... | true |
Other | chartjs | Chart.js | 7c75310a0c048546591745840b0ece15b7868718.json | Use null for skipped values instead of NaN (#8510)
* Use null for skipped values instead of NaN
* Document skipped values when parsing is false
* Update src/core/core.datasetController.js
Co-authored-by: Jukka Kurkela <jukka.kurkela@gmail.com>
* Update src/core/core.datasetController.js
Co-authored-by: ... | docs/docs/general/data-structures.md | @@ -19,7 +19,7 @@ When the `data` is an array of numbers, values from `labels` array at the same i
## Object[]
```javascript
-data: [{x: 10, y: 20}, {x: 15, y: 10}]
+data: [{x: 10, y: 20}, {x: 15, y: null}, {x: 20, y: 10}]
```
```javascript
@@ -32,7 +32,7 @@ data: [{x:'Sales', y:20}, {x:'Revenue', y:10}]
Thi... | true |
Other | chartjs | Chart.js | 7c75310a0c048546591745840b0ece15b7868718.json | Use null for skipped values instead of NaN (#8510)
* Use null for skipped values instead of NaN
* Document skipped values when parsing is false
* Update src/core/core.datasetController.js
Co-authored-by: Jukka Kurkela <jukka.kurkela@gmail.com>
* Update src/core/core.datasetController.js
Co-authored-by: ... | src/controllers/controller.bar.js | @@ -492,7 +492,7 @@ export default class BarController extends DatasetController {
clipArea(chart.ctx, chart.chartArea);
for (; i < ilen; ++i) {
- if (!isNaN(me.getParsed(i)[vScale.axis])) {
+ if (me.getParsed(i)[vScale.axis] !== null) {
rects[i].draw(me._ctx);
}
} | true |
Other | chartjs | Chart.js | 7c75310a0c048546591745840b0ece15b7868718.json | Use null for skipped values instead of NaN (#8510)
* Use null for skipped values instead of NaN
* Document skipped values when parsing is false
* Update src/core/core.datasetController.js
Co-authored-by: Jukka Kurkela <jukka.kurkela@gmail.com>
* Update src/core/core.datasetController.js
Co-authored-by: ... | src/controllers/controller.doughnut.js | @@ -138,14 +138,17 @@ export default class DoughnutController extends DatasetController {
}
/**
- * @private
- */
+ * @private
+ */
_circumference(i, reset) {
const me = this;
const opts = me.options;
const meta = me._cachedMeta;
const circumference = me._getCircumference();
- re... | true |
Other | chartjs | Chart.js | 7c75310a0c048546591745840b0ece15b7868718.json | Use null for skipped values instead of NaN (#8510)
* Use null for skipped values instead of NaN
* Document skipped values when parsing is false
* Update src/core/core.datasetController.js
Co-authored-by: Jukka Kurkela <jukka.kurkela@gmail.com>
* Update src/core/core.datasetController.js
Co-authored-by: ... | src/core/core.datasetController.js | @@ -1,6 +1,6 @@
import Animations from './core.animations';
import defaults from './core.defaults';
-import {isObject, isArray, valueOrDefault, resolveObjectKey, defined} from '../helpers/helpers.core';
+import {isArray, isFinite, isObject, valueOrDefault, resolveObjectKey, defined} from '../helpers/helpers.core';
i... | true |
Other | chartjs | Chart.js | 7c75310a0c048546591745840b0ece15b7868718.json | Use null for skipped values instead of NaN (#8510)
* Use null for skipped values instead of NaN
* Document skipped values when parsing is false
* Update src/core/core.datasetController.js
Co-authored-by: Jukka Kurkela <jukka.kurkela@gmail.com>
* Update src/core/core.datasetController.js
Co-authored-by: ... | src/scales/scale.linear.js | @@ -31,7 +31,7 @@ export default class LinearScale extends LinearScaleBase {
// Utils
getPixelForValue(value) {
- return this.getPixelForDecimal((value - this._startValue) / this._valueRange);
+ return value === null ? NaN : this.getPixelForDecimal((value - this._startValue) / this._valueRange);
}
... | true |
Other | chartjs | Chart.js | 7c75310a0c048546591745840b0ece15b7868718.json | Use null for skipped values instead of NaN (#8510)
* Use null for skipped values instead of NaN
* Document skipped values when parsing is false
* Update src/core/core.datasetController.js
Co-authored-by: Jukka Kurkela <jukka.kurkela@gmail.com>
* Update src/core/core.datasetController.js
Co-authored-by: ... | src/scales/scale.linearbase.js | @@ -115,10 +115,10 @@ export default class LinearScaleBase extends Scale {
parse(raw, index) { // eslint-disable-line no-unused-vars
if (isNullOrUndef(raw)) {
- return NaN;
+ return null;
}
if ((typeof raw === 'number' || raw instanceof Number) && !isFinite(+raw)) {
- return NaN;
+ ... | true |
Other | chartjs | Chart.js | 7c75310a0c048546591745840b0ece15b7868718.json | Use null for skipped values instead of NaN (#8510)
* Use null for skipped values instead of NaN
* Document skipped values when parsing is false
* Update src/core/core.datasetController.js
Co-authored-by: Jukka Kurkela <jukka.kurkela@gmail.com>
* Update src/core/core.datasetController.js
Co-authored-by: ... | src/scales/scale.logarithmic.js | @@ -64,7 +64,7 @@ export default class LogarithmicScale extends Scale {
this._zero = true;
return undefined;
}
- return isFinite(value) && value > 0 ? value : NaN;
+ return isFinite(value) && value > 0 ? value : null;
}
determineDataLimits() { | true |
Other | chartjs | Chart.js | 7c75310a0c048546591745840b0ece15b7868718.json | Use null for skipped values instead of NaN (#8510)
* Use null for skipped values instead of NaN
* Document skipped values when parsing is false
* Update src/core/core.datasetController.js
Co-authored-by: Jukka Kurkela <jukka.kurkela@gmail.com>
* Update src/core/core.datasetController.js
Co-authored-by: ... | src/scales/scale.time.js | @@ -47,7 +47,7 @@ function sorter(a, b) {
*/
function parse(scale, input) {
if (isNullOrUndef(input)) {
- return NaN;
+ return null;
}
const adapter = scale._adapter;
@@ -67,7 +67,7 @@ function parse(scale, input) {
}
if (value === null) {
- return NaN;
+ return null;
}
if (rou... | true |
Other | chartjs | Chart.js | 7c75310a0c048546591745840b0ece15b7868718.json | Use null for skipped values instead of NaN (#8510)
* Use null for skipped values instead of NaN
* Document skipped values when parsing is false
* Update src/core/core.datasetController.js
Co-authored-by: Jukka Kurkela <jukka.kurkela@gmail.com>
* Update src/core/core.datasetController.js
Co-authored-by: ... | test/fixtures/element.line/skip/middle-span.js | @@ -1,10 +1,11 @@
module.exports = {
config: {
type: 'line',
+ parsing: false,
data: {
datasets: [
{
- data: [{x: 0, y: 10}, {x: 5, y: 0}, {x: NaN, y: -10}, {x: 19, y: -5}],
+ data: [{x: 0, y: 10}, {x: 5, y: 0}, {x: null, y: -10}, {x: 19, y: -5}],
borderColo... | true |
Other | chartjs | Chart.js | 12e9020ab7d842eca51e70f9153ba49dd180c9b8.json | Remove unused getRingIndex from Doughnut (#8521) | docs/docs/getting-started/v3-migration.md | @@ -303,6 +303,7 @@ The following properties and methods were removed:
* `DatasetController.addElementAndReset`
* `DatasetController.createMetaData`
* `DatasetController.createMetaDataset`
+* `DoughnutController.getRingIndex`
#### Removed from Elements
| true |
Other | chartjs | Chart.js | 12e9020ab7d842eca51e70f9153ba49dd180c9b8.json | Remove unused getRingIndex from Doughnut (#8521) | src/controllers/controller.doughnut.js | @@ -60,19 +60,6 @@ export default class DoughnutController extends DatasetController {
}
}
- // Get index of the dataset in relation to the visible datasets. This allows determining the inner and outer radius correctly
- getRingIndex(datasetIndex) {
- let ringIndex = 0;
-
- for (let j = 0; j < dataset... | true |
Other | chartjs | Chart.js | 12e9020ab7d842eca51e70f9153ba49dd180c9b8.json | Remove unused getRingIndex from Doughnut (#8521) | types/index.esm.d.ts | @@ -314,7 +314,6 @@ export interface DoughnutController extends DatasetController {
readonly offsetX: number;
readonly offsetY: number;
- getRingIndex(datasetIndex: number): number;
calculateTotal(): number;
calculateCircumference(value: number): number;
} | true |
Other | chartjs | Chart.js | b31352c665ee41aeae538219dabb39ed18aa8ecc.json | Reduce duplication in PointElement (#8517) | src/elements/element.point.js | @@ -1,6 +1,13 @@
import Element from '../core/core.element';
import {drawPoint} from '../helpers/helpers.canvas';
+function inRange(el, pos, axis, useFinalPosition) {
+ const options = el.options;
+ const {[axis]: value} = el.getProps([axis], useFinalPosition);
+
+ return (Math.abs(pos - value) < options.radius ... | false |
Other | chartjs | Chart.js | 692d8a41281e65b66195835ff69b887dfa65af5f.json | Remove unreachable code paths from plugins (#8513) | src/plugins/plugin.filler.js | @@ -114,24 +114,18 @@ class simpleArc {
pathSegment(ctx, bounds, opts) {
const {x, y, radius} = this;
bounds = bounds || {start: 0, end: TAU};
- if (opts.reverse) {
- ctx.arc(x, y, radius, bounds.end, bounds.start, true);
- } else {
- ctx.arc(x, y, radius, bounds.start, bounds.end);
- }
... | true |
Other | chartjs | Chart.js | 692d8a41281e65b66195835ff69b887dfa65af5f.json | Remove unreachable code paths from plugins (#8513) | src/plugins/plugin.title.js | @@ -119,24 +119,6 @@ function createTitle(chart, titleOpts) {
chart.titleBlock = title;
}
-function removeTitle(chart) {
- const title = chart.titleBlock;
- if (title) {
- layouts.removeBox(chart, title);
- delete chart.titleBlock;
- }
-}
-
-function createOrUpdateTitle(chart, options) {
- const title =... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.