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

YAxis Label Formating

5 Answers 213 Views
Chart (obsolete as of Q1 2013)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Claude IMBERT
Top achievements
Rank 1
Claude IMBERT asked on 18 Jun 2008, 11:58 AM
Hello,

I put some data in my RadChart thanks to a datatable.

My data is  integers like '12000'', 50000', '100000' and represents milliseconds time.

Then, in my Bar Chart, that display bars, and my YAxis Label display '0', '20000',... and I want to display this number in this format : hh:mm:ss:fff

How can I do ?

Regards,

YSP


5 Answers, 1 is accepted

Sort by
0
Dwight
Telerik team
answered on 20 Jun 2008, 07:32 AM
Hello Claude,

There are a couple of ways to get the desired result:
  1. Convert the input to valid Ole Automation DateTime, then change the plot area's Y-axis value format:
    this.radChart1.PlotArea.YAxis.Appearance.ValueFormat = Telerik.Charting.Styles.ChartValueFormat.ShortTime; 
  2. On the BeforeLayout event, go through the Yaxis items collection and change the text of each item to the correct value:
    public Form1() 
        InitializeComponent(); 
     
        this.radChart1.BeforeLayout += new EventHandler<EventArgs>(radChart1_BeforeLayout); 
     
    private void radChart1_BeforeLayout(object sender, EventArgs e) 
        foreach (ChartAxisItem axisItem in this.radChart1.PlotArea.YAxis.Items) 
        { 
            axisItem.TextBlock.Text = "Custom string"
        } 
Should you need further assistance, just drop us a line.

Best wishes,
Evtim
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Claude IMBERT
Top achievements
Rank 1
answered on 23 Jun 2008, 02:54 PM
That's works. Thank you.

Now, I want to know how can I change the YAxis scale of my Chart.

In fact, before I had 0-100000-200000-300000 because my data was 32145-132657-265788 (For example) and now, I have 00:32:678- etc..

I want to tryto have correct scale like : 00:02:00-00:04:00 etc....

Best Regards,

YSP
0
Dwight
Telerik team
answered on 25 Jun 2008, 07:36 AM
Hi Claude,

Setting custom scale on X or Y axis is done through the AddRange method of the respective axis in the plot area. Please, review the following posts:
Dynamically change the Step/Min/Max value
Problem on Scale Breaks(it is not appearing)




All the best,
Evtim
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Hassan
Top achievements
Rank 1
answered on 20 Jul 2009, 07:49 PM
I am using Reporting 2009 Q2 version on windows form. would you please tell me if BeforeLayout is supported? I would like to change the YAxis label and it seems that's the only way.

Thanks,
HF
0
Giuseppe
Telerik team
answered on 23 Jul 2009, 11:45 AM
Hi Hassan,

Unfortunately the charting report item does not expose this event. You can still customize the axis labels in the NeedDataSource event handler, but you will need to disable the Axis.AutoScale feature and you will need to create each axis item on your own:

private void chart1_NeedDataSource(object sender, EventArgs e) 
    ChartSeries series = new ChartSeries(); 
    chart1.Series.Add(series); 
 
    for (int i = 0; i < 10; i++) 
    { 
        series.AddItem(new ChartSeriesItem(i)); 
    } 
 
    chart1.PlotArea.YAxis.AutoScale = false
    for (int j = 0; j < 5; j++) 
    { 
        ChartAxisItem item = new ChartAxisItem("TEST"); 
        item.Value = j * 2; 
        chart1.PlotArea.YAxis.Items.Add(item); 
    } 



Greetings,
Manuel
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.
Tags
Chart (obsolete as of Q1 2013)
Asked by
Claude IMBERT
Top achievements
Rank 1
Answers by
Dwight
Telerik team
Claude IMBERT
Top achievements
Rank 1
Hassan
Top achievements
Rank 1
Giuseppe
Telerik team
Share this question
or