Labeling and Data (ChartJS)

👍:0 $.get does not evaluate to a return value like a normal function call. When the data is received from http://velocity.data.wpengine.com:3000/tickets/, your callback function gets called. In your case that is function(data){ alert(JSON.stringify(data));} You have access to the returned data inside this callback function. And you’re just alerting it. Which is why you simply get … Read more

Display data label (legend) in line-chart using chartjs

👍:0 Use generateLegend to get the legend HTML and put in the HTML element of your choice. document.getElementById(“legend”).innerHTML = myLineChart.generateLegend(); with HTML <div id=”legend”></div> You’d also want to style it #legend ul { list-style: none; font-family: ‘Helvetica Neue’, ‘Helvetica’, ‘Arial’, sans-serif; font-size: 12px; } #legend ul span { display: inline-block; height: 1em; width: 1em; margin-right: … Read more

Chart.js how to rewrite x for webAPP

0👍 ✅ You could extend the chart to remove the points that you don’t need from the x-axis, like so (adapted from https://stackoverflow.com/a/31606933/360067) Chart.types.Line.extend({ name: “LineAlt”, initialize: function (data) { Chart.types.Line.prototype.initialize.apply(this, arguments); if (this.options.every) { var every = this.options.every; var xLabels = this.scale.xLabels xLabels.forEach(function (label, i) { if (i % every !== 0) xLabels[i] = … Read more