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

Setting Y-Axis Min/Max Programmatically

1 Answer 272 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Caleb Sandfort
Top achievements
Rank 1
Caleb Sandfort asked on 22 Apr 2008, 11:45 PM
Hi

I have a chart that i am trying to use to display the prices for a particular stock over a given time period.

An example would be a stock with prices ranging from $35 to $40.  I am setting the y-axis min and max values in code behind when i get the stock prices from the database to something like 33 and 42 respectively.

uxRadChart_StockPrices.PlotArea.YAxis.MaxValue = stockPrices.Max(p => p.Price) + 2.0;  
uxRadChart_StockPrices.PlotArea.YAxis.MinValue = stockPrices.Min(p => p.Price) - 2.0;  
uxRadChart_StockPrices.PlotArea.YAxis.Step = (this.uxRadChart_StockPrices.PlotArea.YAxis.MaxValue - this.uxRadChart_StockPrices.PlotArea.YAxis.MinValue) / 10.0; 

But when the chart displays on the page the min and max values are 0 and 40 and the chart doesn't look very good because it just has a line near the top.

I also tried setting AutoLayout=true and got the same result.

Is there a different way I should go about doing this so that it will work?

Any suggestions would be appreciated

1 Answer, 1 is accepted

Sort by
0
Accepted
Giuseppe
Telerik team
answered on 23 Apr 2008, 07:05 AM
Hello Caleb Sandfort,

When you are setting the range manually like this you should set the AutoScale property of the YAxis to false.

Hope this helps.


Greetings,
Manuel
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Chart (Obsolete)
Asked by
Caleb Sandfort
Top achievements
Rank 1
Answers by
Giuseppe
Telerik team
Share this question
or