Chart content not getting loaded in popup

👍:0 I think you need to make a few changes to get it to work. L.DomUtil.create(‘canvas’, ‘popupGraph’); You are creating a canvas element with class popupGraph, but you don’t append it to the DOM structure (i.e. there is no container). I don’t see it used in the code sample too. var ctx = document.getElementById("popupChart").getContext("2d"); At … Read more

Chart.js – Adding Legend in a JSP Page

👍:0 You can build the legendTemplate first in your server side script block String serverSideLegendTemplate = “<ul class=\””; serverSideLegendTemplate += name.toLowerCase(); serverSideLegendTemplate += “-legend\” style=\”list-style:none;font-family:HP Simplified;\”>”; for (var i=0; i<segments.length; i++) { … And then simply print out the legendTemplate myDoughnutChart = new Chart(ctx).Doughnut(data, { legendTemplate: “<%=serverSideLegendTemplate%>” }); This will make it clearer and easier … Read more

Placeholder on canvas of ChartJs and Angular

👍:0 You can trun on the legend and override the legend template to show the values in the legend $scope.options = { legendTemplate: “<ul class=\”<%=name.toLowerCase()%>-legend\”><% for (var i=0; i<segments.length; i++){%><li><span style=\”background-color:<%=segments[i].fillColor%>\”></span><%if(segments[i].label){%><%=segments[i].label%>: <%=segments[i].value%><%}%></li><%}%></ul>” }; If you want to show the value only if they are 0, just add an if condition $scope.options = { legendTemplate: “<ul … Read more

Cannot use npm module react-chartjs with React

0👍 ✅ I had been defining React by including it on my html page: <script src=”https://cdnjs.cloudflare.com/ajax/libs/react/0.13.0/react.js”></script> What fixed the problem was requiring it instead in my .jsx file: var React = require(“react”); Not sure why this worked but from reading around, perhaps there were multiple initializations and/or definitions of React that were causing conflicts. Thanks … Read more

Tooltips displaying "rgb(0,0,0)" instead of label value on bar chart

0👍 ✅ I have fixed it with the code above… // Adding this to the this.data.labels initialization labels: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(eachToString), // The eachToString function function eachToString(el) { return el.toString()+”%”; } But as the bug it is, the issue at Github remains open. Chartsjs 2 (Alpha) not … Read more