Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
7d63bf0
time type xAxis height crah in line chart
Jack-Valentine Jun 9, 2016
f361239
Fix #2734 Cleanup unused variables
simonbrunel Jun 18, 2016
47912f4
Remove duplicated function names
simonbrunel Jun 18, 2016
db8ed6a
Span gaps option should be specified at the chart level
etimberg Jun 20, 2016
ebaade5
Merge pull request #2800 from simonbrunel/#2734
etimberg Jun 20, 2016
553b20d
Gracefully handle creating the chart with no config
etimberg Jun 21, 2016
48ac791
Allow passing a value to the time scale getPixelForValue method
etimberg Jun 21, 2016
0871dd9
Use the scale center point for the polar area chart center
etimberg Jun 21, 2016
a9e0f2c
Fix statements in for() in tooltips's getAveragePosition.
Kopleman Jun 22, 2016
07b6ca8
Merge pull request #2828 from Kopleman/master
etimberg Jun 23, 2016
05d41da
Merge pull request #2822 from chartjs/fix/2604
etimberg Jun 23, 2016
0e276c9
Merge pull request #2821 from chartjs/fix/2526
etimberg Jun 23, 2016
3280003
Merge pull request #2811 from chartjs/fix/span-gaps-global
etimberg Jun 23, 2016
3cf1cfa
Fix JSHint warning
etimberg Jun 23, 2016
be32a4c
Merge pull request #2823 from chartjs/fix/2708
etimberg Jun 23, 2016
5c36e0d
Fix typo in tooltip docs
etimberg Jun 23, 2016
9560064
Merge pull request #2841 from chartjs/fix/2839
panzarino Jun 24, 2016
886803a
Fix line example not showing Scale Titles
ronaldgrn Jun 26, 2016
4504455
Merge pull request #2848 from ronaldgrn/patch-1
etimberg Jun 26, 2016
f2270ed
Merge pull request #2741 from duerahan/master
fulldecent Jun 27, 2016
72f423f
Fix tooltip not shown for missing dataset
awallat Jun 16, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config.jshintrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"node": true,
"unused": true,
"predef": [ "require", "module" ]
}
2 changes: 1 addition & 1 deletion docs/01-Chart-Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ var chartInstance = new Chart(ctx, {

### Tooltip Configuration

The title configuration is passed into the `options.tooltips` namespace. The global options for the chart tooltips is defined in `Chart.defaults.global.tooltips`.
The tooltip configuration is passed into the `options.tooltips` namespace. The global options for the chart tooltips is defined in `Chart.defaults.global.tooltips`.

Name | Type | Default | Description
--- | --- | --- | ---
Expand Down
1 change: 1 addition & 0 deletions docs/03-Line-Chart.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ These are the customisation options specific to Line charts. These options are m
Name | Type | Default | Description
--- | --- | --- | ---
showLines | Boolean | true | If false, the lines between points are not drawn
spanGaps | Boolean | false | If true, NaN data does not break the line

You can override these for your `Chart` instance by passing a member `options` into the `Line` method.

Expand Down
4 changes: 2 additions & 2 deletions samples/line.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,14 @@
xAxes: [{
display: true,
scaleLabel: {
show: true,
display: true,
labelString: 'Month'
}
}],
yAxes: [{
display: true,
scaleLabel: {
show: true,
display: true,
labelString: 'Value'
},
ticks: {
Expand Down
4 changes: 2 additions & 2 deletions src/charts/Chart.Scatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ module.exports = function(Chart) {

tooltips: {
callbacks: {
title: function(tooltipItems, data) {
title: function() {
// Title doesn't make sense for scatter since we format the data as a point
return '';
},
label: function(tooltipItem, data) {
label: function(tooltipItem) {
return '(' + tooltipItem.xLabel + ', ' + tooltipItem.yLabel + ')';
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/controllers/controller.bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module.exports = function(Chart) {
},

// Get the number of datasets that display bars. We use this to correctly calculate the bar width
getBarCount: function getBarCount() {
getBarCount: function() {
var me = this;
var barCount = 0;
helpers.each(me.chart.data.datasets, function(dataset, datasetIndex) {
Expand All @@ -52,14 +52,14 @@ module.exports = function(Chart) {
return barCount;
},

update: function update(reset) {
update: function(reset) {
var me = this;
helpers.each(me.getMeta().data, function(rectangle, index) {
me.updateElement(rectangle, index, reset);
}, me);
},

updateElement: function updateElement(rectangle, index, reset) {
updateElement: function(rectangle, index, reset) {
var me = this;
var meta = me.getMeta();
var xScale = me.getScaleForId(meta.xAxisID);
Expand Down Expand Up @@ -338,7 +338,7 @@ module.exports = function(Chart) {
};

Chart.controllers.horizontalBar = Chart.controllers.bar.extend({
updateElement: function updateElement(rectangle, index, reset, numBars) {
updateElement: function(rectangle, index, reset) {
var me = this;
var meta = me.getMeta();
var xScale = me.getScaleForId(meta.xAxisID);
Expand Down
4 changes: 2 additions & 2 deletions src/controllers/controller.bubble.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module.exports = function(Chart) {

tooltips: {
callbacks: {
title: function(tooltipItems, data) {
title: function() {
// Title doesn't make sense for scatter since we format the data as a point
return '';
},
Expand All @@ -41,7 +41,7 @@ module.exports = function(Chart) {

dataElementType: Chart.elements.Point,

update: function update(reset) {
update: function(reset) {
var me = this;
var meta = me.getMeta();
var points = meta.data;
Expand Down
6 changes: 2 additions & 4 deletions src/controllers/controller.doughnut.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ module.exports = function(Chart) {
linkScales: helpers.noop,

// Get index of the dataset in relation to the visible datasets. This allows determining the inner and outer radius correctly
getRingIndex: function getRingIndex(datasetIndex) {
getRingIndex: function(datasetIndex) {
var ringIndex = 0;

for (var j = 0; j < datasetIndex; ++j) {
Expand All @@ -131,7 +131,7 @@ module.exports = function(Chart) {
return ringIndex;
},

update: function update(reset) {
update: function(reset) {
var me = this;
var chart = me.chart,
chartArea = chart.chartArea,
Expand Down Expand Up @@ -189,7 +189,6 @@ module.exports = function(Chart) {
chartArea = chart.chartArea,
opts = chart.options,
animationOpts = opts.animation,
arcOpts = opts.elements.arc,
centerX = (chartArea.left + chartArea.right) / 2,
centerY = (chartArea.top + chartArea.bottom) / 2,
startAngle = opts.rotation, // non reset case handled later
Expand All @@ -198,7 +197,6 @@ module.exports = function(Chart) {
circumference = reset && animationOpts.animateRotate ? 0 : arc.hidden ? 0 : me.calculateCircumference(dataset.data[index]) * (opts.circumference / (2.0 * Math.PI)),
innerRadius = reset && animationOpts.animateScale ? 0 : me.innerRadius,
outerRadius = reset && animationOpts.animateScale ? 0 : me.outerRadius,
custom = arc.custom || {},
valueAtIndexOrDefault = helpers.getValueAtIndexOrDefault;

helpers.extend(arc, {
Expand Down
10 changes: 5 additions & 5 deletions src/controllers/controller.line.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module.exports = function(Chart) {

Chart.defaults.line = {
showLines: true,
spanGaps: false,

hover: {
mode: "label"
Expand Down Expand Up @@ -46,7 +47,7 @@ module.exports = function(Chart) {
}
},

update: function update(reset) {
update: function(reset) {
var me = this;
var meta = me.getMeta();
var line = meta.dataset;
Expand Down Expand Up @@ -78,7 +79,7 @@ module.exports = function(Chart) {
// The default behavior of lines is to break at null values, according
// to https://github.com/chartjs/Chart.js/issues/2435#issuecomment-216718158
// This option gives linse the ability to span gaps
spanGaps: dataset.spanGaps ? dataset.spanGaps : false,
spanGaps: dataset.spanGaps ? dataset.spanGaps : options.spanGaps,
tension: custom.tension ? custom.tension : helpers.getValueOrDefault(dataset.lineTension, lineElementOptions.tension),
backgroundColor: custom.backgroundColor ? custom.backgroundColor : (dataset.backgroundColor || lineElementOptions.backgroundColor),
borderWidth: custom.borderWidth ? custom.borderWidth : (dataset.borderWidth || lineElementOptions.borderWidth),
Expand Down Expand Up @@ -181,7 +182,7 @@ module.exports = function(Chart) {
}

x = xScale.getPixelForValue(value, index, datasetIndex, me.chart.isCombo);
y = reset ? yScale.getBasePixel() : me.calculatePointY(value, index, datasetIndex, me.chart.isCombo);
y = reset ? yScale.getBasePixel() : me.calculatePointY(value, index, datasetIndex);

// Utility
point._xScale = xScale;
Expand All @@ -206,7 +207,7 @@ module.exports = function(Chart) {
};
},

calculatePointY: function(value, index, datasetIndex, isCombo) {
calculatePointY: function(value, index, datasetIndex) {
var me = this;
var chart = me.chart;
var meta = me.getMeta();
Expand Down Expand Up @@ -240,7 +241,6 @@ module.exports = function(Chart) {

updateBezierControlPoints: function() {
var meta = this.getMeta();
var area = this.chart.chartArea;
var points = meta.data || [];
var i, ilen, point, model, controlPoints;

Expand Down
9 changes: 3 additions & 6 deletions src/controllers/controller.polarArea.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ module.exports = function(Chart) {

linkScales: helpers.noop,

update: function update(reset) {
update: function(reset) {
var me = this;
var chart = me.chart;
var chartArea = chart.chartArea;
Expand All @@ -130,19 +130,16 @@ module.exports = function(Chart) {
updateElement: function(arc, index, reset) {
var me = this;
var chart = me.chart;
var chartArea = chart.chartArea;
var dataset = me.getDataset();
var opts = chart.options;
var animationOpts = opts.animation;
var arcOpts = opts.elements.arc;
var custom = arc.custom || {};
var scale = chart.scale;
var getValueAtIndexOrDefault = helpers.getValueAtIndexOrDefault;
var labels = chart.data.labels;

var circumference = me.calculateCircumference(dataset.data[index]);
var centerX = (chartArea.left + chartArea.right) / 2;
var centerY = (chartArea.top + chartArea.bottom) / 2;
var centerX = scale.xCenter;
var centerY = scale.yCenter;

// If there is NaN data before us, we need to calculate the starting angle correctly.
// We could be way more efficient here, but its unlikely that the polar area chart will have a lot of data
Expand Down
4 changes: 2 additions & 2 deletions src/controllers/controller.radar.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module.exports = function(Chart) {
this.updateBezierControlPoints();
},

update: function update(reset) {
update: function(reset) {
var me = this;
var meta = me.getMeta();
var line = meta.dataset;
Expand Down Expand Up @@ -146,7 +146,7 @@ module.exports = function(Chart) {
var easingDecimal = ease || 1;

// Transition Point Locations
helpers.each(meta.data, function(point, index) {
helpers.each(meta.data, function(point) {
point.transition(easingDecimal);
});

Expand Down
28 changes: 14 additions & 14 deletions src/core/core.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ module.exports = function(Chart) {

helpers.extend(Chart.Controller.prototype, /** @lends Chart.Controller */ {

initialize: function initialize() {
initialize: function() {
var me = this;
// Before init plugin notification
Chart.plugins.notify('beforeInit', [me]);
Expand All @@ -68,12 +68,12 @@ module.exports = function(Chart) {
return me;
},

clear: function clear() {
clear: function() {
helpers.clear(this.chart);
return this;
},

stop: function stop() {
stop: function() {
// Stops any current animation loop occuring
Chart.animationService.cancelAnimation(this);
return this;
Expand Down Expand Up @@ -115,7 +115,7 @@ module.exports = function(Chart) {
return me;
},

ensureScalesHaveIDs: function ensureScalesHaveIDs() {
ensureScalesHaveIDs: function() {
var options = this.options;
var scalesOptions = options.scales || {};
var scaleOptions = options.scale;
Expand All @@ -136,7 +136,7 @@ module.exports = function(Chart) {
/**
* Builds a map of scale ID to scale object for future lookup.
*/
buildScales: function buildScales() {
buildScales: function() {
var me = this;
var options = me.options;
var scales = me.scales = {};
Expand All @@ -154,7 +154,7 @@ module.exports = function(Chart) {
items.push({ options: options.scale, dtype: 'radialLinear', isDefault: true });
}

helpers.each(items, function(item, index) {
helpers.each(items, function(item) {
var scaleOptions = item.options;
var scaleType = helpers.getValueOrDefault(scaleOptions.type, item.dtype);
var scaleClass = Chart.scaleService.getScaleConstructor(scaleType);
Expand Down Expand Up @@ -186,7 +186,7 @@ module.exports = function(Chart) {
Chart.layoutService.update(this, this.chart.width, this.chart.height);
},

buildOrUpdateControllers: function buildOrUpdateControllers() {
buildOrUpdateControllers: function() {
var me = this;
var types = [];
var newControllers = [];
Expand Down Expand Up @@ -219,7 +219,7 @@ module.exports = function(Chart) {
return newControllers;
},

resetElements: function resetElements() {
resetElements: function() {
var me = this;
helpers.each(me.data.datasets, function(dataset, datasetIndex) {
me.getDatasetMeta(datasetIndex).controller.reset();
Expand Down Expand Up @@ -375,7 +375,7 @@ module.exports = function(Chart) {
helpers.each(me.data.datasets, function(dataset, datasetIndex) {
if (me.isDatasetVisible(datasetIndex)) {
var meta = me.getDatasetMeta(datasetIndex);
helpers.each(meta.data, function(element, index) {
helpers.each(meta.data, function(element) {
if (element.inRange(eventPosition.x, eventPosition.y)) {
elementsArray.push(element);
return elementsArray;
Expand Down Expand Up @@ -486,11 +486,11 @@ module.exports = function(Chart) {
return typeof meta.hidden === 'boolean'? !meta.hidden : !this.data.datasets[datasetIndex].hidden;
},

generateLegend: function generateLegend() {
generateLegend: function() {
return this.options.legendCallback(this);
},

destroy: function destroy() {
destroy: function() {
var me = this;
me.stop();
me.clear();
Expand All @@ -516,11 +516,11 @@ module.exports = function(Chart) {
delete Chart.instances[me.id];
},

toBase64Image: function toBase64Image() {
toBase64Image: function() {
return this.chart.canvas.toDataURL.apply(this.chart.canvas, arguments);
},

initToolTip: function initToolTip() {
initToolTip: function() {
var me = this;
me.tooltip = new Chart.Tooltip({
_chart: me.chart,
Expand All @@ -530,7 +530,7 @@ module.exports = function(Chart) {
}, me);
},

bindEvents: function bindEvents() {
bindEvents: function() {
var me = this;
helpers.bindEvents(me, me.options.events, function(evt) {
me.eventHandler(evt);
Expand Down
6 changes: 2 additions & 4 deletions src/core/core.datasetController.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ module.exports = function(Chart) {
me.updateElement(element, index, true);
},

buildOrUpdateElements: function buildOrUpdateElements() {
buildOrUpdateElements: function() {
// Handle the number of data points changing
var meta = this.getMeta(),
md = meta.data,
Expand All @@ -128,7 +128,7 @@ module.exports = function(Chart) {

draw: function(ease) {
var easingDecimal = ease || 1;
helpers.each(this.getMeta().data, function(element, index) {
helpers.each(this.getMeta().data, function(element) {
element.transition(easingDecimal).draw();
});
},
Expand All @@ -138,7 +138,6 @@ module.exports = function(Chart) {
index = element._index,
custom = element.custom || {},
valueOrDefault = helpers.getValueAtIndexOrDefault,
color = helpers.color,
model = element._model;

model.backgroundColor = custom.backgroundColor ? custom.backgroundColor : valueOrDefault(dataset.backgroundColor, index, elementOpts.backgroundColor);
Expand All @@ -151,7 +150,6 @@ module.exports = function(Chart) {
index = element._index,
custom = element.custom || {},
valueOrDefault = helpers.getValueAtIndexOrDefault,
color = helpers.color,
getHoverColor = helpers.getHoverColor,
model = element._model;

Expand Down
Loading