Merge pull request #1670 from nnnick/fix/1643

Fixes scatter and bubble chart tooltips
This commit is contained in:
Evert Timberg
2015-11-21 09:20:58 -05:00
2 changed files with 28 additions and 8 deletions

View File

@@ -24,14 +24,23 @@
},
tooltips: {
template: "(<%= value.x %>, <%= value.y %>)",
multiTemplate: "<%if (datasetLabel){%><%=datasetLabel%>: <%}%>(<%= value.x %>, <%= value.y %>)",
callbacks: {
title: function(tooltipItems, data) {
// Title doesn't make sense for scatter since we format the data as a point
return '';
},
label: function(tooltipItem, data) {
return '(' + tooltipItem.xLabel + ', ' + tooltipItem.yLabel + ')';
}
}
},
};
// Register the default config for this type
Chart.defaults.bubble = defaultConfig;
Chart.Bubble = function(context, config) {
config.options = helpers.configMerge(defaultConfig, config.options);
config.type = 'bubble';
return new Chart(context, config);
};

View File

@@ -24,15 +24,26 @@
},
tooltips: {
template: "(<%= value.x %>, <%= value.y %>)",
multiTemplate: "<%if (datasetLabel){%><%=datasetLabel%>: <%}%>(<%= value.x %>, <%= value.y %>)",
callbacks: {
title: function(tooltipItems, data) {
// Title doesn't make sense for scatter since we format the data as a point
return '';
},
label: function(tooltipItem, data) {
return '(' + tooltipItem.xLabel + ', ' + tooltipItem.yLabel + ')';
}
}
},
};
// Register the default config for this type
Chart.defaults.scatter = defaultConfig;
// Scatter charts use line controllers
Chart.controllers.scatter = Chart.controllers.line;
Chart.Scatter = function(context, config) {
config.options = helpers.configMerge(defaultConfig, config.options);
config.type = 'line';
config.type = 'scatter';
return new Chart(context, config);
};