var workDuration = graphElementViewModels.Select(w => new
category = w.strCategory,
value = w.dblValue,
color = w.strColor
ViewData["arWorkDuration"] = workDuration;
3 Answers, 1 is accepted
answered on 25 Jul 2017, 06:52 AM
Thank you for the provided code.
The described result is expected because the refresh method will only redraw the Chart using the current data and it will not set a new one.
In this scenario, I can suggest the two approaches. Using a Kendo UI DataSource for the Chart which will allow redrawing the data by calling the read method of the Chart. The other option will be to manually set the new data to the Chart series and then refresh it.
More information for both implementations can be found in the following forum thread:
I have modified my code using a ViewModel because I suspect that perhaps the use of the ViewBag could bring unexpected result.
Here is my code but as you will notice I did not find a way to set the series with the color inside my ViewModel as KendoChart seem to accept only two parameters. So I have used the SeriesColors property instead to set the colors (not so useful that if color could be inside the ViewModel). Am I Right ?
My View (including stuff to populate grandTotal in the title):