I'm using a RadHtmlChart based on HTML5 from telerik. I'm using a Pie Chart, and I want to display the method's values. How should I save the values -- maybe as a list? It shouldn't have a big impact on the method itself, because I need this method for some report stuff.
Selecting a List of Custom Object as a datasource type is a viable solution. You can have a look at this online demo showing how to do that or look at other datasource types as well.
If, however, the elements of your chart are dynamic (depending on external methods/parameters) you can create your chart programmatically, following the approach in this online demo.
Regarding your current method GetBookedVacation, note that it returns just a double number. Could you give more information about your scenario:
Where in your HtmlChart do you want to put that double value? Is it supposed to be the datasource itself - in that case your chart will have one Series with one SeriesItem.
OR maybe it is supposed to be included somewhere else in the chart - for example in the chart Title?
If you need this method to pass the resulting data directly to the chart it should return the corresponding type instead of an integer (e.g. List<myObjects>). If the method has to return this value but populating the chart is a side effect you should build the datasource in the method and assign it there before the return statement.
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.