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 | 766ca49cd094562f3a2e870e0c2b162ee16c8189.json | Extend eslint to test files (#3473)
* Add eslint to test files
* Fix mockContext for tests
* Make formatting look better for nested objects | test/controller.bar.tests.js | @@ -5,8 +5,8 @@ describe('Bar controller tests', function() {
type: 'bar',
data: {
datasets: [
- { data: [] },
- { data: [] }
+ {data: []},
+ {data: []}
],
labels: []
}
@@ -30,8 +30,8 @@ describe('Bar controller tests', function() {
type: 'bar',
data: {
datasets: ... | true |
Other | chartjs | Chart.js | 766ca49cd094562f3a2e870e0c2b162ee16c8189.json | Extend eslint to test files (#3473)
* Add eslint to test files
* Fix mockContext for tests
* Make formatting look better for nested objects | test/controller.bubble.tests.js | @@ -133,10 +133,11 @@ describe('Bubble controller tests', function() {
var meta = chart.getDatasetMeta(0);
- [ { r: 5, x: 38, y: 32 },
- { r: 1, x: 189, y: 484 },
- { r: 2, x: 341, y: 461 },
- { r: 1, x: 492, y: 32 }
+ [
+ {r: 5, x: 38, y: 32},
+ {r: 1, x: 189, y: 484},
+ {r: 2, x: 341, y: 461}... | true |
Other | chartjs | Chart.js | 766ca49cd094562f3a2e870e0c2b162ee16c8189.json | Extend eslint to test files (#3473)
* Add eslint to test files
* Fix mockContext for tests
* Make formatting look better for nested objects | test/controller.doughnut.tests.js | @@ -78,10 +78,11 @@ describe('Doughnut controller tests', function() {
expect(meta.data.length).toBe(4);
- [ { c: 0 },
- { c: 0 },
- { c: 0, },
- { c: 0 }
+ [
+ {c: 0},
+ {c: 0},
+ {c: 0},
+ {c: 0}
].forEach(function(expected, i) {
expect(meta.data[i]._model.x).toBeCloseToPixel(2... | true |
Other | chartjs | Chart.js | 766ca49cd094562f3a2e870e0c2b162ee16c8189.json | Extend eslint to test files (#3473)
* Add eslint to test files
* Fix mockContext for tests
* Make formatting look better for nested objects | test/controller.line.tests.js | @@ -165,12 +165,12 @@ describe('Line controller tests', function() {
var chart = window.acquireChart({
type: 'line',
data: {
- datasets: [{
- data: [10, 15, 0, -4],
- label: 'dataset',
- xAxisID: 'firstXScaleID',
- yAxisID: 'firstYScaleID'
- }],
+ datasets: [{
+ data: [10, ... | true |
Other | chartjs | Chart.js | 766ca49cd094562f3a2e870e0c2b162ee16c8189.json | Extend eslint to test files (#3473)
* Add eslint to test files
* Fix mockContext for tests
* Make formatting look better for nested objects | test/controller.polarArea.tests.js | @@ -2,14 +2,14 @@
describe('Polar area controller tests', function() {
it('should be constructed', function() {
var chart = window.acquireChart({
- type: 'polarArea',
- data: {
- datasets: [
- { data: [] },
- { data: [] }
- ],
- labels: []
- }
+ type: 'polarArea',
+ data: {
+ datasets: [
+ ... | true |
Other | chartjs | Chart.js | 766ca49cd094562f3a2e870e0c2b162ee16c8189.json | Extend eslint to test files (#3473)
* Add eslint to test files
* Fix mockContext for tests
* Make formatting look better for nested objects | test/controller.radar.tests.js | @@ -32,8 +32,6 @@ describe('Radar controller tests', function() {
}
});
- var controller = new Chart.controllers.radar(chart, 0);
-
var meta = chart.getDatasetMeta(0);
expect(meta.dataset instanceof Chart.elements.Line).toBe(true); // line element
expect(meta.data.length).toBe(4); // 4 points created... | true |
Other | chartjs | Chart.js | 766ca49cd094562f3a2e870e0c2b162ee16c8189.json | Extend eslint to test files (#3473)
* Add eslint to test files
* Fix mockContext for tests
* Make formatting look better for nested objects | test/core.element.tests.js | @@ -25,9 +25,9 @@ describe('Core element tests', function() {
element._model.numberProp = 100;
element._model.numberProp2 = 250;
element._model._underscoreProp = 200;
- element._model.stringProp = 'def'
+ element._model.stringProp = 'def';
element._model.newStringProp = 'newString';
- element._model.colo... | true |
Other | chartjs | Chart.js | 766ca49cd094562f3a2e870e0c2b162ee16c8189.json | Extend eslint to test files (#3473)
* Add eslint to test files
* Fix mockContext for tests
* Make formatting look better for nested objects | test/core.helpers.tests.js | @@ -7,7 +7,7 @@ describe('Core helper tests', function() {
});
it('should iterate over an array and pass the extra data to that function', function() {
- var testData = [0, 9, "abc"];
+ var testData = [0, 9, 'abc'];
var scope = {}; // fake out the scope and ensure that 'this' is the correct thing
helper... | true |
Other | chartjs | Chart.js | 766ca49cd094562f3a2e870e0c2b162ee16c8189.json | Extend eslint to test files (#3473)
* Add eslint to test files
* Fix mockContext for tests
* Make formatting look better for nested objects | test/core.interaction.tests.js | @@ -115,7 +115,7 @@ describe('Core.Interaction', function() {
currentTarget: node
};
- var elements = Chart.Interaction.modes.index(chartInstance, evt, { intersect: true });
+ var elements = Chart.Interaction.modes.index(chartInstance, evt, {intersect: true});
expect(elements).toEqual([point, meta1.d... | true |
Other | chartjs | Chart.js | 766ca49cd094562f3a2e870e0c2b162ee16c8189.json | Extend eslint to test files (#3473)
* Add eslint to test files
* Fix mockContext for tests
* Make formatting look better for nested objects | test/core.layoutService.tests.js | @@ -5,7 +5,7 @@ describe('Test the layout service', function() {
type: 'bar',
data: {
datasets: [
- { data: [10, 5, 0, 25, 78, -10] }
+ {data: [10, 5, 0, 25, 78, -10]}
],
labels: ['tick1', 'tick2', 'tick3', 'tick4', 'tick5', 'tick6']
},
@@ -53,7 +53,7 @@ describe('Test the layout serv... | true |
Other | chartjs | Chart.js | 766ca49cd094562f3a2e870e0c2b162ee16c8189.json | Extend eslint to test files (#3473)
* Add eslint to test files
* Fix mockContext for tests
* Make formatting look better for nested objects | test/core.legend.tests.js | @@ -118,20 +118,21 @@ describe('Legend block tests', function() {
expect(chart.legend.legendHitBoxes.length).toBe(3);
- [ { h: 12, l: 101, t: 10, w: 93 },
- { h: 12, l: 205, t: 10, w: 93 },
- { h: 12, l: 308, t: 10, w: 93 }
+ [
+ {h: 12, l: 101, t: 10, w: 93},
+ {h: 12, l: 205, t: 10, w: 93},
+ {h: 1... | true |
Other | chartjs | Chart.js | 766ca49cd094562f3a2e870e0c2b162ee16c8189.json | Extend eslint to test files (#3473)
* Add eslint to test files
* Fix mockContext for tests
* Make formatting look better for nested objects | test/core.plugin.tests.js | @@ -75,24 +75,52 @@ describe('Chart.plugins', function() {
};
Chart.plugins.register(myplugin);
- Chart.plugins.notify('trigger', [{ count: 10 }]);
+ Chart.plugins.notify('trigger', [{count: 10}]);
expect(myplugin.count).toBe(10);
});
it('should return TRUE if no plugin explicitly returns FALS... | true |
Other | chartjs | Chart.js | 766ca49cd094562f3a2e870e0c2b162ee16c8189.json | Extend eslint to test files (#3473)
* Add eslint to test files
* Fix mockContext for tests
* Make formatting look better for nested objects | test/core.scaleService.tests.js | @@ -15,7 +15,7 @@ describe('Test the scale service', function() {
expect(Chart.scaleService.getScaleDefaults(type)).toEqual(jasmine.objectContaining({
testProp: true
}));
-
+
Chart.scaleService.updateScaleDefaults(type, {
testProp: 'red',
newProp: 42 | true |
Other | chartjs | Chart.js | 766ca49cd094562f3a2e870e0c2b162ee16c8189.json | Extend eslint to test files (#3473)
* Add eslint to test files
* Fix mockContext for tests
* Make formatting look better for nested objects | test/core.title.tests.js | @@ -14,14 +14,14 @@ describe('Title block tests', function() {
fontStyle: 'bold',
padding: 10,
text: ''
- })
+ });
});
it('should update correctly', function() {
var chart = {};
var options = Chart.helpers.clone(Chart.defaults.global.title);
- options.text = "My title";
+ options.text = 'M... | true |
Other | chartjs | Chart.js | 766ca49cd094562f3a2e870e0c2b162ee16c8189.json | Extend eslint to test files (#3473)
* Add eslint to test files
* Fix mockContext for tests
* Make formatting look better for nested objects | test/core.tooltip.tests.js | @@ -342,7 +342,7 @@ describe('Core.Tooltip', function() {
return 'title';
},
afterTitle: function() {
- return 'afterTitle'
+ return 'afterTitle';
},
beforeBody: function() {
return 'beforeBody';
@@ -366,7 +366,7 @@ describe('Core.Tooltip', function() {
re... | true |
Other | chartjs | Chart.js | 766ca49cd094562f3a2e870e0c2b162ee16c8189.json | Extend eslint to test files (#3473)
* Add eslint to test files
* Fix mockContext for tests
* Make formatting look better for nested objects | test/defaultConfig.tests.js | @@ -1,6 +1,6 @@
// Test the bubble chart default config
-describe("Default Configs", function() {
- describe("Bubble Chart", function() {
+describe('Default Configs', function() {
+ describe('Bubble Chart', function() {
it('should return correct tooltip strings', function() {
var config = Chart.defaults.bubble;... | true |
Other | chartjs | Chart.js | 766ca49cd094562f3a2e870e0c2b162ee16c8189.json | Extend eslint to test files (#3473)
* Add eslint to test files
* Fix mockContext for tests
* Make formatting look better for nested objects | test/element.arc.tests.js | @@ -213,4 +213,4 @@ describe('Arc element tests', function() {
args: []
}]);
});
-});
\ No newline at end of file
+}); | true |
Other | chartjs | Chart.js | 766ca49cd094562f3a2e870e0c2b162ee16c8189.json | Extend eslint to test files (#3473)
* Add eslint to test files
* Fix mockContext for tests
* Make formatting look better for nested objects | test/element.line.tests.js | @@ -2580,4 +2580,4 @@ describe('Line element tests', function() {
args: []
}]);
});
-});
\ No newline at end of file
+}); | true |
Other | chartjs | Chart.js | 766ca49cd094562f3a2e870e0c2b162ee16c8189.json | Extend eslint to test files (#3473)
* Add eslint to test files
* Fix mockContext for tests
* Make formatting look better for nested objects | test/element.point.tests.js | @@ -91,7 +91,7 @@ describe('Point element tests', function() {
y: 10
};
- expect(point.getCenterPoint()).toEqual({ x: 10, y: 10 });
+ expect(point.getCenterPoint()).toEqual({x: 10, y: 10});
});
it ('should draw correctly', function() {
@@ -275,7 +275,7 @@ describe('Point element tests', function() {
... | true |
Other | chartjs | Chart.js | 766ca49cd094562f3a2e870e0c2b162ee16c8189.json | Extend eslint to test files (#3473)
* Add eslint to test files
* Fix mockContext for tests
* Make formatting look better for nested objects | test/element.rectangle.tests.js | @@ -163,7 +163,7 @@ describe('Rectangle element tests', function() {
y: 15
};
- expect(rectangle.getCenterPoint()).toEqual({ x: 10, y: 7.5 });
+ expect(rectangle.getCenterPoint()).toEqual({x: 10, y: 7.5});
});
it ('should draw correctly', function() {
@@ -276,10 +276,10 @@ describe('Rectangle element t... | true |
Other | chartjs | Chart.js | 766ca49cd094562f3a2e870e0c2b162ee16c8189.json | Extend eslint to test files (#3473)
* Add eslint to test files
* Fix mockContext for tests
* Make formatting look better for nested objects | test/mockContext.js | @@ -1,3 +1,5 @@
+/* eslint guard-for-in: 1 */
+/* eslint camelcase: 1 */
(function() {
// Code from http://stackoverflow.com/questions/4406864/html-canvas-unit-testing
var Context = function() {
@@ -13,44 +15,56 @@
// Define properties here so that we can record each time they are set
Object.defineProperti... | true |
Other | chartjs | Chart.js | 766ca49cd094562f3a2e870e0c2b162ee16c8189.json | Extend eslint to test files (#3473)
* Add eslint to test files
* Fix mockContext for tests
* Make formatting look better for nested objects | test/scale.category.tests.js | @@ -13,20 +13,20 @@ describe('Category scale tests', function() {
display: true,
gridLines: {
- color: "rgba(0, 0, 0, 0.1)",
+ color: 'rgba(0, 0, 0, 0.1)',
drawBorder: true,
drawOnChartArea: true,
drawTicks: true, // draw ticks extending towards the label
tickMarkLength: 10,
lin... | true |
Other | chartjs | Chart.js | 766ca49cd094562f3a2e870e0c2b162ee16c8189.json | Extend eslint to test files (#3473)
* Add eslint to test files
* Fix mockContext for tests
* Make formatting look better for nested objects | test/scale.linear.tests.js | @@ -11,20 +11,20 @@ describe('Linear Scale', function() {
display: true,
gridLines: {
- color: "rgba(0, 0, 0, 0.1)",
+ color: 'rgba(0, 0, 0, 0.1)',
drawBorder: true,
drawOnChartArea: true,
drawTicks: true, // draw ticks extending towards the label
tickMarkLength: 10,
lineWidth: ... | true |
Other | chartjs | Chart.js | 766ca49cd094562f3a2e870e0c2b162ee16c8189.json | Extend eslint to test files (#3473)
* Add eslint to test files
* Fix mockContext for tests
* Make formatting look better for nested objects | test/scale.logarithmic.tests.js | @@ -10,20 +10,20 @@ describe('Logarithmic Scale tests', function() {
expect(defaultConfig).toEqual({
display: true,
gridLines: {
- color: "rgba(0, 0, 0, 0.1)",
+ color: 'rgba(0, 0, 0, 0.1)',
drawBorder: true,
drawOnChartArea: true,
drawTicks: true,
tickMarkLength: 10,
lineWidth... | true |
Other | chartjs | Chart.js | 766ca49cd094562f3a2e870e0c2b162ee16c8189.json | Extend eslint to test files (#3473)
* Add eslint to test files
* Fix mockContext for tests
* Make formatting look better for nested objects | test/scale.radialLinear.tests.js | @@ -11,21 +11,21 @@ describe('Test the radial linear scale', function() {
expect(defaultConfig).toEqual({
angleLines: {
display: true,
- color: "rgba(0, 0, 0, 0.1)",
+ color: 'rgba(0, 0, 0, 0.1)',
lineWidth: 1
},
animate: true,
display: true,
gridLines: {
- color: "rgba(0, 0, 0... | true |
Other | chartjs | Chart.js | 766ca49cd094562f3a2e870e0c2b162ee16c8189.json | Extend eslint to test files (#3473)
* Add eslint to test files
* Fix mockContext for tests
* Make formatting look better for nested objects | test/scale.time.tests.js | @@ -15,7 +15,7 @@ describe('Time scale tests', function() {
pass: result
};
}
- }
+ };
}
});
});
@@ -35,20 +35,20 @@ describe('Time scale tests', function() {
expect(defaultConfig).toEqual({
display: true,
gridLines: {
- color: "rgba(0, 0, 0, 0.1)",
+ color: 'rgba(0,... | true |
Other | chartjs | Chart.js | 4a5b5a0e7eba85ca44f658375cb0c78e6af93e5c.json | Enhance context acquisition on chart creation
Add support for creating a chart from the canvas id and prevent exceptions, at construction time, when the given item doesn't provide a valid CanvasRenderingContext2D or when the getContext API is not accessible (e.g. undefined by add-ons to prevent fingerprinting). New ja... | .gitignore | @@ -6,4 +6,5 @@
.DS_Store
.idea
+.vscode
bower.json | true |
Other | chartjs | Chart.js | 4a5b5a0e7eba85ca44f658375cb0c78e6af93e5c.json | Enhance context acquisition on chart creation
Add support for creating a chart from the canvas id and prevent exceptions, at construction time, when the given item doesn't provide a valid CanvasRenderingContext2D or when the getContext API is not accessible (e.g. undefined by add-ons to prevent fingerprinting). New ja... | docs/00-Getting-Started.md | @@ -71,6 +71,7 @@ To create a chart, we need to instantiate the `Chart` class. To do this, we need
var ctx = document.getElementById("myChart");
var ctx = document.getElementById("myChart").getContext("2d");
var ctx = $("#myChart");
+var ctx = "myChart";
```
Once you have the element or context, you're ready to ... | true |
Other | chartjs | Chart.js | 4a5b5a0e7eba85ca44f658375cb0c78e6af93e5c.json | Enhance context acquisition on chart creation
Add support for creating a chart from the canvas id and prevent exceptions, at construction time, when the given item doesn't provide a valid CanvasRenderingContext2D or when the getContext API is not accessible (e.g. undefined by add-ons to prevent fingerprinting). New ja... | src/core/core.controller.js | @@ -112,6 +112,36 @@ module.exports = function(Chart) {
delete canvas._chartjs;
}
+ /**
+ * TODO(SB) Move this method in the upcoming core.platform class.
+ */
+ function acquireContext(item, config) {
+ if (typeof item === 'string') {
+ item = document.getElementById(item);
+ } else if (item.length) {
+ ... | true |
Other | chartjs | Chart.js | 4a5b5a0e7eba85ca44f658375cb0c78e6af93e5c.json | Enhance context acquisition on chart creation
Add support for creating a chart from the canvas id and prevent exceptions, at construction time, when the given item doesn't provide a valid CanvasRenderingContext2D or when the getContext API is not accessible (e.g. undefined by add-ons to prevent fingerprinting). New ja... | src/core/core.js | @@ -3,22 +3,9 @@
module.exports = function() {
// Occupy the global variable of Chart, and create a simple base class
- var Chart = function(context, config) {
- var me = this;
-
- // Support a jQuery'd canvas element
- if (context.length && context[0].getContext) {
- context = context[0];
- }
-
- // Suppor... | true |
Other | chartjs | Chart.js | 4a5b5a0e7eba85ca44f658375cb0c78e6af93e5c.json | Enhance context acquisition on chart creation
Add support for creating a chart from the canvas id and prevent exceptions, at construction time, when the given item doesn't provide a valid CanvasRenderingContext2D or when the getContext API is not accessible (e.g. undefined by add-ons to prevent fingerprinting). New ja... | test/core.controller.tests.js | @@ -4,7 +4,75 @@ describe('Chart.Controller', function() {
setTimeout(callback, 100);
}
- describe('config', function() {
+ describe('context acquisition', function() {
+ var canvasId = 'chartjs-canvas';
+
+ beforeEach(function() {
+ var canvas = document.createElement('canvas');
+ canvas.setAttribute('id'... | true |
Other | chartjs | Chart.js | 4a5b5a0e7eba85ca44f658375cb0c78e6af93e5c.json | Enhance context acquisition on chart creation
Add support for creating a chart from the canvas id and prevent exceptions, at construction time, when the given item doesn't provide a valid CanvasRenderingContext2D or when the getContext API is not accessible (e.g. undefined by add-ons to prevent fingerprinting). New ja... | test/mockContext.js | @@ -158,54 +158,82 @@
};
}
+ function toBeValidChart() {
+ return {
+ compare: function(actual) {
+ var chart = actual && actual.chart;
+ var message = null;
+
+ if (!(actual instanceof Chart.Controller)) {
+ message = 'Expected ' + actual + ' to be an instance of Chart.Controller';
+ } else i... | true |
Other | chartjs | Chart.js | f481746fe1e56a1b0b88eae150863471d3550478.json | Update the GitHub issue template | .github/ISSUE_TEMPLATE.md | @@ -1,9 +1,40 @@
+<!--
Please consider the following before submitting an issue:
-Guidelines for contributing: https://github.com/chartjs/Chart.js/blob/master/CONTRIBUTING.md
+- Issues are reserved for BUG reports and FEATURE requests, DO NOT create issues for questions or support requests.
+- Most features should s... | false |
Other | chartjs | Chart.js | 03735563f44e1ae108f83b9c7ee946f8818c92c3.json | Improve Tooltip and Hover Interaction (#3400)
Refactored interaction modes to use lookup functions in Chart.Interaction.modes and added new modes for 'point', 'index', 'nearest', 'x', and 'y' | docs/01-Chart-Configuration.md | @@ -36,13 +36,13 @@ This concept was introduced in Chart.js 1.0 to keep configuration [DRY](https://
Chart.js merges the options object passed to the chart with the global configuration using chart type defaults and scales defaults appropriately. This way you can be as specific as you would like in your individual c... | true |
Other | chartjs | Chart.js | 03735563f44e1ae108f83b9c7ee946f8818c92c3.json | Improve Tooltip and Hover Interaction (#3400)
Refactored interaction modes to use lookup functions in Chart.Interaction.modes and added new modes for 'point', 'index', 'nearest', 'x', and 'y' | samples/AnimationCallbacks/progress-bar.html | @@ -75,7 +75,7 @@
}
},
tooltips: {
- mode: 'label',
+ mode: 'index',
},
scales: {
xAxes: [{ | true |
Other | chartjs | Chart.js | 03735563f44e1ae108f83b9c7ee946f8818c92c3.json | Improve Tooltip and Hover Interaction (#3400)
Refactored interaction modes to use lookup functions in Chart.Interaction.modes and added new modes for 'point', 'index', 'nearest', 'x', and 'y' | samples/bar-multi-axis.html | @@ -56,7 +56,7 @@
data: barChartData,
options: {
responsive: true,
- hoverMode: 'label',
+ hoverMode: 'index',
hoverAnimationDuration: 400,
stacked: false,
title:{ | true |
Other | chartjs | Chart.js | 03735563f44e1ae108f83b9c7ee946f8818c92c3.json | Improve Tooltip and Hover Interaction (#3400)
Refactored interaction modes to use lookup functions in Chart.Interaction.modes and added new modes for 'point', 'index', 'nearest', 'x', and 'y' | samples/bar-stacked.html | @@ -55,7 +55,7 @@
text:"Chart.js Bar Chart - Stacked"
},
tooltips: {
- mode: 'label'
+ mode: 'index'
},
responsive: true,
scales: { | true |
Other | chartjs | Chart.js | 03735563f44e1ae108f83b9c7ee946f8818c92c3.json | Improve Tooltip and Hover Interaction (#3400)
Refactored interaction modes to use lookup functions in Chart.Interaction.modes and added new modes for 'point', 'index', 'nearest', 'x', and 'y' | samples/different-point-sizes.html | @@ -70,7 +70,7 @@
position: 'bottom',
},
hover: {
- mode: 'label'
+ mode: 'index'
},
scales: {
xAxes: [{ | true |
Other | chartjs | Chart.js | 03735563f44e1ae108f83b9c7ee946f8818c92c3.json | Improve Tooltip and Hover Interaction (#3400)
Refactored interaction modes to use lookup functions in Chart.Interaction.modes and added new modes for 'point', 'index', 'nearest', 'x', and 'y' | samples/line-cubicInterpolationMode.html | @@ -68,7 +68,7 @@
text:'Chart.js Line Chart - Cubic interpolation mode'
},
tooltips: {
- mode: 'label'
+ mode: 'index'
},
hover: {
mode: 'dataset' | true |
Other | chartjs | Chart.js | 03735563f44e1ae108f83b9c7ee946f8818c92c3.json | Improve Tooltip and Hover Interaction (#3400)
Refactored interaction modes to use lookup functions in Chart.Interaction.modes and added new modes for 'point', 'index', 'nearest', 'x', and 'y' | samples/line-legend.html | @@ -68,7 +68,7 @@
position: 'bottom',
},
hover: {
- mode: 'label'
+ mode: 'index'
},
scales: {
xAxes: [{ | true |
Other | chartjs | Chart.js | 03735563f44e1ae108f83b9c7ee946f8818c92c3.json | Improve Tooltip and Hover Interaction (#3400)
Refactored interaction modes to use lookup functions in Chart.Interaction.modes and added new modes for 'point', 'index', 'nearest', 'x', and 'y' | samples/line-multi-axis.html | @@ -54,7 +54,7 @@
data: lineChartData,
options: {
responsive: true,
- hoverMode: 'label',
+ hoverMode: 'index',
stacked: false,
title:{
display:true, | true |
Other | chartjs | Chart.js | 03735563f44e1ae108f83b9c7ee946f8818c92c3.json | Improve Tooltip and Hover Interaction (#3400)
Refactored interaction modes to use lookup functions in Chart.Interaction.modes and added new modes for 'point', 'index', 'nearest', 'x', and 'y' | samples/line-multiline-labels.html | @@ -65,7 +65,7 @@
text:'Chart.js Line Chart'
},
tooltips: {
- mode: 'label',
+ mode: 'index',
callbacks: {
// beforeTitle: function() {
// return '...be... | true |
Other | chartjs | Chart.js | 03735563f44e1ae108f83b9c7ee946f8818c92c3.json | Improve Tooltip and Hover Interaction (#3400)
Refactored interaction modes to use lookup functions in Chart.Interaction.modes and added new modes for 'point', 'index', 'nearest', 'x', and 'y' | samples/line-skip-points.html | @@ -64,10 +64,10 @@
text:'Chart.js Line Chart - Skip Points'
},
tooltips: {
- mode: 'label',
+ mode: 'index',
},
hover: {
- mode: 'label'
+ mode: 'index'
... | true |
Other | chartjs | Chart.js | 03735563f44e1ae108f83b9c7ee946f8818c92c3.json | Improve Tooltip and Hover Interaction (#3400)
Refactored interaction modes to use lookup functions in Chart.Interaction.modes and added new modes for 'point', 'index', 'nearest', 'x', and 'y' | samples/line-stacked-area.html | @@ -63,10 +63,10 @@
text:"Chart.js Line Chart - Stacked Area"
},
tooltips: {
- mode: 'label',
+ mode: 'index',
},
hover: {
- mode: 'label'
+ mode: 'index'
},
scales: {
xAxes: [{ | true |
Other | chartjs | Chart.js | 03735563f44e1ae108f83b9c7ee946f8818c92c3.json | Improve Tooltip and Hover Interaction (#3400)
Refactored interaction modes to use lookup functions in Chart.Interaction.modes and added new modes for 'point', 'index', 'nearest', 'x', and 'y' | samples/line-stepped.html | @@ -68,7 +68,7 @@
text:'Chart.js Line Chart'
},
tooltips: {
- mode: 'label',
+ mode: 'index',
callbacks: {
// beforeTitle: function() {
// return '...be... | true |
Other | chartjs | Chart.js | 03735563f44e1ae108f83b9c7ee946f8818c92c3.json | Improve Tooltip and Hover Interaction (#3400)
Refactored interaction modes to use lookup functions in Chart.Interaction.modes and added new modes for 'point', 'index', 'nearest', 'x', and 'y' | samples/line.html | @@ -65,7 +65,8 @@
text:'Chart.js Line Chart'
},
tooltips: {
- mode: 'label',
+ mode: 'index',
+ intersect: false,
callbacks: {
// beforeTitle: function() {
... | true |
Other | chartjs | Chart.js | 03735563f44e1ae108f83b9c7ee946f8818c92c3.json | Improve Tooltip and Hover Interaction (#3400)
Refactored interaction modes to use lookup functions in Chart.Interaction.modes and added new modes for 'point', 'index', 'nearest', 'x', and 'y' | samples/scatter-multi-axis.html | @@ -99,7 +99,8 @@
data: scatterChartData,
options: {
responsive: true,
- hoverMode: 'single',
+ hoverMode: 'nearest',
+ intersect: true,
title: {
display: true,
text: 'Chart.js Scatter Chart - Multi A... | true |
Other | chartjs | Chart.js | 03735563f44e1ae108f83b9c7ee946f8818c92c3.json | Improve Tooltip and Hover Interaction (#3400)
Refactored interaction modes to use lookup functions in Chart.Interaction.modes and added new modes for 'point', 'index', 'nearest', 'x', and 'y' | samples/tooltip-hooks.html | @@ -59,7 +59,7 @@
text:"Chart.js Line Chart - Tooltip Hooks"
},
tooltips: {
- mode: 'label',
+ mode: 'index',
callbacks: {
beforeTitle: function() {
ret... | true |
Other | chartjs | Chart.js | 03735563f44e1ae108f83b9c7ee946f8818c92c3.json | Improve Tooltip and Hover Interaction (#3400)
Refactored interaction modes to use lookup functions in Chart.Interaction.modes and added new modes for 'point', 'index', 'nearest', 'x', and 'y' | src/chart.js | @@ -16,6 +16,7 @@ require('./core/core.ticks.js')(Chart);
require('./core/core.scale')(Chart);
require('./core/core.title')(Chart);
require('./core/core.legend')(Chart);
+require('./core/core.interaction')(Chart);
require('./core/core.tooltip')(Chart);
require('./elements/element.arc')(Chart); | true |
Other | chartjs | Chart.js | 03735563f44e1ae108f83b9c7ee946f8818c92c3.json | Improve Tooltip and Hover Interaction (#3400)
Refactored interaction modes to use lookup functions in Chart.Interaction.modes and added new modes for 'point', 'index', 'nearest', 'x', and 'y' | src/controllers/controller.bar.js | @@ -422,21 +422,6 @@ module.exports = function(Chart) {
if (vm.borderWidth) {
ctx.stroke();
}
- },
-
- inRange: function(mouseX, mouseY) {
- var vm = this._view;
- var inRange = false;
-
- if (vm) {
- if (vm.x < vm.base) {
- inRange = (mouseY >= vm.y - vm.height / 2 && mo... | true |
Other | chartjs | Chart.js | 03735563f44e1ae108f83b9c7ee946f8818c92c3.json | Improve Tooltip and Hover Interaction (#3400)
Refactored interaction modes to use lookup functions in Chart.Interaction.modes and added new modes for 'point', 'index', 'nearest', 'x', and 'y' | src/core/core.controller.js | @@ -515,125 +515,28 @@ module.exports = function(Chart) {
// Get the single element that was clicked on
// @return : An object containing the dataset index and element index of the matching element. Also contains the rectangle that was draw
getElementAtEvent: function(e) {
- var me = this;
- var eventPosit... | true |
Other | chartjs | Chart.js | 03735563f44e1ae108f83b9c7ee946f8818c92c3.json | Improve Tooltip and Hover Interaction (#3400)
Refactored interaction modes to use lookup functions in Chart.Interaction.modes and added new modes for 'point', 'index', 'nearest', 'x', and 'y' | src/core/core.helpers.js | @@ -308,6 +308,9 @@ module.exports = function(Chart) {
distance: radialDistanceFromCenter
};
};
+ helpers.distanceBetweenPoints = function(pt1, pt2) {
+ return Math.sqrt(Math.pow(pt2.x - pt1.x, 2) + Math.pow(pt2.y - pt1.y, 2));
+ };
helpers.aliasPixel = function(pixelWidth) {
return (pixelWidth % 2 === 0... | true |
Other | chartjs | Chart.js | 03735563f44e1ae108f83b9c7ee946f8818c92c3.json | Improve Tooltip and Hover Interaction (#3400)
Refactored interaction modes to use lookup functions in Chart.Interaction.modes and added new modes for 'point', 'index', 'nearest', 'x', and 'y' | src/core/core.interaction.js | @@ -0,0 +1,263 @@
+'use strict';
+
+module.exports = function(Chart) {
+ var helpers = Chart.helpers;
+
+ /**
+ * Helper function to traverse all of the visible elements in the chart
+ * @param chart {chart} the chart
+ * @param handler {Function} the callback to execute for each visible item
+ */
+ function parseV... | true |
Other | chartjs | Chart.js | 03735563f44e1ae108f83b9c7ee946f8818c92c3.json | Improve Tooltip and Hover Interaction (#3400)
Refactored interaction modes to use lookup functions in Chart.Interaction.modes and added new modes for 'point', 'index', 'nearest', 'x', and 'y' | src/core/core.js | @@ -30,7 +30,8 @@ module.exports = function() {
events: ['mousemove', 'mouseout', 'click', 'touchstart', 'touchmove'],
hover: {
onHover: null,
- mode: 'single',
+ mode: 'nearest',
+ intersect: true,
animationDuration: 400
},
onClick: null, | true |
Other | chartjs | Chart.js | 03735563f44e1ae108f83b9c7ee946f8818c92c3.json | Improve Tooltip and Hover Interaction (#3400)
Refactored interaction modes to use lookup functions in Chart.Interaction.modes and added new modes for 'point', 'index', 'nearest', 'x', and 'y' | src/core/core.tooltip.js | @@ -7,7 +7,8 @@ module.exports = function(Chart) {
Chart.defaults.global.tooltips = {
enabled: true,
custom: null,
- mode: 'single',
+ mode: 'nearest',
+ intersect: true,
backgroundColor: 'rgba(0,0,0,0.8)',
titleFontStyle: 'bold',
titleSpacing: 2, | true |
Other | chartjs | Chart.js | 03735563f44e1ae108f83b9c7ee946f8818c92c3.json | Improve Tooltip and Hover Interaction (#3400)
Refactored interaction modes to use lookup functions in Chart.Interaction.modes and added new modes for 'point', 'index', 'nearest', 'x', and 'y' | src/elements/element.arc.js | @@ -52,6 +52,19 @@ module.exports = function(Chart) {
}
return false;
},
+ getCenterPoint: function() {
+ var vm = this._view;
+ var halfAngle = (vm.startAngle + vm.endAngle) / 2;
+ var halfRadius = (vm.innerRadius + vm.outerRadius) / 2;
+ return {
+ x: vm.x + Math.cos(halfAngle) * halfRadius,
+ ... | true |
Other | chartjs | Chart.js | 03735563f44e1ae108f83b9c7ee946f8818c92c3.json | Improve Tooltip and Hover Interaction (#3400)
Refactored interaction modes to use lookup functions in Chart.Interaction.modes and added new modes for 'point', 'index', 'nearest', 'x', and 'y' | src/elements/element.point.js | @@ -18,14 +18,35 @@ module.exports = function(Chart) {
hoverBorderWidth: 1
};
+ function xRange(mouseX) {
+ var vm = this._view;
+ return vm ? (Math.pow(mouseX - vm.x, 2) < Math.pow(vm.radius + vm.hitRadius, 2)) : false;
+ }
+
+ function yRange(mouseY) {
+ var vm = this._view;
+ return vm ? (Math.pow(mouseY ... | true |
Other | chartjs | Chart.js | 03735563f44e1ae108f83b9c7ee946f8818c92c3.json | Improve Tooltip and Hover Interaction (#3400)
Refactored interaction modes to use lookup functions in Chart.Interaction.modes and added new modes for 'point', 'index', 'nearest', 'x', and 'y' | src/elements/element.rectangle.js | @@ -11,6 +11,44 @@ module.exports = function(Chart) {
borderSkipped: 'bottom'
};
+ function isVertical(bar) {
+ return bar._view.width !== undefined;
+ }
+
+ /**
+ * Helper function to get the bounds of the bar regardless of the orientation
+ * @private
+ * @param bar {Chart.Element.Rectangle} the bar
+ * @... | true |
Other | chartjs | Chart.js | 03735563f44e1ae108f83b9c7ee946f8818c92c3.json | Improve Tooltip and Hover Interaction (#3400)
Refactored interaction modes to use lookup functions in Chart.Interaction.modes and added new modes for 'point', 'index', 'nearest', 'x', and 'y' | test/core.interaction.tests.js | @@ -0,0 +1,562 @@
+// Tests of the interaction handlers in Core.Interaction
+
+// Test the rectangle element
+describe('Core.Interaction', function() {
+ describe('point mode', function() {
+ it ('should return all items under the point', function() {
+ var chartInstance = window.acquireChart({
+ type: 'line',
+ ... | true |
Other | chartjs | Chart.js | 03735563f44e1ae108f83b9c7ee946f8818c92c3.json | Improve Tooltip and Hover Interaction (#3400)
Refactored interaction modes to use lookup functions in Chart.Interaction.modes and added new modes for 'point', 'index', 'nearest', 'x', and 'y' | test/element.arc.tests.js | @@ -60,6 +60,46 @@ describe('Arc element tests', function() {
expect(pos.y).toBeCloseTo(0.5);
});
+ it ('should get the area', function() {
+ var arc = new Chart.elements.Arc({
+ _datasetIndex: 2,
+ _index: 1
+ });
+
+ // Mock out the view as if the controller put it there
+ arc._view = {
+ startAngle:... | true |
Other | chartjs | Chart.js | 03735563f44e1ae108f83b9c7ee946f8818c92c3.json | Improve Tooltip and Hover Interaction (#3400)
Refactored interaction modes to use lookup functions in Chart.Interaction.modes and added new modes for 'point', 'index', 'nearest', 'x', and 'y' | test/element.point.tests.js | @@ -64,6 +64,36 @@ describe('Point element tests', function() {
});
});
+ it('should get the correct area', function() {
+ var point = new Chart.elements.Point({
+ _datasetIndex: 2,
+ _index: 1
+ });
+
+ // Attach a view object as if we were the controller
+ point._view = {
+ radius: 2,
+ };
+
+ expe... | true |
Other | chartjs | Chart.js | 03735563f44e1ae108f83b9c7ee946f8818c92c3.json | Improve Tooltip and Hover Interaction (#3400)
Refactored interaction modes to use lookup functions in Chart.Interaction.modes and added new modes for 'point', 'index', 'nearest', 'x', and 'y' | test/element.rectangle.tests.js | @@ -132,6 +132,40 @@ describe('Rectangle element tests', function() {
});
});
+ it ('should get the correct area', function() {
+ var rectangle = new Chart.elements.Rectangle({
+ _datasetIndex: 2,
+ _index: 1
+ });
+
+ // Attach a view object as if we were the controller
+ rectangle._view = {
+ base: 0... | true |
Other | chartjs | Chart.js | 9deebf837188164078b092a19bf3b7add660406f.json | Fix config initialization and add unit tests | src/core/core.controller.js | @@ -117,16 +117,19 @@ module.exports = function(Chart) {
*/
function initConfig(config) {
config = config || {};
- return helpers.configMerge({
- options: helpers.configMerge(
- Chart.defaults.global,
- Chart.defaults[config.type],
- config.options || {}),
- data: {
- datasets: [],
- labels:... | true |
Other | chartjs | Chart.js | 9deebf837188164078b092a19bf3b7add660406f.json | Fix config initialization and add unit tests | test/core.controller.tests.js | @@ -4,6 +4,89 @@ describe('Chart.Controller', function() {
setTimeout(callback, 100);
}
+ describe('config', function() {
+ it('should create missing config.data properties', function() {
+ var chart = acquireChart({});
+ var data = chart.data;
+
+ expect(data instanceof Object).toBeTruthy();
+ expect(d... | true |
Other | chartjs | Chart.js | 4f668c3ed94c57bc5176bd8c89c2bb743139087c.json | Adjust expected values in core.title.tests.js | test/core.title.tests.js | @@ -118,7 +118,7 @@ describe('Title block tests', function() {
args: [0]
}, {
name: 'fillText',
- args: ['My title', 0, 0]
+ args: ['My title', 0, 0, 400]
}, {
name: 'restore',
args: []
@@ -168,7 +168,7 @@ describe('Title block tests', function() {
args: [-0.5 * Math.PI]
}, {
name: ... | false |
Other | chartjs | Chart.js | fb302d5f0074b5d367386319e696d5718b78a88d.json | Set maxWidth during title draw to avoid overflow
CanvasRenderingContext2D.fillText() accepts a fourth parameter called maxWidth that sets the maximum width of the drawn text, enforced by scaling the entire line.
This commit uses the title element's layout dimensions to set maxWidth and avoid overflow outside of the c... | src/core/core.title.js | @@ -158,7 +158,8 @@ module.exports = function(Chart) {
top = me.top,
left = me.left,
bottom = me.bottom,
- right = me.right;
+ right = me.right,
+ maxWidth;
ctx.fillStyle = valueOrDefault(opts.fontColor, globalDefaults.defaultFontColor); // render in correct colour
ctx.font = t... | false |
Other | chartjs | Chart.js | 16bcd6adc579cb3deae16ea915680bc219924cdc.json | Fix initial aspect ratio when not responsive
When responsive is false and no canvas height explicitly set, the aspectRatio option wasn't applied because of the canvas default height. Prevent the retinaScale method to change the canvas display size since this method is called for none responsive charts, but instead mak... | src/core/core.controller.js | @@ -3,6 +3,7 @@
module.exports = function(Chart) {
var helpers = Chart.helpers;
+
// Create a dictionary of chart types, to allow for extension of existing types
Chart.types = {};
@@ -13,40 +14,176 @@ module.exports = function(Chart) {
// Controllers available for dataset visualization eg. bar, line, slice... | true |
Other | chartjs | Chart.js | 16bcd6adc579cb3deae16ea915680bc219924cdc.json | Fix initial aspect ratio when not responsive
When responsive is false and no canvas height explicitly set, the aspectRatio option wasn't applied because of the canvas default height. Prevent the retinaScale method to change the canvas display size since this method is called for none responsive charts, but instead mak... | src/core/core.helpers.js | @@ -859,9 +859,6 @@ module.exports = function(Chart) {
// when destroy is called
chart.originalDevicePixelRatio = chart.originalDevicePixelRatio || pixelRatio;
}
-
- canvas.style.width = width + 'px';
- canvas.style.height = height + 'px';
};
// -- Canvas methods
helpers.clear = function(chart) { | true |
Other | chartjs | Chart.js | 16bcd6adc579cb3deae16ea915680bc219924cdc.json | Fix initial aspect ratio when not responsive
When responsive is false and no canvas height explicitly set, the aspectRatio option wasn't applied because of the canvas default height. Prevent the retinaScale method to change the canvas display size since this method is called for none responsive charts, but instead mak... | src/core/core.js | @@ -5,12 +5,6 @@ module.exports = function() {
// Occupy the global variable of Chart, and create a simple base class
var Chart = function(context, config) {
var me = this;
- var helpers = Chart.helpers;
- me.config = config || {
- data: {
- datasets: []
- }
- };
// Support a jQuery'd canvas eleme... | true |
Other | chartjs | Chart.js | 97e23737210bbfb5612b41e2573430350f1aeee6.json | Change `ticks.mode` to `scale.distribution` (#4582)
Fix `ticks.mode` behavior when `ticks.source` is `auto`: the lookup table is now built from the data and not from the ticks, so data (and ticks) are correctly distributed along the scale. Rename the option to `distribution` (more explicit than `mode`) and since this ... | src/scales/scale.time.js | @@ -64,6 +64,22 @@ function sorter(a, b) {
return a - b;
}
+function arrayUnique(items) {
+ var hash = {};
+ var out = [];
+ var i, ilen, item;
+
+ for (i = 0, ilen = items.length; i < ilen; ++i) {
+ item = items[i];
+ if (!hash[item]) {
+ hash[item] = true;
+ out.push(item);
+ }
+ }
+
+ return out;
+}
+
/... | true |
Other | chartjs | Chart.js | 97e23737210bbfb5612b41e2573430350f1aeee6.json | Change `ticks.mode` to `scale.distribution` (#4582)
Fix `ticks.mode` behavior when `ticks.source` is `auto`: the lookup table is now built from the data and not from the ticks, so data (and ticks) are correctly distributed along the scale. Rename the option to `distribution` (more explicit than `mode`) and since this ... | test/specs/scale.time.tests.js | @@ -21,12 +21,6 @@ describe('Time scale tests', function() {
return scale.ticks;
}
- function fetchTickPositions(scale) {
- return scale.ticks.map(function(tick, index) {
- return scale.getPixelForTick(index);
- });
- }
-
beforeEach(function() {
// Need a time matcher for getValueFromPixel
jasmine.ad... | true |
Other | chartjs | Chart.js | 56fdd7ebc10c91834361a6228f2ebdb09530d690.json | Allow specifying bar chart via {x, y} data points (#4565) | docs/charts/bar.md | @@ -152,6 +152,12 @@ The `data` property of a dataset for a bar chart is specified as a an array of n
data: [20, 10]
```
+You can also specify the dataset as x/y coordinates.
+
+```javascript
+data: [{x:'2016-12-25', y:20}, {'2016-12-26', y:10}]
+```
+
# Stacked Bar Chart
Bar charts can be configured into stack... | true |
Other | chartjs | Chart.js | 56fdd7ebc10c91834361a6228f2ebdb09530d690.json | Allow specifying bar chart via {x, y} data points (#4565) | src/controllers/controller.bar.js | @@ -268,7 +268,7 @@ module.exports = function(Chart) {
var meta = me.getMeta();
var scale = me.getValueScale();
var datasets = chart.data.datasets;
- var value = Number(datasets[datasetIndex].data[index]);
+ var value = scale.getRightValue(datasets[datasetIndex].data[index]);
var stacked = scale.opt... | true |
Other | chartjs | Chart.js | 56fdd7ebc10c91834361a6228f2ebdb09530d690.json | Allow specifying bar chart via {x, y} data points (#4565) | src/scales/scale.linearbase.js | @@ -8,6 +8,13 @@ module.exports = function(Chart) {
var noop = helpers.noop;
Chart.LinearScaleBase = Chart.Scale.extend({
+ getRightValue: function(value) {
+ if (typeof value === 'string') {
+ return +value;
+ }
+ return Chart.Scale.prototype.getRightValue.call(this, value);
+ },
+
handleTickRangeO... | true |
Other | chartjs | Chart.js | d07fb284628076518ee15e2240b3eea1456e56ca.json | Add a note about breaking changes (#4555) | docs/developers/contributing.md | @@ -8,6 +8,7 @@ New contributions to the library are welcome, but we ask that you please follow
- Check that your code will pass tests, `gulp test` will run tests for you.
- Keep pull requests concise, and document new functionality in the relevant `.md` file.
- Consider whether your changes are useful for all users... | false |
Other | chartjs | Chart.js | 4c763bff44345ff5bbf2acc97cbce8918fa5b055.json | Enforce spaces around infix/unary words operators (#4547)
Enable ESLint `space-infix-ops` and `space-unary-ops` (for words only) rules. Also added `samples` to the linting task to match Code Climate expectations.
http://eslint.org/docs/rules/space-infix-ops
http://eslint.org/docs/rules/space-unary-ops | .eslintrc | @@ -197,8 +197,8 @@ rules:
space-before-blocks: [2, always]
space-before-function-paren: [2, never]
space-in-parens: [2, never]
- space-infix-ops: 0
- space-unary-ops: 0
+ space-infix-ops: 2
+ space-unary-ops: [2, {words: true, nonwords: false}]
spaced-comment: [2, always]
unicode-bom: 0
wrap-rege... | true |
Other | chartjs | Chart.js | 4c763bff44345ff5bbf2acc97cbce8918fa5b055.json | Enforce spaces around infix/unary words operators (#4547)
Enable ESLint `space-infix-ops` and `space-unary-ops` (for words only) rules. Also added `samples` to the linting task to match Code Climate expectations.
http://eslint.org/docs/rules/space-infix-ops
http://eslint.org/docs/rules/space-unary-ops | gulpfile.js | @@ -23,7 +23,6 @@ var package = require('./package.json');
var srcDir = './src/';
var outDir = './dist/';
-var testDir = './test/';
var header = "/*!\n" +
" * Chart.js\n" +
@@ -128,8 +127,9 @@ function packageTask() {
function lintTask() {
var files = [
- srcDir + '**/*.js',
- testDir + '**/*.js'
... | true |
Other | chartjs | Chart.js | 4c763bff44345ff5bbf2acc97cbce8918fa5b055.json | Enforce spaces around infix/unary words operators (#4547)
Enable ESLint `space-infix-ops` and `space-unary-ops` (for words only) rules. Also added `samples` to the linting task to match Code Climate expectations.
http://eslint.org/docs/rules/space-infix-ops
http://eslint.org/docs/rules/space-unary-ops | samples/charts/area/analyser.js | @@ -20,7 +20,7 @@
return;
}
- for (i=0, ilen=datasets.length; i<ilen; ++i) {
+ for (i = 0, ilen = datasets.length; i < ilen; ++i) {
meta = chart.getDatasetMeta(i).$filler;
if (meta) {
dataset = datasets[i]; | true |
Other | chartjs | Chart.js | 4c763bff44345ff5bbf2acc97cbce8918fa5b055.json | Enforce spaces around infix/unary words operators (#4547)
Enable ESLint `space-infix-ops` and `space-unary-ops` (for words only) rules. Also added `samples` to the linting task to match Code Climate expectations.
http://eslint.org/docs/rules/space-infix-ops
http://eslint.org/docs/rules/space-unary-ops | samples/utils.js | @@ -41,8 +41,8 @@ window.randomScalingFactor = function() {
rand: function(min, max) {
var seed = this._seed;
- min = min === undefined? 0 : min;
- max = max === undefined? 1 : max;
+ min = min === undefined ? 0 : min;
+ max = max === undefined ? 1 : max;
this._seed = (seed * 9301 + 49297) % 233280... | true |
Other | chartjs | Chart.js | 4c763bff44345ff5bbf2acc97cbce8918fa5b055.json | Enforce spaces around infix/unary words operators (#4547)
Enable ESLint `space-infix-ops` and `space-unary-ops` (for words only) rules. Also added `samples` to the linting task to match Code Climate expectations.
http://eslint.org/docs/rules/space-infix-ops
http://eslint.org/docs/rules/space-unary-ops | src/controllers/controller.bar.js | @@ -156,11 +156,11 @@ module.exports = function(Chart) {
var ipixels = me.calculateBarIndexPixels(me.index, index, ruler);
model.horizontal = horizontal;
- model.base = reset? base : vpixels.base;
- model.x = horizontal? reset? base : vpixels.head : ipixels.center;
- model.y = horizontal? ipixels.center... | true |
Other | chartjs | Chart.js | 4c763bff44345ff5bbf2acc97cbce8918fa5b055.json | Enforce spaces around infix/unary words operators (#4547)
Enable ESLint `space-infix-ops` and `space-unary-ops` (for words only) rules. Also added `samples` to the linting task to match Code Climate expectations.
http://eslint.org/docs/rules/space-infix-ops
http://eslint.org/docs/rules/space-unary-ops | src/controllers/controller.line.js | @@ -86,7 +86,7 @@ module.exports = function(Chart) {
}
// Update Points
- for (i=0, ilen=points.length; i<ilen; ++i) {
+ for (i = 0, ilen = points.length; i < ilen; ++i) {
me.updateElement(points[i], i, reset);
}
@@ -95,7 +95,7 @@ module.exports = function(Chart) {
}
// Now pivot the ... | true |
Other | chartjs | Chart.js | 4c763bff44345ff5bbf2acc97cbce8918fa5b055.json | Enforce spaces around infix/unary words operators (#4547)
Enable ESLint `space-infix-ops` and `space-unary-ops` (for words only) rules. Also added `samples` to the linting task to match Code Climate expectations.
http://eslint.org/docs/rules/space-infix-ops
http://eslint.org/docs/rules/space-unary-ops | src/core/core.animation.js | @@ -49,7 +49,7 @@ module.exports = function(Chart) {
chart.animating = true;
}
- for (i=0, ilen=animations.length; i < ilen; ++i) {
+ for (i = 0, ilen = animations.length; i < ilen; ++i) {
if (animations[i].chart === chart) {
animations[i] = animation;
return; | true |
Other | chartjs | Chart.js | 4c763bff44345ff5bbf2acc97cbce8918fa5b055.json | Enforce spaces around infix/unary words operators (#4547)
Enable ESLint `space-infix-ops` and `space-unary-ops` (for words only) rules. Also added `samples` to the linting task to match Code Climate expectations.
http://eslint.org/docs/rules/space-infix-ops
http://eslint.org/docs/rules/space-unary-ops | src/core/core.controller.js | @@ -82,7 +82,7 @@ module.exports = function(Chart) {
me.config = config;
me.width = width;
me.height = height;
- me.aspectRatio = height? width / height : null;
+ me.aspectRatio = height ? width / height : null;
me.options = config.options;
me._bufferedRender = false;
@@ -546,7 +546,7 @@ modul... | true |
Other | chartjs | Chart.js | 4c763bff44345ff5bbf2acc97cbce8918fa5b055.json | Enforce spaces around infix/unary words operators (#4547)
Enable ESLint `space-infix-ops` and `space-unary-ops` (for words only) rules. Also added `samples` to the linting task to match Code Climate expectations.
http://eslint.org/docs/rules/space-infix-ops
http://eslint.org/docs/rules/space-unary-ops | src/core/core.datasetController.js | @@ -170,7 +170,7 @@ module.exports = function(Chart) {
var metaData = meta.data;
var i, ilen;
- for (i=0, ilen=data.length; i<ilen; ++i) {
+ for (i = 0, ilen = data.length; i < ilen; ++i) {
metaData[i] = metaData[i] || me.createMetaData(i);
}
@@ -214,7 +214,7 @@ module.exports = function(Chart)... | true |
Other | chartjs | Chart.js | 4c763bff44345ff5bbf2acc97cbce8918fa5b055.json | Enforce spaces around infix/unary words operators (#4547)
Enable ESLint `space-infix-ops` and `space-unary-ops` (for words only) rules. Also added `samples` to the linting task to match Code Climate expectations.
http://eslint.org/docs/rules/space-infix-ops
http://eslint.org/docs/rules/space-unary-ops | src/core/core.element.js | @@ -7,7 +7,7 @@ function interpolate(start, view, model, ease) {
var keys = Object.keys(model);
var i, ilen, key, actual, origin, target, type, c0, c1;
- for (i=0, ilen=keys.length; i<ilen; ++i) {
+ for (i = 0, ilen = keys.length; i < ilen; ++i) {
key = keys[i];
target = model[key];
@@ -30,9 +30,9 @@ func... | true |
Other | chartjs | Chart.js | 4c763bff44345ff5bbf2acc97cbce8918fa5b055.json | Enforce spaces around infix/unary words operators (#4547)
Enable ESLint `space-infix-ops` and `space-unary-ops` (for words only) rules. Also added `samples` to the linting task to match Code Climate expectations.
http://eslint.org/docs/rules/space-infix-ops
http://eslint.org/docs/rules/space-unary-ops | src/core/core.helpers.js | @@ -52,7 +52,7 @@ module.exports = function(Chart) {
for (i = 0; i < slen; ++i) {
scale = source[key][i];
- type = helpers.valueOrDefault(scale.type, key === 'xAxes'? 'category' : 'linear');
+ type = helpers.valueOrDefault(scale.type, key === 'xAxes' ? 'category' : 'linear');
if (i >= ... | true |
Other | chartjs | Chart.js | 4c763bff44345ff5bbf2acc97cbce8918fa5b055.json | Enforce spaces around infix/unary words operators (#4547)
Enable ESLint `space-infix-ops` and `space-unary-ops` (for words only) rules. Also added `samples` to the linting task to match Code Climate expectations.
http://eslint.org/docs/rules/space-infix-ops
http://eslint.org/docs/rules/space-unary-ops | src/core/core.layoutService.js | @@ -75,7 +75,7 @@ module.exports = function(Chart) {
* @param {Object} layoutItem - the item to remove from the layout
*/
removeBox: function(chart, layoutItem) {
- var index = chart.boxes? chart.boxes.indexOf(layoutItem) : -1;
+ var index = chart.boxes ? chart.boxes.indexOf(layoutItem) : -1;
if (ind... | true |
Other | chartjs | Chart.js | 4c763bff44345ff5bbf2acc97cbce8918fa5b055.json | Enforce spaces around infix/unary words operators (#4547)
Enable ESLint `space-infix-ops` and `space-unary-ops` (for words only) rules. Also added `samples` to the linting task to match Code Climate expectations.
http://eslint.org/docs/rules/space-infix-ops
http://eslint.org/docs/rules/space-unary-ops | src/core/core.plugin.js | @@ -102,7 +102,7 @@ module.exports = function(Chart) {
var ilen = descriptors.length;
var i, descriptor, plugin, params, method;
- for (i=0; i<ilen; ++i) {
+ for (i = 0; i < ilen; ++i) {
descriptor = descriptors[i];
plugin = descriptor.plugin;
method = plugin[hook]; | true |
Other | chartjs | Chart.js | 4c763bff44345ff5bbf2acc97cbce8918fa5b055.json | Enforce spaces around infix/unary words operators (#4547)
Enable ESLint `space-infix-ops` and `space-unary-ops` (for words only) rules. Also added `samples` to the linting task to match Code Climate expectations.
http://eslint.org/docs/rules/space-infix-ops
http://eslint.org/docs/rules/space-unary-ops | src/core/core.scale.js | @@ -378,8 +378,8 @@ module.exports = function(Chart) {
// Ensure that our ticks are always inside the canvas. When rotated, ticks are right aligned which means that the right padding is dominated
// by the font height
if (me.labelRotation !== 0) {
- me.paddingLeft = opts.position === 'bottom'? (c... | true |
Other | chartjs | Chart.js | 4c763bff44345ff5bbf2acc97cbce8918fa5b055.json | Enforce spaces around infix/unary words operators (#4547)
Enable ESLint `space-infix-ops` and `space-unary-ops` (for words only) rules. Also added `samples` to the linting task to match Code Climate expectations.
http://eslint.org/docs/rules/space-infix-ops
http://eslint.org/docs/rules/space-unary-ops | src/elements/element.point.js | @@ -85,18 +85,18 @@ module.exports = Element.extend({
// Cliping for Points.
// going out from inner charArea?
- if ((chartArea !== undefined) && ((model.x < chartArea.left) || (chartArea.right*errMargin < model.x) || (model.y < chartArea.top) || (chartArea.bottom*errMargin < model.y))) {
+ if ((chartArea !==... | true |
Other | chartjs | Chart.js | 4c763bff44345ff5bbf2acc97cbce8918fa5b055.json | Enforce spaces around infix/unary words operators (#4547)
Enable ESLint `space-infix-ops` and `space-unary-ops` (for words only) rules. Also added `samples` to the linting task to match Code Climate expectations.
http://eslint.org/docs/rules/space-infix-ops
http://eslint.org/docs/rules/space-unary-ops | src/elements/element.rectangle.js | @@ -66,15 +66,15 @@ module.exports = Element.extend({
top = vm.y;
bottom = vm.base;
signX = 1;
- signY = bottom > top? 1: -1;
+ signY = bottom > top ? 1 : -1;
borderSkipped = vm.borderSkipped || 'bottom';
} else {
// horizontal bar
left = vm.base;
right = vm.x;
top = vm.y - vm.hei... | true |
Other | chartjs | Chart.js | 4c763bff44345ff5bbf2acc97cbce8918fa5b055.json | Enforce spaces around infix/unary words operators (#4547)
Enable ESLint `space-infix-ops` and `space-unary-ops` (for words only) rules. Also added `samples` to the linting task to match Code Climate expectations.
http://eslint.org/docs/rules/space-infix-ops
http://eslint.org/docs/rules/space-unary-ops | src/helpers/helpers.canvas.js | @@ -27,8 +27,8 @@ var exports = module.exports = {
*/
roundedRect: function(ctx, x, y, width, height, radius) {
if (radius) {
- var rx = Math.min(radius, width/2);
- var ry = Math.min(radius, height/2);
+ var rx = Math.min(radius, width / 2);
+ var ry = Math.min(radius, height / 2);
ctx.moveTo(x +... | true |
Other | chartjs | Chart.js | 4c763bff44345ff5bbf2acc97cbce8918fa5b055.json | Enforce spaces around infix/unary words operators (#4547)
Enable ESLint `space-infix-ops` and `space-unary-ops` (for words only) rules. Also added `samples` to the linting task to match Code Climate expectations.
http://eslint.org/docs/rules/space-infix-ops
http://eslint.org/docs/rules/space-unary-ops | src/helpers/helpers.core.js | @@ -37,7 +37,7 @@ var helpers = {
* @returns {Boolean}
* @function
*/
- isArray: Array.isArray? Array.isArray : function(value) {
+ isArray: Array.isArray ? Array.isArray : function(value) {
return Object.prototype.toString.call(value) === '[object Array]';
},
@@ -58,7 +58,7 @@ var helpers = {
* @ret... | true |
Other | chartjs | Chart.js | 4c763bff44345ff5bbf2acc97cbce8918fa5b055.json | Enforce spaces around infix/unary words operators (#4547)
Enable ESLint `space-infix-ops` and `space-unary-ops` (for words only) rules. Also added `samples` to the linting task to match Code Climate expectations.
http://eslint.org/docs/rules/space-infix-ops
http://eslint.org/docs/rules/space-unary-ops | src/helpers/helpers.options.js | @@ -15,7 +15,7 @@ module.exports = {
* @since 2.7.0
*/
toLineHeight: function(value, size) {
- var matches = (''+value).match(/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/);
+ var matches = ('' + value).match(/^(normal|(\d+(?:\.\d+)?)(px|em|%)?)$/);
if (!matches || matches[1] === 'normal') {
return size * 1.2... | true |
Other | chartjs | Chart.js | 4c763bff44345ff5bbf2acc97cbce8918fa5b055.json | Enforce spaces around infix/unary words operators (#4547)
Enable ESLint `space-infix-ops` and `space-unary-ops` (for words only) rules. Also added `samples` to the linting task to match Code Climate expectations.
http://eslint.org/docs/rules/space-infix-ops
http://eslint.org/docs/rules/space-unary-ops | src/helpers/helpers.time.js | @@ -1,7 +1,7 @@
'use strict';
var moment = require('moment');
-moment = typeof(moment) === 'function' ? moment : window.moment;
+moment = typeof moment === 'function' ? moment : window.moment;
var helpers = require('./helpers.core');
@@ -55,7 +55,7 @@ function generateTicksNiceRange(options, dataRange, niceRan... | true |
Other | chartjs | Chart.js | 4c763bff44345ff5bbf2acc97cbce8918fa5b055.json | Enforce spaces around infix/unary words operators (#4547)
Enable ESLint `space-infix-ops` and `space-unary-ops` (for words only) rules. Also added `samples` to the linting task to match Code Climate expectations.
http://eslint.org/docs/rules/space-infix-ops
http://eslint.org/docs/rules/space-unary-ops | src/platforms/platform.dom.js | @@ -39,7 +39,7 @@ var eventTypeMap = {
function readUsedSize(element, property) {
var value = helpers.getStyle(element, property);
var matches = value && value.match(/^(\d+)(\.\d+)?px$/);
- return matches? Number(matches[1]) : undefined;
+ return matches ? Number(matches[1]) : undefined;
}
/**
@@ -119,7 +119,7... | true |
Other | chartjs | Chart.js | 4c763bff44345ff5bbf2acc97cbce8918fa5b055.json | Enforce spaces around infix/unary words operators (#4547)
Enable ESLint `space-infix-ops` and `space-unary-ops` (for words only) rules. Also added `samples` to the linting task to match Code Climate expectations.
http://eslint.org/docs/rules/space-infix-ops
http://eslint.org/docs/rules/space-unary-ops | src/plugins/plugin.filler.js | @@ -29,20 +29,20 @@ module.exports = function() {
var points = (visible && meta.dataset._children) || [];
var length = points.length || 0;
- return !length? null : function(point, i) {
+ return !length ? null : function(point, i) {
return (i < length && points[i]._view) || null;
};
},
bou... | true |
Other | chartjs | Chart.js | 4c763bff44345ff5bbf2acc97cbce8918fa5b055.json | Enforce spaces around infix/unary words operators (#4547)
Enable ESLint `space-infix-ops` and `space-unary-ops` (for words only) rules. Also added `samples` to the linting task to match Code Climate expectations.
http://eslint.org/docs/rules/space-infix-ops
http://eslint.org/docs/rules/space-unary-ops | src/plugins/plugin.legend.js | @@ -19,7 +19,7 @@ defaults._set('global', {
var meta = ci.getDatasetMeta(index);
// See controller.isDatasetVisible comment
- meta.hidden = meta.hidden === null? !ci.data.datasets[index].hidden : null;
+ meta.hidden = meta.hidden === null ? !ci.data.datasets[index].hidden : null;
// We hid a dataset... | true |
Other | chartjs | Chart.js | 4c763bff44345ff5bbf2acc97cbce8918fa5b055.json | Enforce spaces around infix/unary words operators (#4547)
Enable ESLint `space-infix-ops` and `space-unary-ops` (for words only) rules. Also added `samples` to the linting task to match Code Climate expectations.
http://eslint.org/docs/rules/space-infix-ops
http://eslint.org/docs/rules/space-unary-ops | src/plugins/plugin.title.js | @@ -153,7 +153,7 @@ module.exports = function(Chart) {
fontFamily = valueOrDefault(opts.fontFamily, globalDefaults.defaultFontFamily),
titleFont = helpers.fontString(fontSize, fontStyle, fontFamily),
lineHeight = helpers.options.toLineHeight(opts.lineHeight, fontSize),
- offset = lineHeight/2 + op... | true |
Other | chartjs | Chart.js | 4c763bff44345ff5bbf2acc97cbce8918fa5b055.json | Enforce spaces around infix/unary words operators (#4547)
Enable ESLint `space-infix-ops` and `space-unary-ops` (for words only) rules. Also added `samples` to the linting task to match Code Climate expectations.
http://eslint.org/docs/rules/space-infix-ops
http://eslint.org/docs/rules/space-unary-ops | src/scales/scale.logarithmic.js | @@ -206,7 +206,7 @@ module.exports = function(Chart) {
} else if (newVal === me.minNotZero) {
pixel = me.bottom - innerDimension * 0.02;
} else {
- pixel = me.bottom - innerDimension * 0.02 - (innerDimension * 0.98/ range * (helpers.log10(newVal)-helpers.log10(me.minNotZero)));
+ pixel = me... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.