Hi
I am trying to do a simple bar chart showing the following data;
Group Value
I wish to have the above groups as labels in the x-asis, but the barchart always shows 1,2,3
Can you please give me a simple example on how to achieve the above.
Regards
I am trying to do a simple bar chart showing the following data;
Group Value
Group 1 | 140.30 |
Group 2 | 5.00 |
Group 3 | 81.70 |
I wish to have the above groups as labels in the x-asis, but the barchart always shows 1,2,3
Can you please give me a simple example on how to achieve the above.
Regards
8 Answers, 1 is accepted
0
Hi Richard,
After you have added your DataSeries to the ChartArea you can manually access the AxisX.TickPoints collection and set a custom label to any TickPoint within. This could be accomplished with code like this:
Hope this will help.
Kind regards,
Velin
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
After you have added your DataSeries to the ChartArea you can manually access the AxisX.TickPoints collection and set a custom label to any TickPoint within. This could be accomplished with code like this:
string[] groups = new string[] { "Group1", "Group2", "Group3" }; |
this.RadChart1.DefaultView.ChartArea.DataSeries.Add(series); |
TickPointCollection tickPoints = RadChart1.DefaultView.ChartArea.AxisX.TickPoints; |
foreach (TickPoint point in tickPoints) |
{ |
point.Label = groups[tickPoints.IndexOf(point)]; |
} |
Hope this will help.
Kind regards,
Velin
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Richard
Top achievements
Rank 1
answered on 10 Jan 2009, 10:02 AM
Hi Velin
This worked fine many thanks!
Regards
This worked fine many thanks!
Regards
0
Jayesh
Top achievements
Rank 1
answered on 10 Feb 2009, 09:44 AM
Hi
I am using RadControls for Winforms Q1 2008 SP1. TickPointCollection does not seem to be present in this release. Is there another way to change the X-Axis labels in this release?
Regards
Jashin
0
Hi Jashin,
First, I would like to inform you that there is a separate forum for questions related to RadChart for WinForms as it a completely different product. Please consider writing your future questions here. Thank you.
And onto your question -- if you are populating RadChart X axis manually, the items are available in RadChart1.PlotArea.XAxis.Items collection. However, if you use the default AutoScale=true setting, the items will be auto-generated and available in the BeforeLayout event handler:
Hope this helps.
Regards,
Velin
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
First, I would like to inform you that there is a separate forum for questions related to RadChart for WinForms as it a completely different product. Please consider writing your future questions here. Thank you.
And onto your question -- if you are populating RadChart X axis manually, the items are available in RadChart1.PlotArea.XAxis.Items collection. However, if you use the default AutoScale=true setting, the items will be auto-generated and available in the BeforeLayout event handler:
foreach (ChartAxisItem item in RadChart1.PlotArea.XAxis.Items) |
{ |
item.TextBlock.Text = "Custom Axis Label"; |
} |
Hope this helps.
Regards,
Velin
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Nick
Top achievements
Rank 1
answered on 13 Mar 2009, 03:02 PM
Is there any way of fomatting the string on the X axis so that the string is virtical - I have around 60 points with very long labels. It just doesn't dispay well with lables over 10 characters or so?
0
Hi Nick,
With the Q1 2009 release of RadChart you can rotate the labels on the X axis by applying a simple style to the AxisXLabel2D control. Here is the markup:
Best wishes,
Velin
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
With the Q1 2009 release of RadChart you can rotate the labels on the X axis by applying a simple style to the AxisXLabel2D control. Here is the markup:
<Style TargetType="telerik:AxisXLabel2D"> |
<Setter Property="LayoutTransform"> |
<Setter.Value> |
<RotateTransform Angle="-90"/> |
</Setter.Value> |
</Setter> |
</Style> |
Best wishes,
Velin
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Chris
Top achievements
Rank 1
answered on 04 Jun 2009, 06:52 AM
Hi,
we using code behind example to create a chart. how can i get following done in code behind not sure how to get to this propert from code:
following works in xamel but need to do from code
thx
we using code behind example to create a chart. how can i get following done in code behind not sure how to get to this propert from code:
following works in xamel but need to do from code
<Style TargetType="telerik:AxisXLabel2D"> |
<Setter Property="LayoutTransform"> |
<Setter.Value> |
<RotateTransform Angle="-90"/> |
</Setter.Value> |
</Setter> |
</Style> or
<telerik:LabelFormatConverter
x:Key="labelFormatConverter" />
<Style
TargetType="telerik:AxisXLabel2D">
<Setter
Property="LayoutTransform">
<Setter.Value>
<RotateTransform
Angle="-90" />
</Setter.Value>
</Setter>
|
thx
0
Hi Chris,
I'm afraid the only option to modify the appearance of these elements is through a custom style defined as StaticResource. There is no public API exposing AxisXLabel2D objects as they are part of the visual tree and generated in run time.
All the best,
Velin
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
I'm afraid the only option to modify the appearance of these elements is through a custom style defined as StaticResource. There is no public API exposing AxisXLabel2D objects as they are part of the visual tree and generated in run time.
All the best,
Velin
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.