Product Bundles
DevCraft
All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:
Web
Mobile
Document Management
Desktop
Reporting
Testing & Mocking
CMS
UI/UX Tools
Debugging
Free Tools
Support and Learning
Productivity and Design Tools
Hi Anu,
I am not sure I understood the exact scenario you want to achieve. The legend does not have a click event.
If you want to add/remove series to the chart, for example, you can add a button above the chart and on button click to add/remove series.
The Chart Series is a collection, so you can add series to the char.
Example:
<Grid RowDefinitions="Auto,*"> <Button Text="add series " Clicked="Button_Clicked" /> <telerikChart:RadCartesianChart x:Name="chart" Grid.Row="1"> <telerikChart:RadCartesianChart.BindingContext> <local:CategoricalDataViewModel /> </telerikChart:RadCartesianChart.BindingContext> <telerikChart:RadCartesianChart.HorizontalAxis> <telerikChart:CategoricalAxis LabelFitMode="MultiLine" /> </telerikChart:RadCartesianChart.HorizontalAxis> <telerikChart:RadCartesianChart.VerticalAxis> <telerikChart:NumericalAxis LabelFitMode="MultiLine" /> </telerikChart:RadCartesianChart.VerticalAxis> <telerikChart:RadCartesianChart.Series> <telerikChart:BarSeries ValueBinding="Value" CategoryBinding="Category" ItemsSource="{Binding Data}" /> </telerikChart:RadCartesianChart.Series> </telerikChart:RadCartesianChart> </Grid>
and on button click:
private void Button_Clicked(object sender, System.EventArgs e) { this.chart.Series.Add(new BarSeries { ValueBinding = new PropertyNameDataPointBinding("Value"), CategoryBinding = new PropertyNameDataPointBinding("Category") }); this.chart.Series[1].SetBinding(ChartSeries.ItemsSourceProperty, "Data1"); }
Hi Anu,
I am not sure I understood the exact scenario you want to achieve. The legend does not have a click event.
If you want to add/remove series to the chart, for example, you can add a button above the chart and on button click to add/remove series.