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

[Solved] RadCartesianChart Title in code

4 Answers 357 Views
Chart for XAML
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
ahmad
Top achievements
Rank 1
ahmad asked on 07 Mar 2013, 09:39 PM
Dears , 

i neet to set the RadCartesianChart  Title in C# code , i can create series but i need to set the title now only in c# ,

and if there's any sample for creating Legend dynamically in c# and also setting the Category it will be great 

Thanks 

Best Regards.

Ahmad Barghouti

4 Answers, 1 is accepted

Sort by
0
Ivaylo Gergov
Telerik team
answered on 08 Mar 2013, 03:06 PM
Hello Ahmad,

Thank you for your interest in our RadControls for Windows 8.

If I understand you correctly you want to create dynamically a RadLegendControl which is bound to an existing RadCartesianChart. Here's a sample setup of this scenario:

RadLegendControl legend = new RadLegendControl();
legend.SetBinding(RadLegendControl.LegendProviderProperty, new Binding { ElementName = "chart" });
this.grid.Children.Add(legend);

Where "chart" is the name of your RadCartesianChart and "grid" is the name of its container which in our case is Grid.
Then I assume that you want to change the Category of an existing DataPoint dynamically. You can achieve it like this:
(this.chart.Series[0] as CategoricalSeries).DataPoints[0].Category = "NewCategory";

About the other question - can you please clarify what exactly do you mean by "RadCartesianChart Title"?
If it is a LegendTitle:
this.chart.Series[0].LegendTitle = "NewLegendTitle";
If it is Axis Title:
this.chart.HorizontalAxis.Title = "NewAxisTitle";

Let me know if this helps.

Kind regards,
Ivaylo Gergov
the Telerik team
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
0
ahmad
Top achievements
Rank 1
answered on 11 Mar 2013, 01:46 PM
Thanks Dear , it working :)
0
Andrew
Top achievements
Rank 1
answered on 28 Mar 2013, 11:06 AM
I too am looking for a way to set the chart title, but not for an axis or legend, rather a title at the top of the chart, as shown in this Silverlight example for RadChart: http://www.telerik.com/help/silverlight/radchart-features-chart-title.html

Is this available in WPF RadCartesianChart? It seems like a very basic piece of functionality but I'm unable to find how to set it. 

Thanks, 

Andy.
0
Ivaylo Gergov
Telerik team
answered on 29 Mar 2013, 05:14 PM
Hello Andrew,

Thank you for your interest.

RadCartesianChart (and RadChartView in general) does not provide support for chart title out-of-the-box. However, as the chart title is basically a simple textblock and its positioning does not depend on the different parts of the control you should be able to manually add one external TextBlock to serve this purpose easily.

I hope this information is useful.

 

All the best,
Ivaylo Gergov
the Telerik team
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
Tags
Chart for XAML
Asked by
ahmad
Top achievements
Rank 1
Answers by
Ivaylo Gergov
Telerik team
ahmad
Top achievements
Rank 1
Andrew
Top achievements
Rank 1
Share this question
or