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

Custom laber for AxisY and AxisY2

3 Answers 60 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Giovanni
Top achievements
Rank 1
Giovanni asked on 04 Sep 2008, 09:43 PM
Is it possible to set custom label for the Y axis like in an specific value in the chart

I'm trying the following code:

 Telerik.Charting.ChartAxisItem customy;

                customy = new ChartAxisItem();

                customy.Visible = true;
                customy.Value = 0.5;
                customy.TextBlock.Text = "Custom 1 ";
                this.RadChart1.PlotArea.YAxis2.AddItem(customy);

3 Answers, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 05 Sep 2008, 06:09 AM
Hello Giovanni,

You have two options:
  • Set RadChart1.PlotArea.YAxis2.AutoScale to false. Now it is your responsibility to provide the axis items. You can use AddRange to add several items or AddItem to add a single item.
  • Leave RadChart1.PlotArea.YAxis2.AutoScale to its default value (true). Wire BeforeLayout event. At this stage of the control lifecycle the axis items are already created, so you can modify them. Here is an example: RadChart1.PlotArea.YAxis2.Items[1].TextBlock.Text = "My CustomText";
You can find more details about RadChart axes here.

Sincerely,
Ves
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Giovanni
Top achievements
Rank 1
answered on 05 Sep 2008, 02:37 PM
When i use autoscale = false and try to render my own Axis seems that the control puts them randomly not like in the specific value that i assigned in the Axis.Value, so maybe can you give me an example of how to do that. is lie i'm trying to mark some specific points in the chart.
0
Ves
Telerik team
answered on 08 Sep 2008, 02:52 PM
Hi Giovanni,

RadChart will put the ticks (major and minor) on even intervals on Y axis, while the axis items will respect the Value property. Unfortunately, you cannot force a tick to appear at a certain position. You might calculate the step, so that the custom value matches a certain tick. Please, find a sample attached to this thread.

Best regards,
Ves
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Chart (Obsolete)
Asked by
Giovanni
Top achievements
Rank 1
Answers by
Ves
Telerik team
Giovanni
Top achievements
Rank 1
Share this question
or