I want to display linechart but can't apply logic for outside range. If blood sugar level below 120 then should be highlight that point in orange dot. If blood sugar higher than 180 then should be highlight in red dot.
Use Chart: linechart of ng2-charts
dataset:
datasets: {
"datasets":[{"label":"Blood Sugar","data": [70,180,120,90,110,240,550,40], "fill":false }],
"labels":[ "low","high","normal","low","normal","high","high", "low" ],
}
Tried code:
"scales": { "yAxes":[{"display":false,"ticks":{"beginAtZero":true,"stepValue":10,"steps":10}}] }
Here is the solution for my question.
data: {
labels: x_data,
datasets: [
{
data: y_data,
label: "Test Data",
borderColor: "#3e95cd",
fill: false,
pointBackgroundColor: function(context) {
var index = context.dataIndex;
var value = context.dataset.data[index];
return value < 0 ? 'red' : 'green';
}
}
],
}