I have a simple Chart.js line chart, which shows the costs of two decisions. I now want to show the break even of one over the other, which is basically the intersection.
I made an example of what I have so far here
var ctx = document.getElementById("chart");
var options = {
type: 'line',
data: {
labels: ["1", "2", "4", "6", "7", "10"],
datasets: [
{
backgroundColor: "rgba(151,187,205,0.2)",
borderColor: "rgba(151,187,205,1)",
data: [80, 80, 80, 80, 80, 80]
},
{
backgroundColor: "rgba(220,220,220,0.2)",
borderColor: "rgba(220,220,220,1)",
data: [8.84, 17.68, 35.36, 53.04, 70.72, 88.4]
}
]
},
options: {
tooltips: {
enabled: false
},
legend: {
position: 'top'
}
}
};
var myChart = new Chart(ctx, options);
How can I
- Show a tooltip at the interception of the two lines
- Show the values for the interception (inside a tooltip or at the axis)
- Move the legend inside the chart
Any help would be appreciated. Thank you.