I am using chart.js library for plotting a line graph with two series in my angular 5 application. Following is my code from ts file :
this.myChart = new Chart(this.ctx, {
type: 'line',
data: {
labels: labels,
datasets: [{
label: 'Data1',
data: [100, 345, 657, 788, 300],
fill: false,
backgroundColor: '#3C96D2',
pointRadius: 1,
borderColor: '#3C96D2',
pointHoverRadius: 3
},
{
label: 'Data2',
data: [567, 879, 200, 800],
fill: false,
backgroundColor: '#122449',
pointRadius: 1,
borderColor: '#122449',
pointHoverRadius: 3
}
]
},
options: {
layout: {
padding: {
left: 50,
right: 0,
top: 0,
bottom: 0
}
},
hover: {
mode: 'point',
},
scales: {
yAxes: [{
ticks: {
beginAtZero: false
},
scaleLabel: {
display: true,
labelString: 'prices'
}
}],
xAxes: [{
scaleLabel: {
display: true,
labelString: 'Year'
}
}],
}
}
});
It correctly plots the line graph with two datasets. What I want to find out is the point of intersection of these two lines and display some custom div at that point on the graph. I am also open to use any other plugin for the same. Already tried using amcharts, but didn't find any solution. Any help is much appreciated.