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

manually set AxisX

5 Answers 61 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Mickael
Top achievements
Rank 1
Mickael asked on 28 Apr 2011, 10:49 AM
Hello,

It's possible to define manually maximum et minimum of AxisX.

Example :

Data : (2.12, 3.25, 4.25, 6.21, 1.25, 10.24)

I want minimum AxisX = 2 and maximum AxisX = 11 but i have to manually change it how ?


Best redards

5 Answers, 1 is accepted

Sort by
0
David
Top achievements
Rank 2
answered on 29 Apr 2011, 12:51 PM
Hi,

If you are not using the default layout:
<telerik:RadChart UseDefaultLayout="False"
  <telerik:ChartArea
    <telerik:ChartArea.AxisX
      <telerik:AxisX AutoRange="False" MinValue="2" MaxValue="11" /> 
    </telerik:ChartArea.AxisX
  </telerik:ChartArea
</telerik:RadChart>
or if you are using the default layout:
<telerik:RadChart UseDefaultLayout="True"
  <telerik:RadChart.DefaultView>
    <telerik:ChartDefaultView>
      <telerik:ChartDefaultView.ChartArea>
        <telerik:ChartArea.AxisX
          <telerik:AxisX AutoRange="False" MinValue="2" MaxValue="11" /> 
        </telerik:ChartArea.AxisX
      </telerik:ChartDefaultView.ChartArea>
    </telerik:ChartDefaultView>
  </telerik:RadChart.DefaultView>
</telerik:RadChart>

Kind regards,
Dave.
0
Mickael
Top achievements
Rank 1
answered on 04 May 2011, 08:33 AM
Hello, 

But my data are not digital, but are datetime.

So how to put the MinValue and MaxValue because I do not?
0
Evgenia
Telerik team
answered on 09 May 2011, 08:30 AM
Hi Mickael,

You can set custom Range for the Axis as David pointed out. Have in mind that if you are setting the DateTime values to XValue property of the Chart, the DateTime values have to be converted to their OLE Automation. For more information refer to our help topic.
In general you can set custom Range for the XAxis like this:

DateTime baseDate = DateTime.Today;
RadChart1.DefaultView.ChartArea.AxisX.AutoRange = false;
RadChart1.DefaultView.ChartArea.AxisX.AddRange(baseDate.ToOADate(), baseDate.AddDays(20).ToOADate(), 1);

Greetings,
Evgenia
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Mickael
Top achievements
Rank 1
answered on 12 May 2011, 03:29 PM
Hello,

it's ok, but I like to have a defined interval (example: 12:00, 13:00, 14:00, ...)

I want my interval is 1h for example, without taking into account data.

How do I do?
0
Evgenia
Telerik team
answered on 17 May 2011, 12:47 PM
Hi Mickael,

Since the data you have is DateTime, to be able to make the Step of the Axis 1 hour you should divide the hours by 24 like this for example:

RadChart1.DefaultView.ChartArea.AxisX.AddRange(new DateTime(2011, 5, 17, 12, 0, 0), new DateTime(2011, 5, 18, 0, 0, 0), 1/24d)

Regards,
Evgenia
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Chart
Asked by
Mickael
Top achievements
Rank 1
Answers by
David
Top achievements
Rank 2
Mickael
Top achievements
Rank 1
Evgenia
Telerik team
Share this question
or