]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Doughnut chart tooltips work
authoretimberg <evert.timberg@gmail.com>
Sat, 31 Oct 2015 00:48:31 +0000 (20:48 -0400)
committeretimberg <evert.timberg@gmail.com>
Sat, 31 Oct 2015 00:48:31 +0000 (20:48 -0400)
src/controllers/controller.doughnut.js

index 1188a7c2b5721d0d5d647754388fa78e7779f033..7e724d15c564779548392be99267c1cdafc9639b 100644 (file)
                },
                //The percentage of the chart that we cut out of the middle.
                cutoutPercentage: 50,
+
+               // Need to override these to give a nice default
+               tooltips: {
+                       callbacks: {
+                               title: function() { return '' },
+                               label: function(tooltipItem, data) {
+                                       return data.labels[tooltipItem.index] + ': ' + data.datasets[tooltipItem.datasetIndex].data[tooltipItem.index];
+                               }
+                       }
+               }
        };
 
        Chart.defaults.pie = helpers.clone(Chart.defaults.doughnut);