This is a migrated thread and some comments may be shown as answers.

[Solved] Update Category Axis when Databinding

1 Answer 79 Views
Chart
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Marcel
Top achievements
Rank 1
Marcel asked on 08 Jun 2012, 09:29 AM
Hi, my chart which I am using is below:
 

                 @(Html.Telerik().Chart(new List<SeriesData>())
                    .Name("Chart")
                    .Title("Chart (Week)")
                    .Legend(legend => legend.Position(ChartLegendPosition.Top))
                    .Series(series => {series.Column(s => s.Value).Name("Data");})
                    .CategoryAxis(axis => axis.Categories(s => s.Date ))
                    .ValueAxis(axis => axis.Numeric())
                    .Tooltip(tooltip => tooltip.Visible(true))
                    .HtmlAttributes(new {style = "width: 400px; height: 300px; "})
                    .DataBinding(dataBinding => dataBinding.Ajax()
                    .Select("GraphData", "DataActivity", new { span = 1, type = 2 }))
                )

Currently the DataBinding is working. It updates the values. But,
the CategoryAxis never updates with the rebind. Which is annoying as I pass in an empty
list to start with but then I obtain my data with the ajax call I get the values but no axis labels.
My Axis labels (i.e. the date) are obtained with the databinding as they are set within
my LIST of SeriesData i get back. 

Anyone got this working? Or have a solution? 

Thanks 


 
 



1 Answer, 1 is accepted

Sort by
0
Marcel
Top achievements
Rank 1
answered on 08 Jun 2012, 11:50 AM
Stupid question, I just needed to do this:

@(Html.Telerik().Chart<SeriesData>()

All working now. 
 
Tags
Chart
Asked by
Marcel
Top achievements
Rank 1
Answers by
Marcel
Top achievements
Rank 1
Share this question
or