Hello everyone, I am working with a line graph and I take the values for a query and I load them to the graph by means of a ViewBag, in this way I can use dynamic data.
What I can not do is that the number of lines and the names of these (in the property: ‘name’) can enter them dynamically and not fixed as I am doing now putting each line “Name”, my intention in load X number of lines each with its name, its values and properties dynamically, possibly through a for each, is it possible?
Yes, I uploaded the controller file where I take the data from the database and I save it in ViewBags and the page where I insert the data in the graphics, I hope that my problem is clearer now, thanks.
name: @ViewData [“nameExample”],
color: “# FFC371”,
in the parameter “name:” I put ViewData [“nameExample”] or @ViewData [“nameExample”] and it did not work. in the controller I put the value to the ViewData and if I inspect it I see that it maintains the value but I can not use it in the graph. If you see the code that I have, I have more than one line in the same graphic, but I have to define one by one its name and its values, therefore I can not dynamically show “X” lines without having to repeat the code as many times as lines want to show