This is a migrated thread and some comments may be shown as answers.
Server Binding on List<T> Chart not working
1 Answer 31 Views
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Peter
Top achievements
Rank 1
Peter asked on 06 Oct 2011, 02:21 AM

I have a chart that is not populating.  It is server binding
Any reason why it is not working? Any help would be appreciated. Thx

In The controller:

public

 

 

ActionResult FetchStates()

 

{

 

 

List

 

 

<State> states = new List<State>();

 

 

 

states = States.GetList();

 

return(states);
}

In View:

 

<%

 

= Html.Telerik().Chart<ALSCanada.EnviroLims.WebCel.Models.State>()

 

.Name(

 

"chart")

 

.Title(title => title

.Text(

 

"Bubble Tracking")

 

)

.Legend(legend => {

legend.Border(1,

 

"black").Margin(10);

 

legend.Position(

 

ChartLegendPosition.Top);

 

})

.SeriesDefaults(defaults => {

defaults.Column().Stack(

 

true);

 

})

.Series(series => {

series.Column(s => s.S).Name(

 

"S");

 

series.Column(s => s.W).Name(

 

"W");

 

series.Column(s => s.A).Name(

 

"A");

 

})

.HtmlAttributes(

 

new { style = "width: 400px; height: 300px"})

 

.CategoryAxis(axis => axis

.Categories(s=> s.ID)

)

 

 

 

 

%>

ALso if I click on a chart stack is there a way to get the ID from the category for the stack in a chart event?

Thx P

1 Answer, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 10 Oct 2011, 02:53 PM
Hi Peter,

The Chart configuration looks fine, but it is not clear how the data from the FetchStates makes it to the view. 
Can you please attach the full controller and view code?

You can get the category from the client-side OnSeriesClick event. Please see the online help.

Greetings,
Tsvetomir Tsonev
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 Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
Tags
Chart
Asked by
Peter
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Share this question
or