Setting Y-Axis Min/Max Programmatically

Thread is closed for posting
2 posts, 1 answers
  1. Caleb Sandfort
    Caleb Sandfort avatar
    38 posts
    Member since:
    Mar 2008

    Posted 22 Apr 2008 Link to this post


    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
  2. Answer
    Giuseppe avatar
    2363 posts

    Posted 23 Apr 2008 Link to this post

    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.

    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top