0👍
As of now best solution I can get is to use mix line graph with bubble graph by adding dataset like this
new Chart(document.getElementById("total-chart"), {
type: 'line',
data: {
labels: [ {!! $dates_string !!} ],
datasets: [
{
data: [ {!! $totals_string !!} ],
label: 'Totals',
// steppedLine: true,
borderColor: "#3e95cd",
labels: [ {!! $dates_string !!} ],
pointRadius: 1,
fill: false
},
{
data: [ {
x: '2018-01-18',
y: 24500,
r: 5
} ],
label: ['Diff'],
// steppedLine: true,
backgroundColor: "#cd2026",
type: 'bubble'
}
]
},
options: {
title: {
display: true,
text: 'Total'
},
tooltips: {
intersect: false,
mode: 'index'
},
animation: {
duration: 0
}
}
);
result looks somewhat like this.
However label for bubble is funny since I have non numerical x axis. it shows only why mouse is hovered right on x -axis . rest all works as expected
- [Chartjs]-React without npm – is it possible to import libraries / modules?
- [Chartjs]-React testing library: can't acquire context from the given item
Source:stackexchange.com