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 | 51be3447170fc648c3b5bc3002c963be62bccdf9.json | Preserve object prototypes when cloning (#7381) | src/helpers/helpers.core.js | @@ -199,7 +199,7 @@ export function clone(source) {
}
if (isObject(source)) {
- const target = {};
+ const target = Object.create(source);
const keys = Object.keys(source);
const klen = keys.length;
let k = 0; | true |
Other | chartjs | Chart.js | 51be3447170fc648c3b5bc3002c963be62bccdf9.json | Preserve object prototypes when cloning (#7381) | test/specs/helpers.core.tests.js | @@ -360,6 +360,27 @@ describe('Chart.helpers.core', function() {
expect(output.o).not.toBe(o0);
expect(output.o.a).not.toBe(a1);
});
+ it('should preserve prototype of objects', function() {
+ // https://github.com/chartjs/Chart.js/issues/7340
+ class MyConfigObject {
+ constructor(s) {
+ this._s... | true |
Other | chartjs | Chart.js | 50f2a1097a7db459adf38a9e9981e7aa26967c72.json | Detect data modifications with equal values (#7350)
Fix data shift-push with identical values | src/core/core.datasetController.js | @@ -235,6 +235,7 @@ export default class DatasetController {
this._parsing = false;
this._data = undefined;
this._dataCopy = undefined;
+ this._dataModified = false;
this._objectData = undefined;
this._labels = undefined;
this._scaleStacked = {};
@@ -359,7 +360,7 @@ export default class DatasetContro... | true |
Other | chartjs | Chart.js | 50f2a1097a7db459adf38a9e9981e7aa26967c72.json | Detect data modifications with equal values (#7350)
Fix data shift-push with identical values | test/specs/core.datasetController.tests.js | @@ -343,6 +343,32 @@ describe('Chart.DatasetController', function() {
expect(meta.data.length).toBe(42);
});
+ // https://github.com/chartjs/Chart.js/issues/7243
+ it('should re-synchronize metadata when data is moved and values are equal', function() {
+ var data = [10, 10, 10, 10, 10, 10];
+ var chart = acqu... | true |
Other | chartjs | Chart.js | ab1b0ca2b9403e00545e1caf026e951b37358ed5.json | Add a JSDoc for _dataCheck (#7377) | src/core/core.datasetController.js | @@ -339,6 +339,7 @@ export default class DatasetController {
}
/**
+ * @return {boolean} whether the data was modified
* @private
*/
_dataCheck() { | false |
Other | chartjs | Chart.js | 53f503825219e4a8ff78be16b858a0e969f9b435.json | Use correct index when resolving bubble options (#7375) | src/controllers/controller.bubble.js | @@ -110,7 +110,7 @@ export default class BubbleController extends DatasetController {
};
if (includeOptions) {
- properties.options = me.resolveDataElementOptions(i, mode);
+ properties.options = me.resolveDataElementOptions(index, mode);
if (reset) {
properties.options.radius = 0; | false |
Other | chartjs | Chart.js | c5e76fc592cddfe81cec2c9978f56c2a485552b2.json | Fix broken links to contributor's guide (#7348)
Closes https://github.com/chartjs/Chart.js/issues/7347 | README.md | @@ -25,7 +25,7 @@
## Contributing
-Instructions on building and testing Chart.js can be found in [the documentation](https://github.com/chartjs/Chart.js/blob/master/docs/developers/contributing.md#building-and-testing). Before submitting an issue or a pull request, please take a moment to look over the [contributi... | false |
Other | chartjs | Chart.js | 319a6a40b995d94acd048939ca47e75e9ba46dce.json | Use @rollup/plugin-inject for ResizeObserver poly (#7360) | package-lock.json | @@ -1030,6 +1030,17 @@
"resolve": "^1.11.0"
}
},
+ "@rollup/plugin-inject": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/@rollup/plugin-inject/-/plugin-inject-4.0.2.tgz",
+ "integrity": "sha512-TSLMA8waJ7Dmgmoc8JfPnwUwVZgLjjIAM6MqeIFqPO2ODK36JqE0Cf2F54UTgCUuW8... | true |
Other | chartjs | Chart.js | 319a6a40b995d94acd048939ca47e75e9ba46dce.json | Use @rollup/plugin-inject for ResizeObserver poly (#7360) | package.json | @@ -38,6 +38,7 @@
"@babel/plugin-transform-object-assign": "^7.8.3",
"@babel/preset-env": "^7.9.6",
"@rollup/plugin-commonjs": "^11.1.0",
+ "@rollup/plugin-inject": "^4.0.2",
"@rollup/plugin-json": "^4.0.3",
"@rollup/plugin-node-resolve": "^7.1.3",
"babel-plugin-istanbul": "^6.0.0",
@@ ... | true |
Other | chartjs | Chart.js | 319a6a40b995d94acd048939ca47e75e9ba46dce.json | Use @rollup/plugin-inject for ResizeObserver poly (#7360) | rollup.config.js | @@ -3,7 +3,7 @@
const babel = require('rollup-plugin-babel');
const cleanup = require('rollup-plugin-cleanup');
-const polyfill = require('rollup-plugin-polyfill');
+const inject = require('@rollup/plugin-inject');
const json = require('@rollup/plugin-json');
const resolve = require('@rollup/plugin-node-resolve')... | true |
Other | chartjs | Chart.js | a301ca148c4536793a740e7d263e74bc258ed25b.json | Add a scale.init method (#7346) | src/core/core.controller.js | @@ -403,9 +403,6 @@ export default class Chart {
let scale = null;
if (id in scales && scales[id].type === scaleType) {
scale = scales[id];
- scale.options = scaleOptions;
- scale.ctx = me.ctx;
- scale.chart = me;
} else {
const scaleClass = scaleService.getScaleConstructor(scaleType);
... | true |
Other | chartjs | Chart.js | a301ca148c4536793a740e7d263e74bc258ed25b.json | Add a scale.init method (#7346) | src/core/core.scale.js | @@ -278,7 +278,7 @@ export default class Scale extends Element {
/** @type {string} */
this.type = cfg.type;
/** @type {object} */
- this.options = cfg.options;
+ this.options = undefined;
/** @type {CanvasRenderingContext2D} */
this.ctx = cfg.ctx;
/** @type {Chart} */
@@ -344,10 +344,25 @@ export d... | true |
Other | chartjs | Chart.js | a301ca148c4536793a740e7d263e74bc258ed25b.json | Add a scale.init method (#7346) | src/scales/scale.radialLinear.js | @@ -309,6 +309,11 @@ export default class RadialLinearScale extends LinearScaleBase {
this.pointLabels = [];
}
+ init(options) {
+ super.init(options);
+ this.axis = 'r';
+ }
+
setDimensions() {
const me = this;
| true |
Other | chartjs | Chart.js | a301ca148c4536793a740e7d263e74bc258ed25b.json | Add a scale.init method (#7346) | src/scales/scale.time.js | @@ -555,10 +555,6 @@ export default class TimeScale extends Scale {
constructor(props) {
super(props);
- const options = this.options;
- const time = options.time || (options.time = {});
- const adapter = this._adapter = new adapters._date(options.adapters.date);
-
/** @type {{data: number[], labels: numbe... | true |
Other | chartjs | Chart.js | a301ca148c4536793a740e7d263e74bc258ed25b.json | Add a scale.init method (#7346) | test/specs/scale.category.tests.js | @@ -76,13 +76,13 @@ describe('Category scale tests', function() {
var Constructor = Chart.scaleService.getScaleConstructor('category');
var scale = new Constructor({
ctx: {},
- options: config,
chart: {
data: mockData
},
id: scaleID
});
+ scale.init(config);
scale.determineDataLimi... | true |
Other | chartjs | Chart.js | a94e1e175c5d5551a89c60835e3a91f569dc10b7.json | Add Algolia to docs (#7329) | docs/docusaurus.config.js | @@ -10,6 +10,13 @@ module.exports = {
plugins: ['@docusaurus/plugin-google-analytics'],
scripts: ['https://www.chartjs.org/dist/VERSION/Chart.min.js'],
themeConfig: {
+ algolia: {
+ apiKey: 'd7ee00a3cbaaf3c33e28ad1c274e7ba6',
+ indexName: 'chartjs',
+ algoliaOptions: {
+ facetFilters: ... | false |
Other | chartjs | Chart.js | 3a25fe29213cbe3f386988609699aab703f856cb.json | Document the removal of deprecated properties (#7334) | docs/docs/getting-started/v3-migration.md | @@ -173,15 +173,27 @@ The following properties and methods were removed:
#### Chart
* `Chart.borderWidth`
* `Chart.chart.chart`
+* `Chart.Bar`. New charts are created via `new Chart` and providing the appropriate `type` parameter
+* `Chart.Bubble`. New charts are created via `new Chart` and providing the appropriate... | false |
Other | chartjs | Chart.js | 00f726b0eaeeaad177ded228a00cb4c4e0c9e529.json | Update the contributing guide for Docusaurus (#7327) | docs/docs/developers/contributing.md | @@ -39,12 +39,20 @@ The following commands are now available from the repository root:
> gulp lint // perform code linting (ESLint)
> gulp test // perform code linting and run unit tests
> gulp test --browsers ... // test with specified browsers (comma-separated)
-> gulp docs ... | false |
Other | chartjs | Chart.js | 6bbbbe42ce4f80db4cebba5a3eafc5d42643837d.json | Remove old docs from gitignore (#7314) | .gitignore | @@ -1,26 +1,28 @@
+# Deployment
/coverage
/custom
/dist
-/docs/index.md
/gh-pages
-/jsdoc
-.idea
-.project
-.settings
-.vscode
-*.log
-*.swp
-*.stackdump
-build
-node_modules
+# Node.js
+node_modules/
npm-debug.log*
+# Docs
.docusaurus
.cache-loader
+build/
+# Development
.DS_Store
.env.local
.env.devel... | false |
Other | chartjs | Chart.js | 1228981e4f62d9a9d3f8cf3b90ef9138ebba7983.json | Fix couple of small issues (#7268) | rollup.config.js | @@ -3,7 +3,7 @@
const babel = require('rollup-plugin-babel');
const cleanup = require('rollup-plugin-cleanup');
-const polyfill = require('rollup-plugin-polyfill')
+const polyfill = require('rollup-plugin-polyfill');
const json = require('@rollup/plugin-json');
const resolve = require('@rollup/plugin-node-resolve... | true |
Other | chartjs | Chart.js | 1228981e4f62d9a9d3f8cf3b90ef9138ebba7983.json | Fix couple of small issues (#7268) | src/elements/element.rectangle.js | @@ -176,7 +176,7 @@ export default class Rectangle extends Element {
}
getCenterPoint(useFinalPosition) {
- const {x, y, base, horizontal} = this.getProps(['x', 'y', 'base', 'horizontal', useFinalPosition]);
+ const {x, y, base, horizontal} = this.getProps(['x', 'y', 'base', 'horizontal'], useFinalPosition);
... | true |
Other | chartjs | Chart.js | 1228981e4f62d9a9d3f8cf3b90ef9138ebba7983.json | Fix couple of small issues (#7268) | src/plugins/plugin.tooltip.js | @@ -45,7 +45,7 @@ defaults.set('tooltips', {
easing: 'easeOutQuart',
numbers: {
type: 'number',
- properties: ['x', 'y', 'width', 'height'],
+ properties: ['x', 'y', 'width', 'height', 'caretX', 'caretY'],
},
opacity: {
easing: 'linear', | true |
Other | chartjs | Chart.js | 14021d369a0eca3b9a669dd317839a909040b81f.json | Remove unused layouts.defaults (#7264)
* Remove unused layouts.defaults
* Add to migration guide | docs/getting-started/v3-migration.md | @@ -221,6 +221,10 @@ The following properties and methods were removed:
* `helpers.scaleMerge`
* `helpers.where`
+#### Layout
+
+* `Layout.defaults`
+
#### Scales
* `LogarithmicScale.minNotZero` | true |
Other | chartjs | Chart.js | 14021d369a0eca3b9a669dd317839a909040b81f.json | Remove unused layouts.defaults (#7264)
* Remove unused layouts.defaults
* Add to migration guide | src/core/core.layouts.js | @@ -230,7 +230,6 @@ defaults.set('layout', {
// Scales, Legends and Plugins all rely on the layout service and can easily register to be placed anywhere they need
// It is this service's responsibility of carrying out that layout.
export default {
- defaults: {},
/**
* Register a box to a chart. | true |
Other | chartjs | Chart.js | 14021d369a0eca3b9a669dd317839a909040b81f.json | Remove unused layouts.defaults (#7264)
* Remove unused layouts.defaults
* Add to migration guide | test/specs/core.layouts.tests.js | @@ -6,7 +6,6 @@ describe('Chart.layouts', function() {
it('should be exposed through Chart.layouts', function() {
expect(Chart.layouts).toBeDefined();
expect(typeof Chart.layouts).toBe('object');
- expect(Chart.layouts.defaults).toBeDefined();
expect(Chart.layouts.addBox).toBeDefined();
expect(Chart.layo... | true |
Other | chartjs | Chart.js | 5129e1aaf7800e1a816b4638cde3326af684eb31.json | update introduction documentation #7245 (#7247) | docs/README.md | @@ -54,7 +54,7 @@ var myChart = new Chart(ctx, {
## Contributing
-Before submitting an issue or a pull request to the project, please take a moment to look over the [contributing guidelines](https://github.com/chartjs/Chart.js/blob/master/docs/developers/contributing.md) first.
+Before submitting an issue or a pul... | false |
Other | chartjs | Chart.js | 3f58edbe800aacb9fc943a19af700e1cc8c439d4.json | Remove unused method parameter (#7229) | src/core/core.scale.js | @@ -175,10 +175,9 @@ function getEvenSpacing(arr) {
/**
* @param {number[]} majorIndices
* @param {Tick[]} ticks
- * @param {number} axisLength
* @param {number} ticksLimit
*/
-function calculateSpacing(majorIndices, ticks, axisLength, ticksLimit) {
+function calculateSpacing(majorIndices, ticks, ticksLimit) {... | false |
Other | chartjs | Chart.js | 8b01ab1326be8dead099cdb494e2efdc46ff4dbf.json | Use round when setting new chart size (#7221) | src/core/core.controller.js | @@ -313,8 +313,8 @@ export default class Chart {
// the canvas display style uses the same integer values to avoid blurring effect.
// Set to 0 instead of canvas.size because the size defaults to 300x150 if the element is collapsed
- const newWidth = Math.max(0, Math.floor(width));
- const newHeight = Math.ma... | false |
Other | chartjs | Chart.js | 60858547ac8e391a845d8b304914b84a5d948d86.json | Fix events in shadow dom (#7224) | src/helpers/helpers.dom.js | @@ -86,7 +86,7 @@ function _calculatePadding(container, padding, parentDimension) {
export function getRelativePosition(evt, chart) {
let mouseX, mouseY;
const e = evt.originalEvent || evt;
- const canvasElement = evt.target || evt.srcElement;
+ const canvasElement = chart.canvas;
const boundingRect = canvasElem... | false |
Other | chartjs | Chart.js | e8f2a5a27108d103cea18aad4aa835a7068d8499.json | Remove index override, (#9469)
Make barchart more inline with v2 behaviour and other charts | src/controllers/controller.bar.js | @@ -634,10 +634,6 @@ BarController.defaults = {
* @type {any}
*/
BarController.overrides = {
- interaction: {
- mode: 'index'
- },
-
scales: {
_index_: {
type: 'category', | false |
Other | chartjs | Chart.js | 2400fcb432d4bce68abfbe54cbc9cc8c930c381f.json | Adjust text to code example (#9475)
The previous text explains that, in the example, the font color is set and overridden but the code sets and overrides the _font size_. | docs/general/fonts.md | @@ -2,7 +2,7 @@
There are special global settings that can change all of the fonts on the chart. These options are in `Chart.defaults.font`. The global font settings only apply when more specific options are not included in the config.
-For example, in this chart the text will all be red except for the labels in t... | false |
Other | chartjs | Chart.js | df4944786709fb2b3a9038e6676f5491d9243a14.json | Limit Math.asin inputs to the range [-1, 1] (#9410) | src/core/core.scale.js | @@ -593,8 +593,8 @@ export default class Scale extends Element {
- tickOpts.padding - getTitleHeight(options.title, me.chart.options.font);
maxLabelDiagonal = Math.sqrt(maxLabelWidth * maxLabelWidth + maxLabelHeight * maxLabelHeight);
labelRotation = toDegrees(Math.min(
- Math.asin(Math.min((l... | false |
Other | chartjs | Chart.js | f315daf5cfc443b3bab32510c5d34079691ba288.json | Add missing resizeDelay option to types (#9403)
This option is defined in the documentation (https://www.chartjs.org/docs/master/configuration/responsive.html) and the native js code, but not listed in the types. This allows its use in typescript. | types/index.esm.d.ts | @@ -1412,6 +1412,11 @@ export interface CoreChartOptions<TType extends ChartType> extends ParsingOption
* @default true
*/
maintainAspectRatio: boolean;
+ /**
+ * Delay the resize update by give amount of milliseconds. This can ease the resize process by debouncing update of the elements.
+ * @default 0... | false |
Other | chartjs | Chart.js | 655c635191328f5e4d0ddf2adb9ff46d0760f301.json | Add SubTitle to the list of all esm imports (#9384) | docs/getting-started/integration.md | @@ -49,7 +49,8 @@ import {
Filler,
Legend,
Title,
- Tooltip
+ Tooltip,
+ SubTitle
} from 'chart.js';
Chart.register(
@@ -75,7 +76,8 @@ Chart.register(
Filler,
Legend,
Title,
- Tooltip
+ Tooltip,
+ SubTitle
);
var myChart = new Chart(ctx, {...}); | false |
Other | chartjs | Chart.js | d661bd788b51ae6a5444d3148f15e94af3e72e68.json | Resolve warnings from typings (#9363) | types/adapters.d.ts | @@ -3,7 +3,7 @@ export type TimeUnit = 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'w
export interface DateAdapter {
// Override one or multiple of the methods to adjust to the logic of the current date library.
override(members: Partial<DateAdapter>): void;
- readonly options: any;
+ readonly options: ... | true |
Other | chartjs | Chart.js | d661bd788b51ae6a5444d3148f15e94af3e72e68.json | Resolve warnings from typings (#9363) | types/element.d.ts | @@ -1,30 +1,17 @@
+import { AnyObject } from './basic';
import { Point } from './geometric';
-export interface Element<T = {}, O = {}> {
+export interface Element<T = AnyObject, O = AnyObject> {
readonly x: number;
readonly y: number;
readonly active: boolean;
readonly options: O;
tooltipPosition(useFina... | true |
Other | chartjs | Chart.js | d661bd788b51ae6a5444d3148f15e94af3e72e68.json | Resolve warnings from typings (#9363) | types/helpers/helpers.color.d.ts | @@ -1,5 +1,12 @@
export function color(value: CanvasGradient): CanvasGradient;
export function color(value: CanvasPattern): CanvasPattern;
+export function color(
+ value:
+ | string
+ | { r: number; g: number; b: number; a: number }
+ | [number, number, number]
+ | [number, number, number, number]
+): ColorModel... | true |
Other | chartjs | Chart.js | d661bd788b51ae6a5444d3148f15e94af3e72e68.json | Resolve warnings from typings (#9363) | types/helpers/helpers.extras.d.ts | @@ -12,7 +12,7 @@ export function requestAnimFrame(cb: () => void): void;
* @param {*} thisArg
* @param {function} [updateFn]
*/
-export function throttled(fn: (...args: any[]) => void, thisArg: any, updateFn?: (...args: any[]) => any[]): (...args: any[]) => void;
+export function throttled(fn: (...args: unknown[... | true |
Other | chartjs | Chart.js | d661bd788b51ae6a5444d3148f15e94af3e72e68.json | Resolve warnings from typings (#9363) | types/helpers/helpers.math.d.ts | @@ -1,5 +1,5 @@
export function log10(x: number): number;
-export function isNumber(v: any): boolean;
+export function isNumber(v: unknown): boolean;
export function almostEquals(x: number, y: number, epsilon: number): boolean;
export function almostWhole(x: number, epsilon: number): number;
export function sign(x:... | true |
Other | chartjs | Chart.js | d661bd788b51ae6a5444d3148f15e94af3e72e68.json | Resolve warnings from typings (#9363) | types/index.esm.d.ts | @@ -1156,7 +1156,7 @@ export interface CoreScaleOptions {
afterUpdate(axis: Scale): void;
}
-export interface Scale<O extends CoreScaleOptions = CoreScaleOptions> extends Element<{}, O>, LayoutItem {
+export interface Scale<O extends CoreScaleOptions = CoreScaleOptions> extends Element<unknown, O>, LayoutItem {
... | true |
Other | chartjs | Chart.js | d661bd788b51ae6a5444d3148f15e94af3e72e68.json | Resolve warnings from typings (#9363) | types/utils.d.ts | @@ -1,3 +1,4 @@
+/* eslint-disable @typescript-eslint/ban-types */
// DeepPartial implementation taken from the utility-types NPM package, which is
// Copyright (c) 2016 Piotr Witek <piotrek.witek@gmail.com> (http://piotrwitek.github.io)
@@ -9,10 +10,11 @@ export type DeepPartial<T> = T extends Function
: T exte... | true |
Other | chartjs | Chart.js | 124581a679fa9e048defedc245c7f41ac90c448a.json | Add type tests for float bar / object data arrays (#9348) | types/tests/data_types.ts | @@ -0,0 +1,20 @@
+import { Chart } from '../index.esm';
+
+const chart = new Chart('chart', {
+ type: 'bar',
+ data: {
+ labels: ['1', '2', '3'],
+ datasets: [{ data: [[1, 2], [1, 2], [1, 2]] }],
+ }
+});
+
+const chart2 = new Chart('chart2', {
+ type: 'bar',
+ data: {
+ datasets: [{
+ data: [{ id: '... | false |
Other | chartjs | Chart.js | 760fcff6fa7c9228fbaa58a5dcefaa287f5c0381.json | Fix typing of the isoWeekday field (#9330) | types/index.esm.d.ts | @@ -3025,7 +3025,7 @@ export type TimeScaleOptions = CartesianScaleOptions & {
* If `number`, the index of the first day of the week (0 - Sunday, 6 - Saturday).
* @default false
*/
- isoWeekday: false | number;
+ isoWeekday: boolean | number;
/**
* Sets how different time units are di... | false |
Other | chartjs | Chart.js | e5dee9f88e021cfe11ebced3ddb013ed5c6d679a.json | Fix comma causing Terser issue (#9326) | src/scales/scale.linearbase.js | @@ -98,7 +98,7 @@ function generateTicks(generationOptions, dataRange) {
// until this point
const decimalPlaces = Math.max(
_decimalPlaces(spacing),
- _decimalPlaces(niceMin),
+ _decimalPlaces(niceMin)
);
factor = Math.pow(10, isNullOrUndef(precision) ? decimalPlaces : precision);
niceMin = M... | false |
Other | chartjs | Chart.js | 3bb0241dee98ead81e350a39e32a35656bd5665d.json | Fix broken link (#9315) | docs/charts/scatter.md | @@ -56,7 +56,7 @@ Namespaces:
* `options.elements.point` - options for all [point elements](../configuration/elements.md#point-configuration)
* `options` - options for the whole chart
-The scatter chart supports all of the same properties as the [line chart](./charts/line.md#dataset-properties).
+The scatter chart ... | false |
Other | chartjs | Chart.js | ed73dce18bd5a2d523409d1fcaadaf2bcdd1d89c.json | Docs: describe catching events with plugin (#9296) | docs/configuration/interactions.md | @@ -56,6 +56,30 @@ var chart = new Chart(ctx, {
});
```
+Events that do not fire over chartArea, like `mouseout`, can be captured using a simple plugin:
+
+```javascript
+var chart = new Chart(ctx, {
+ type: 'line',
+ data: data,
+ options: {
+ // these are the default events:
+ // events: ['mousemove', 'm... | false |
Other | chartjs | Chart.js | 2768c7dea7b7934fc464f551ac50bdec13574bb0.json | Fix type definitions for `getPixelForValue` (#9263)
Update docs: From what I can tell, the `index` parameter was re-introduced as part of the new `normalized` option. | docs/developers/axes.md | @@ -90,9 +90,8 @@ To work with Chart.js, custom scale types must implement the following interface
// Get the pixel (x coordinate for horizontal axis, y coordinate for vertical axis) for a given value
// @param value : the value to get the pixel for
- // @param index : index into the data array of the va... | true |
Other | chartjs | Chart.js | 2768c7dea7b7934fc464f551ac50bdec13574bb0.json | Fix type definitions for `getPixelForValue` (#9263)
Update docs: From what I can tell, the `index` parameter was re-introduced as part of the new `normalized` option. | docs/getting-started/v3-migration.md | @@ -467,7 +467,7 @@ The APIs listed in this section have changed in signature or behaviour from vers
#### Changed in Scales
* `Scale.getLabelForIndex` was replaced by `scale.getLabelForValue`
-* `Scale.getPixelForValue` now has only one parameter. For the `TimeScale` that parameter must be millis since the epoch
+*... | true |
Other | chartjs | Chart.js | 2768c7dea7b7934fc464f551ac50bdec13574bb0.json | Fix type definitions for `getPixelForValue` (#9263)
Update docs: From what I can tell, the `index` parameter was re-introduced as part of the new `normalized` option. | types/index.esm.d.ts | @@ -1219,7 +1219,7 @@ export interface Scale<O extends CoreScaleOptions = CoreScaleOptions> extends El
* @param {number} [index]
* @return {number}
*/
- getPixelForValue(value: number, index: number): number;
+ getPixelForValue(value: number, index?: number): number;
/**
* Used to get the data va... | true |
Other | chartjs | Chart.js | 54da5341f19c6b551a38d65f2e2835e372ec4dbb.json | Docs: Add copy button to code blocks (#9262) | docs/.vuepress/config.js | @@ -29,6 +29,7 @@ module.exports = {
{base: '/samples', alternative: ['bar/vertical']},
],
}],
+ ['vuepress-plugin-code-copy', true],
[
'vuepress-plugin-typedoc',
{ | true |
Other | chartjs | Chart.js | 54da5341f19c6b551a38d65f2e2835e372ec4dbb.json | Docs: Add copy button to code blocks (#9262) | package-lock.json | @@ -6,7 +6,7 @@
"packages": {
"": {
"name": "chart.js",
- "version": "3.3.0",
+ "version": "3.3.1",
"license": "MIT",
"devDependencies": {
"@kurkle/color": "^0.1.9",
@@ -57,6 +57,7 @@
"typescript": "~4.1.0",
"vue-tabs-component": "^1.5.0",
"vuep... | true |
Other | chartjs | Chart.js | 54da5341f19c6b551a38d65f2e2835e372ec4dbb.json | Docs: Add copy button to code blocks (#9262) | package.json | @@ -97,6 +97,7 @@
"typescript": "~4.1.0",
"vue-tabs-component": "^1.5.0",
"vuepress": "^1.8.2",
+ "vuepress-plugin-code-copy": "^1.0.6",
"vuepress-plugin-flexsearch": "^0.1.0",
"vuepress-plugin-redirect": "^1.2.5",
"vuepress-plugin-tabs": "^0.3.0", | true |
Other | chartjs | Chart.js | 9c5a1aabce16d48721464c23452ca2d1b652ae27.json | Simplify financial sample (#7070) | samples/samples.js | @@ -157,6 +157,9 @@
}, {
title: 'Center Positioning',
path: 'scales/axis-center-position.html'
+ }, {
+ title: 'Custom major ticks',
+ path: 'scales/financial.html'
}]
}, {
title: 'Legend',
@@ -239,9 +242,6 @@
}, {
title: 'Advanced',
items: [{
- title: 'Custom minor and major ticks',
-... | true |
Other | chartjs | Chart.js | 9c5a1aabce16d48721464c23452ca2d1b652ae27.json | Simplify financial sample (#7070) | samples/scales/financial.html | @@ -62,12 +62,17 @@
return date.hour() < 9 || (date.hour() === 9 && date.minute() < 30);
}
+
+ function after4pm(date) {
+ return date.hour() > 16 || (date.hour() === 16 && date.minute() > 0);
+ }
+
// Returns true if outside 9:30am-4pm on a weekday
function outsideMarketHours(date) {
if ... | true |
Other | chartjs | Chart.js | 6affaa2a73429da1a1b990ff1c726dc317148931.json | Convert controllers to ES6 classes (#7061) | src/controllers/controller.bar.js | @@ -182,49 +182,36 @@ function isFloatBar(custom) {
return custom && custom.barStart !== undefined && custom.barEnd !== undefined;
}
-export default DatasetController.extend({
+class BarController extends DatasetController {
- dataElementType: Rectangle,
-
- /**
- * @private
- */
- _dataElementOptions: [
- 'b... | true |
Other | chartjs | Chart.js | 6affaa2a73429da1a1b990ff1c726dc317148931.json | Convert controllers to ES6 classes (#7061) | src/controllers/controller.bubble.js | @@ -33,30 +33,17 @@ defaults._set('bubble', {
}
});
-export default DatasetController.extend({
- /**
- * @protected
- */
- dataElementType: Point,
+class BubbleController extends DatasetController {
- /**
- * @private
- */
- _dataElementOptions: [
- 'backgroundColor',
- 'borderColor',
- 'borderWidth',
- ... | true |
Other | chartjs | Chart.js | 6affaa2a73429da1a1b990ff1c726dc317148931.json | Convert controllers to ES6 classes (#7061) | src/controllers/controller.doughnut.js | @@ -3,7 +3,7 @@
import DatasetController from '../core/core.datasetController';
import defaults from '../core/core.defaults';
import Arc from '../elements/element.arc';
-import {isArray, noop, valueOrDefault} from '../helpers/helpers.core';
+import {isArray, valueOrDefault} from '../helpers/helpers.core';
const P... | true |
Other | chartjs | Chart.js | 6affaa2a73429da1a1b990ff1c726dc317148931.json | Convert controllers to ES6 classes (#7061) | src/controllers/controller.horizontalBar.js | @@ -42,18 +42,25 @@ defaults._set('horizontalBar', {
}
});
-export default BarController.extend({
+class HorizontalBarController extends BarController {
+
+ constructor(chart, datasetIndex) {
+ super(chart, datasetIndex);
+ }
+
/**
* @private
*/
- _getValueScaleId: function() {
+ _getValueScaleId() {
r... | true |
Other | chartjs | Chart.js | 6affaa2a73429da1a1b990ff1c726dc317148931.json | Convert controllers to ES6 classes (#7061) | src/controllers/controller.line.js | @@ -26,47 +26,13 @@ defaults._set('line', {
}
});
-export default DatasetController.extend({
+class LineController extends DatasetController {
- datasetElementType: Line,
-
- dataElementType: Point,
-
- /**
- * @private
- */
- _datasetElementOptions: [
- 'backgroundColor',
- 'borderCapStyle',
- 'borderColor... | true |
Other | chartjs | Chart.js | 6affaa2a73429da1a1b990ff1c726dc317148931.json | Convert controllers to ES6 classes (#7061) | src/controllers/controller.polarArea.js | @@ -90,48 +90,37 @@ function getStartAngleRadians(deg) {
return toRadians(deg) - 0.5 * Math.PI;
}
-export default DatasetController.extend({
+class PolarAreaController extends DatasetController {
- dataElementType: Arc,
-
- /**
- * @private
- */
- _dataElementOptions: [
- 'backgroundColor',
- 'borderColor',
... | true |
Other | chartjs | Chart.js | 6affaa2a73429da1a1b990ff1c726dc317148931.json | Convert controllers to ES6 classes (#7061) | src/controllers/controller.radar.js | @@ -20,60 +20,30 @@ defaults._set('radar', {
}
});
-export default DatasetController.extend({
- datasetElementType: Line,
+class RadarController extends DatasetController {
- dataElementType: Point,
-
- /**
- * @private
- */
- _datasetElementOptions: [
- 'backgroundColor',
- 'borderWidth',
- 'borderColor',
... | true |
Other | chartjs | Chart.js | 93757a53e5d47061e31190829c28b8f5e6e5681c.json | Fix legend title drawing + update sample (#7060) | samples/legend/title.html | @@ -2,7 +2,7 @@
<html>
<head>
- <title>Legend Positions</title>
+ <title>Legend Title Positions</title>
<script src="../../dist/Chart.min.js"></script>
<script src="../utils.js"></script>
<style> | true |
Other | chartjs | Chart.js | 93757a53e5d47061e31190829c28b8f5e6e5681c.json | Fix legend title drawing + update sample (#7060) | src/plugins/plugin.legend.js | @@ -513,7 +513,7 @@ class Legend extends Element {
return;
}
- const rtlHelper = getRtlAdapter(opts.rtl, me.left, me.minSize.width);
+ const rtlHelper = getRtlAdapter(opts.rtl, me.left, me._minSize.width);
const ctx = me.ctx;
const fontColor = valueOrDefault(titleOpts.fontColor, defaults.fontColor);
... | true |
Other | chartjs | Chart.js | 1c18a74ea08f02160d1e4ce823a5cde1e2e49a2f.json | Fix some JSDoc errors (#7026)
* Fix some JSDoc errors
* Fix helpers.dom JSDoc errors
* Add scale JSDoc errors
* Address review comment
* Fix additional errors
* Document optional parameters
* JSDoc fixes for datasetController
* Remove undefined | src/core/core.controller.js | @@ -981,7 +981,7 @@ class Chart {
/**
* Handle an event
* @private
- * @param {IEvent} event the event to handle
+ * @param {IEvent} e the event to handle
* @return {boolean} true if the chart needs to re-render
*/
handleEvent(e) { | true |
Other | chartjs | Chart.js | 1c18a74ea08f02160d1e4ce823a5cde1e2e49a2f.json | Fix some JSDoc errors (#7026)
* Fix some JSDoc errors
* Fix helpers.dom JSDoc errors
* Add scale JSDoc errors
* Address review comment
* Fix additional errors
* Document optional parameters
* JSDoc fixes for datasetController
* Remove undefined | src/core/core.datasetController.js | @@ -461,7 +461,7 @@ helpers.extend(DatasetController.prototype, {
// Re-sync meta data in case the user replaced the data array or if we missed
// any updates and so make sure that we handle number of datapoints changing.
- me.resyncElements(dataChanged | labelsChanged | scaleChanged | stackChanged);
+ me.res... | true |
Other | chartjs | Chart.js | 1c18a74ea08f02160d1e4ce823a5cde1e2e49a2f.json | Fix some JSDoc errors (#7026)
* Fix some JSDoc errors
* Fix helpers.dom JSDoc errors
* Add scale JSDoc errors
* Address review comment
* Fix additional errors
* Document optional parameters
* JSDoc fixes for datasetController
* Remove undefined | src/core/core.interaction.js | @@ -6,7 +6,7 @@ import {_lookup, _rlookup} from '../helpers/helpers.collection';
/**
* Helper function to get relative position for an event
- * @param {Event|IEvent} event - The event to get the position for
+ * @param {Event|IEvent} e - The event to get the position for
* @param {Chart} chart - The chart
* @... | true |
Other | chartjs | Chart.js | 1c18a74ea08f02160d1e4ce823a5cde1e2e49a2f.json | Fix some JSDoc errors (#7026)
* Fix some JSDoc errors
* Fix helpers.dom JSDoc errors
* Add scale JSDoc errors
* Address review comment
* Fix additional errors
* Document optional parameters
* JSDoc fixes for datasetController
* Remove undefined | src/core/core.scale.js | @@ -299,7 +299,7 @@ class Scale extends Element {
* Get the padding needed for the scale
* @method getPadding
* @private
- * @returns {Padding} the necessary padding
+ * @returns {object} the necessary padding
*/
getPadding() {
const me = this;
@@ -491,6 +491,9 @@ class Scale extends Element {
befo... | true |
Other | chartjs | Chart.js | 1c18a74ea08f02160d1e4ce823a5cde1e2e49a2f.json | Fix some JSDoc errors (#7026)
* Fix some JSDoc errors
* Fix helpers.dom JSDoc errors
* Add scale JSDoc errors
* Address review comment
* Fix additional errors
* Document optional parameters
* JSDoc fixes for datasetController
* Remove undefined | src/helpers/helpers.dom.js | @@ -39,6 +39,7 @@ function parseMaxStyle(styleValue, node, parentProperty) {
* @param {HTMLElement} domNode - the node to check the constraint on
* @param {string} maxStyle - the style that defines the maximum for the direction we are using ('max-width' / 'max-height')
* @param {string} percentageProperty - prope... | true |
Other | chartjs | Chart.js | 1c18a74ea08f02160d1e4ce823a5cde1e2e49a2f.json | Fix some JSDoc errors (#7026)
* Fix some JSDoc errors
* Fix helpers.dom JSDoc errors
* Add scale JSDoc errors
* Address review comment
* Fix additional errors
* Document optional parameters
* JSDoc fixes for datasetController
* Remove undefined | src/platform/platform.base.js | @@ -16,15 +16,15 @@ export default class BasePlatform {
* @param {object} options - The chart options
* @returns {CanvasRenderingContext2D} context2d instance
*/
- acquireContext() {}
+ acquireContext(canvas, options) {} // eslint-disable-line no-unused-vars
/**
* Called at chart destruction time, relea... | true |
Other | chartjs | Chart.js | 1c18a74ea08f02160d1e4ce823a5cde1e2e49a2f.json | Fix some JSDoc errors (#7026)
* Fix some JSDoc errors
* Fix helpers.dom JSDoc errors
* Add scale JSDoc errors
* Address review comment
* Fix additional errors
* Document optional parameters
* JSDoc fixes for datasetController
* Remove undefined | src/plugins/plugin.filler.js | @@ -47,7 +47,7 @@ function parseFillOption(line) {
// @todo if (fill[0] === '#')
function decodeFill(line, index, count) {
const fill = parseFillOption(line);
- let target = parseFloat(fill, 10);
+ let target = parseFloat(fill);
if (isFinite(target) && Math.floor(target) === target) {
if (fill[0] === '-' || ... | true |
Other | chartjs | Chart.js | 1c18a74ea08f02160d1e4ce823a5cde1e2e49a2f.json | Fix some JSDoc errors (#7026)
* Fix some JSDoc errors
* Fix helpers.dom JSDoc errors
* Add scale JSDoc errors
* Address review comment
* Fix additional errors
* Document optional parameters
* JSDoc fixes for datasetController
* Remove undefined | src/plugins/plugin.legend.js | @@ -83,7 +83,7 @@ defaults._set('legend', {
/**
* Helper function to get the box width based on the usePointStyle option
- * @param {object} labelopts - the label options on the legend
+ * @param {object} labelOpts - the label options on the legend
* @param {number} fontSize - the label font size
* @return {nu... | true |
Other | chartjs | Chart.js | 1c18a74ea08f02160d1e4ce823a5cde1e2e49a2f.json | Fix some JSDoc errors (#7026)
* Fix some JSDoc errors
* Fix helpers.dom JSDoc errors
* Add scale JSDoc errors
* Address review comment
* Fix additional errors
* Document optional parameters
* JSDoc fixes for datasetController
* Remove undefined | src/plugins/plugin.tooltip.js | @@ -199,7 +199,7 @@ function pushOrConcat(base, toPush) {
/**
* Returns array of strings split by newline
- * @param {string} value - The value to split by newline.
+ * @param {string} str - The value to split by newline.
* @returns {string[]} value if newline present - Returned from String split() method
* @f... | true |
Other | chartjs | Chart.js | 1c18a74ea08f02160d1e4ce823a5cde1e2e49a2f.json | Fix some JSDoc errors (#7026)
* Fix some JSDoc errors
* Fix helpers.dom JSDoc errors
* Add scale JSDoc errors
* Address review comment
* Fix additional errors
* Document optional parameters
* JSDoc fixes for datasetController
* Remove undefined | src/scales/scale.linearbase.js | @@ -37,7 +37,7 @@ function niceNum(range, round) {
* Generate a set of linear ticks
* @param generationOptions the options used to generate the ticks
* @param dataRange the range of the data
- * @returns {number[]} array of tick values
+ * @returns {object[]} array of tick objects
*/
function generateTicks(gen... | true |
Other | chartjs | Chart.js | 1c18a74ea08f02160d1e4ce823a5cde1e2e49a2f.json | Fix some JSDoc errors (#7026)
* Fix some JSDoc errors
* Fix helpers.dom JSDoc errors
* Add scale JSDoc errors
* Address review comment
* Fix additional errors
* Document optional parameters
* JSDoc fixes for datasetController
* Remove undefined | src/scales/scale.logarithmic.js | @@ -19,7 +19,7 @@ function finiteOrDefault(value, def) {
* Generate a set of logarithmic ticks
* @param generationOptions the options used to generate the ticks
* @param dataRange the range of the data
- * @returns {number[]} array of tick values
+ * @returns {object[]} array of tick objects
*/
function genera... | true |
Other | chartjs | Chart.js | 1c18a74ea08f02160d1e4ce823a5cde1e2e49a2f.json | Fix some JSDoc errors (#7026)
* Fix some JSDoc errors
* Fix helpers.dom JSDoc errors
* Add scale JSDoc errors
* Address review comment
* Fix additional errors
* Document optional parameters
* JSDoc fixes for datasetController
* Remove undefined | src/scales/scale.time.js | @@ -430,9 +430,9 @@ function getLabelBounds(scale) {
/**
* Return subset of `timestamps` between `min` and `max`.
* Timestamps are assumend to be in sorted order.
- * @param {int[]} timestamps - array of timestamps
- * @param {int} min - min value (timestamp)
- * @param {int} max - max value (timestamp)
+ * @param... | true |
Other | chartjs | Chart.js | 7cd77e779d4131cce3f2ba4c758fff7ad5a1b96b.json | Update imports for elements (#7049) | src/elements/element.point.js | @@ -2,7 +2,7 @@
import defaults from '../core/core.defaults';
import Element from '../core/core.element';
-import helpers from '../helpers';
+import {_isPointInArea, drawPoint} from '../helpers/helpers.canvas';
const defaultColor = defaults.color;
@@ -70,11 +70,11 @@ class Point extends Element {
}
// ... | true |
Other | chartjs | Chart.js | 7cd77e779d4131cce3f2ba4c758fff7ad5a1b96b.json | Update imports for elements (#7049) | src/elements/element.rectangle.js | @@ -2,7 +2,7 @@
import defaults from '../core/core.defaults';
import Element from '../core/core.element';
-import helpers from '../helpers';
+import {isObject} from '../helpers/helpers.core';
const defaultColor = defaults.color;
@@ -79,7 +79,7 @@ function parseBorderWidth(bar, maxW, maxH) {
var skip = parseB... | true |
Other | chartjs | Chart.js | 771fe520957199b32a26205c14f4816002842bcb.json | Update legend imports (#7048) | src/plugins/plugin.legend.js | @@ -2,11 +2,11 @@
import defaults from '../core/core.defaults';
import Element from '../core/core.element';
-import helpers from '../helpers';
import layouts from '../core/core.layouts';
-
-const getRtlHelper = helpers.rtl.getRtlAdapter;
-const valueOrDefault = helpers.valueOrDefault;
+import {drawPoint} from '../... | false |
Other | chartjs | Chart.js | 251f3832bc472f530747a66131200045c51032af.json | Remove extra call to _getLabelCapacity (#6999) | src/scales/scale.time.js | @@ -230,11 +230,13 @@ function determineMajorUnit(unit) {
* Important: this method can return ticks outside the min and max range, it's the
* responsibility of the calling code to clamp values if needed.
*/
-function generate(scale, min, max, capacity) {
+function generate(scale) {
const adapter = scale._adapte... | false |
Other | chartjs | Chart.js | 26536f8849335f17f3958d7eb544ad811732937e.json | Fix bug in opacity handling (#7047) | src/plugins/plugin.tooltip.js | @@ -925,7 +925,7 @@ class Tooltip extends Element {
};
// IE11/Edge does not like very small opacities, so snap to 0
- opacity = Math.abs(opacity < 1e-3) ? 0 : opacity;
+ opacity = Math.abs(opacity) < 1e-3 ? 0 : opacity;
// Truthy/falsey value for empty tooltip
var hasTooltipContent = me.title.length ... | false |
Other | chartjs | Chart.js | 13851c0209a1478184743d290b2ec07fc838a866.json | Remove unnecessary check for color library (#7043) | src/helpers/index.js | @@ -11,11 +11,7 @@ import * as options from './helpers.options';
import * as math from './helpers.math';
import * as rtl from './helpers.rtl';
-const colorHelper = !color ?
- function(value) {
- console.error('Color.js not found!');
- return value;
- } :
+const colorHelper =
function(value) {
if (value insta... | false |
Other | chartjs | Chart.js | a7cb59179a580f6a5c2865e0af716c3480a3b501.json | Fix typo in elements.line (#7040)
Fix typo in elements.line | src/elements/element.line.js | @@ -166,6 +166,11 @@ function fastPathSegment(ctx, line, segment, params) {
}
}
+/**
+ * @param {Line} line - the line
+ * @returns {function}
+ * @private
+ */
function _getSegmentMethod(line) {
const opts = line.options;
const borderDash = opts.borderDash && opts.borderDash.length;
@@ -271,7 +276,7 @@ class... | false |
Other | chartjs | Chart.js | d449bbc83aa5ea94ad2912d593500e561d0d94bb.json | Remove unused helpers (#7039) | docs/getting-started/v3-migration.md | @@ -91,6 +91,9 @@ Animation system was completely rewritten in Chart.js v3. Each property can now
* `helpers.addEvent`
* `helpers.aliasPixel`
* `helpers.configMerge`
+* `helpers.findIndex`
+* `helpers.findNextWhere`
+* `helpers.findPreviousWhere`
* `helpers.indexOf`
* `helpers.lineTo`
* `helpers.longestText` was ... | true |
Other | chartjs | Chart.js | d449bbc83aa5ea94ad2912d593500e561d0d94bb.json | Remove unused helpers (#7039) | src/helpers/index.js | @@ -36,43 +36,6 @@ export default {
math,
rtl,
- findIndex: Array.prototype.findIndex ?
- function(array, callback, scope) {
- return array.findIndex(callback, scope);
- } :
- function(array, callback, scope) {
- scope = scope === undefined ? array : scope;
- for (var i = 0, ilen = array.length; i < ilen... | true |
Other | chartjs | Chart.js | d449bbc83aa5ea94ad2912d593500e561d0d94bb.json | Remove unused helpers (#7039) | test/specs/core.helpers.tests.js | @@ -6,19 +6,6 @@ describe('Core helper tests', function() {
helpers = window.Chart.helpers;
});
- it('should filter an array', function() {
- var data = [-10, 0, 6, 0, 7];
- var callback = function(item) {
- return item > 2;
- };
- expect(helpers.findNextWhere(data, callback)).toEqual(6);
- expect(helpers... | true |
Other | chartjs | Chart.js | 4462a2c950b989aabf6d5c50b20b6b79a9e6a2ba.json | Reduce requestAnimationFrame polyfill (#7033)
* Reduce requestAnimationFrame polyfill
* Remove another unnecessary polyfill | src/helpers/index.js | @@ -101,21 +101,14 @@ export default {
return niceFraction * Math.pow(10, exponent);
},
- // Request animation polyfill - https://www.paulirish.com/2011/requestanimationframe-for-smart-animating/
+ // Request animation polyfill
requestAnimFrame: (function() {
if (typeof window === 'undefined') {
return ... | false |
Other | chartjs | Chart.js | dac52d189e362fa6463bce2f3985b2cd934bb03d.json | Convert the DateAdapter to ES6 (#7032) | src/core/core.adapters.js | @@ -6,13 +6,13 @@
'use strict';
-import helpers from '../helpers';
+import {extend} from '../helpers/helpers.core';
+/**
+ * @return {*}
+ */
function abstract() {
- throw new Error(
- 'This method is not implemented: either no adapter can ' +
- 'be found or an incomplete integration was provided.'
- );
+ thr... | false |
Other | chartjs | Chart.js | c667a9ef8571d179a552f6013af2cc108f1d2ac5.json | Move text helpers and reduce scope of imports (#7028) | docs/getting-started/v3-migration.md | @@ -93,7 +93,9 @@ Animation system was completely rewritten in Chart.js v3. Each property can now
* `helpers.configMerge`
* `helpers.indexOf`
* `helpers.lineTo`
+* `helpers.longestText` was moved to the `helpers.canvas` namespace and made private
* `helpers.max`
+* `helpers.measureText` was moved to the `helpers.ca... | true |
Other | chartjs | Chart.js | c667a9ef8571d179a552f6013af2cc108f1d2ac5.json | Move text helpers and reduce scope of imports (#7028) | src/core/core.scale.js | @@ -2,16 +2,12 @@
import defaults from './core.defaults';
import Element from './core.element';
-import helpers from '../helpers';
+import {_alignPixel, _measureText} from '../helpers/helpers.canvas';
+import {callback as call, each, extend, isArray, isFinite, isNullOrUndef, isObject, valueOrDefault} from '../helpe... | true |
Other | chartjs | Chart.js | c667a9ef8571d179a552f6013af2cc108f1d2ac5.json | Move text helpers and reduce scope of imports (#7028) | src/core/core.ticks.js | @@ -1,7 +1,7 @@
'use strict';
-import helpers from '../helpers';
-const math = helpers.math;
+import {isArray} from '../helpers/helpers.core';
+import {log10} from '../helpers/helpers.math';
/**
* Namespace to hold static tick generation functions
@@ -20,15 +20,15 @@ export default {
* @return {string|strin... | true |
Other | chartjs | Chart.js | c667a9ef8571d179a552f6013af2cc108f1d2ac5.json | Move text helpers and reduce scope of imports (#7028) | src/helpers/helpers.canvas.js | @@ -1,5 +1,7 @@
'use strict';
+import {isArray} from './helpers.core';
+
const PI = Math.PI;
const RAD_PER_DEG = PI / 180;
const DOUBLE_PI = PI * 2;
@@ -10,6 +12,69 @@ const TWO_THIRDS_PI = PI * 2 / 3;
/**
* @namespace Chart.helpers.canvas
*/
+
+/**
+ * @private
+ */
+export function _measureText(ctx, data, ... | true |
Other | chartjs | Chart.js | c667a9ef8571d179a552f6013af2cc108f1d2ac5.json | Move text helpers and reduce scope of imports (#7028) | src/helpers/index.js | @@ -26,18 +26,6 @@ const colorHelper = !color ?
return color(value);
};
-function measureText(ctx, data, gc, longest, string) {
- var textWidth = data[string];
- if (!textWidth) {
- textWidth = data[string] = ctx.measureText(string).width;
- gc.push(string);
- }
- if (textWidth > longest) {
- longest = textWi... | true |
Other | chartjs | Chart.js | c667a9ef8571d179a552f6013af2cc108f1d2ac5.json | Move text helpers and reduce scope of imports (#7028) | src/scales/scale.radialLinear.js | @@ -2,6 +2,7 @@
import defaults from '../core/core.defaults';
import helpers from '../helpers/index';
+import {_longestText} from '../helpers/helpers.canvas';
import {isNumber, toDegrees, toRadians, _normalizeAngle} from '../helpers/helpers.math';
import LinearScaleBase from './scale.linearbase';
import Ticks fr... | true |
Other | chartjs | Chart.js | c667a9ef8571d179a552f6013af2cc108f1d2ac5.json | Move text helpers and reduce scope of imports (#7028) | test/specs/core.helpers.tests.js | @@ -27,57 +27,6 @@ describe('Core helper tests', function() {
expect(helpers.uid()).toBe(uid + 3);
});
- it('should return the width of the longest text in an Array and 2D Array', function() {
- var context = window.createMockContext();
- var font = "normal 12px 'Helvetica Neue', 'Helvetica', 'Arial', sans-ser... | true |
Other | chartjs | Chart.js | c667a9ef8571d179a552f6013af2cc108f1d2ac5.json | Move text helpers and reduce scope of imports (#7028) | test/specs/helpers.canvas.tests.js | @@ -36,4 +36,55 @@ describe('Chart.helpers.canvas', function() {
expect(isPointInArea({x: 0, y: 256.5}, area)).toBe(false);
});
});
+
+ it('should return the width of the longest text in an Array and 2D Array', function() {
+ var context = window.createMockContext();
+ var font = "normal 12px 'Helvetica Neue... | true |
Other | chartjs | Chart.js | aefbd6f9f34a325a36c2c57c96904f15d06c3d51.json | Remove unused variable (#7031) | src/scales/scale.time.js | @@ -609,7 +609,6 @@ class TimeScale extends Scale {
: determineUnitForFormatting(me, ticks.length, timeOpts.minUnit, me.min, me.max));
me._majorUnit = !tickOpts.major.enabled || me._unit === 'year' ? undefined
: determineMajorUnit(me._unit);
- me._numIndices = ticks.length;
me._table = buildLookupTable(g... | false |
Other | chartjs | Chart.js | cb6d7f80d133f159df866548be72c642e6f82c62.json | Fix binarySearch for empty dataset (#7023) | src/core/core.interaction.js | @@ -52,7 +52,7 @@ function evaluateAllVisibleItems(chart, handler) {
function binarySearch(metaset, axis, value, intersect) {
const {controller, data, _sorted} = metaset;
const iScale = controller._cachedMeta.iScale;
- if (iScale && axis === iScale.axis && _sorted) {
+ if (iScale && axis === iScale.axis && _sorted... | false |
Other | chartjs | Chart.js | fe3931b0775a91b1661df8ca708c572d571f4b73.json | Reduce scope of imports (#7000) | src/controllers/controller.bar.js | @@ -2,7 +2,7 @@
import DatasetController from '../core/core.datasetController';
import defaults from '../core/core.defaults';
-import elements from '../elements';
+import Rectangle from '../elements/element.rectangle';
import helpers from '../helpers';
const valueOrDefault = helpers.valueOrDefault;
@@ -184,7 +1... | true |
Other | chartjs | Chart.js | fe3931b0775a91b1661df8ca708c572d571f4b73.json | Reduce scope of imports (#7000) | src/controllers/controller.bubble.js | @@ -2,7 +2,7 @@
import DatasetController from '../core/core.datasetController';
import defaults from '../core/core.defaults';
-import elements from '../elements';
+import Point from '../elements/element.point';
import helpers from '../helpers';
const resolve = helpers.options.resolve;
@@ -38,7 +38,7 @@ export d... | true |
Other | chartjs | Chart.js | fe3931b0775a91b1661df8ca708c572d571f4b73.json | Reduce scope of imports (#7000) | src/controllers/controller.doughnut.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 valueOrDefault = helpers.valueOrDefault;
@@ -100,7 +100,7 @@ defa... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.