Javascript examples for Chart.js:Chart Tooltip
Set custom colours for tooltip squares Chart.js
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.11.0.js"></script> <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js"></script> <script type="text/javascript"> $(window).load(function(){//from w w w. j av a 2s. c om var originalDraw = Chart.MultiTooltip.prototype.draw; Chart.MultiTooltip.prototype.draw = function() { this.legendColors[0].fill = "green"; this.legendColors[1].fill = "blue" originalDraw.call(this, arguments) } Chart.types.Bar.extend({ name: "BarAlt", initialize: function(data){ Chart.types.Bar.prototype.initialize.apply(this, arguments); data.datasets[0].fillColor = "Blue"; }, draw: function(){ Chart.types.Bar.prototype.draw.apply(this, arguments); } }); //Bar chart with two bars var barData2 = { labels: ["John W", "Ben T", "Jenny H", "Samantha D", "Anothony P"], datasets: [ { fillColor: "rgba(153, 153, 155, 0.4)", highlightFill: "#7C7C7C", strokeColor: "#7C7C7C", pointColor: "#7C7C7C", pointStrokeColor: "#7C7C7C", pointHighlightFill: "#fff", data: [25, 94, 68, 175, 66] }, { fillColor: "rgba(236,166,166,0.4)", highlightFill: "#C3090A", strokeColor: "#f9090a", pointColor: "#fff", pointStrokeColor: "#C3090A", pointHighlightFill: "#f9090a", data: [134, 112, 92, 160, 52] } ] }; options = { responsive: true, scaleFontSize: 11, bezierCurve: true, animation: false }; var ctx = $("#bar").get(0).getContext("2d"); var myChart = new Chart(ctx).BarAlt(barData2, options); }); </script> </head> <body> <canvas id="bar" width="390" height="225"></canvas> </body> </html>