1๐
I had the same problem for a long time. I finally found that I needed to clear the dataset and add the new data back into a new dataset, then update the chart.
I am clearing the data set with:
_lineConfig.Data.Datasets.Clear();
Then I create a new version as below:
TempProductionLineTotal = SqlProdData.GetProductionTotals(searchDate[0], searchDate[1]);
_productionDataSet = new LineDataset<TimeTuple<int>>
{
BackgroundColor = ColorUtil.FromDrawingColor(System.Drawing.Color.Orange),
BorderColor = ColorUtil.FromDrawingColor(System.Drawing.Color.Orange),
Label = "Daily Total",
Fill = false,
BorderWidth = 2,
PointRadius = 1,
PointBorderWidth = 2,
SteppedLine = SteppedLine.False,
Hidden = false,
LineTension = 0.0
};
_productionDataSet.AddRange(TempProductionLineTotal.Select(p =>
new TimeTuple<int>(new Moment(p.DateNTime), Convert.ToInt32(p.Daily_Lineal))));
_lineConfig.Data.Datasets.Add(_productionDataSet);
- [Chartjs]-Chart.js โ link to other page when click on specific section in chart
- [Chartjs]-How to add panning to chart in chartjs?
Source:stackexchange.com