]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Update default tooltip callbacks for bubble charts
authorEvert Timberg <evert.timberg@gmail.com>
Fri, 20 Nov 2015 02:12:23 +0000 (21:12 -0500)
committerEvert Timberg <evert.timberg@gmail.com>
Fri, 20 Nov 2015 02:12:23 +0000 (21:12 -0500)
src/charts/Chart.Bubble.js

index d4715c026854688aeff84d1628be27cdae199736..a6b03c1fca7d8bf8c63937b270aa7787a063da94 100644 (file)
                },
 
                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.options = helpers.configMerge(defaultConfig, config.options);
                config.type = 'bubble';
                return new Chart(context, config);
        };