Is it possibile to add a horizontal line to an existing chart in Chart.js?
Here the example char code:
// the canvas
<canvas id="myChart" width="800" height="200"></canvas>
// the js
var ctx = document.getElementById("myChart").getContext("2d");
var myNewChart = new Chart(ctx).Bar(data);
I want to add a horizontal marker line (eg. at y=100 like in this fiddle for highcharts)
Yes you can actually do that. You want the horizontal marker line so you need to add this code inside your y-axis
plotLines: [{
color: '#FF0000',
width: 2,
value: .50 * 200 // The marker value will be 100
// Or you can just set its value to 100
}]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With