YAxis Extended mode bug

Thread is closed for posting
8 posts, 0 answers
  1. Marc
    Marc avatar
    39 posts
    Member since:
    Nov 2012

    Posted 27 Feb 2013 Link to this post

    When the smallest values of my series are 0 then the YAxis is not extended as expected even if it's not zero based and AutoScale set to true. To test, I changed the values that were at 0 to be -10 and then the YAxis is extended to make sure values are shown. I attached an image to show the bug.
  2. Missing user
    Missing user avatar

    Posted 04 Mar 2013 Link to this post

    Hello Marc,

    This behavior is expected, since by design AutoScale will favor 0 for the Y-Axis' minimum. To get around this, you can set the Y-Axis' range on your own by turning off AutoScale and manually setting the Minimum and Maximum.

    All the best,
    Ivan N.
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Marc
    Marc avatar
    39 posts
    Member since:
    Nov 2012

    Posted 04 Mar 2013 Link to this post

    Hi Ivan, thanks for your reply.

    The auto-scale is a very nice feature but when it work all the time. I think the 0 should have a major importance on auto-scale but just when the zero-bases property is set. So in the future it can be a good idea to add a property for this.

    I tried to modified 0 values a bit (e.g. by changing them to -0.01) to have no visual impact on values but the behavior still the same.

    Is there a way to know the algorithm of how Min and Max are auto-calculated because if I just take the Y range values +/- 10% by example I could have labels with values like 1.2334235221 instead of labels on round numbers like it is done by the component (e.g/ 1.25). It can be hard to define a new algorithm when you have one that work...

    Or is it possible to predict what will be the Min value if it was not truncated to 0 (I expect to have same thing when all values are less than 0 and the max is 0...but not tested). In other words, is it possible to know a good min values based on calculated values by the component because the min will affect all values in the Y-axis label.

    Thanks.

  5. Missing user
    Missing user avatar

    Posted 07 Mar 2013 Link to this post

    Hello Marc,

    I'm afraid I'm not currently at liberty to disclose how RadChart's AutoScale algorithm works. However, you can still use it through RadChart. You can wire the BeforeLayout event. At the moment this event is triggered, the Y axis is already configured, so you can extract its values and use them to produce your own custom range. Then call AddRange method to re-configure the axis:

    void RadChart1_BeforeLayout(object sender, EventArgs e)
       {
           double min = RadChart1.PlotArea.YAxis.MinValue;
           double max = RadChart1.PlotArea.YAxis.MaxValue;
           double step = RadChart1.PlotArea.YAxis.Step;
     
           RadChart1.PlotArea.YAxis.AutoScale = false;
           RadChart1.PlotArea.YAxis.AddRange(min - 2 * step, max + 2 * step, step);
       }

    Hope this helps.

    Best regards,
    Ivan N.
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  6. Marc
    Marc avatar
    39 posts
    Member since:
    Nov 2012

    Posted 11 Mar 2013 Link to this post

    I tried your solution but it cause other BIG problems. In my case I fill manually the values in the Page_Load event and in the OnBeforeLayout as you suggest I change the Y-Axis. When I do that, the scaling of the Y-Axis is changed but the series don't followed.
    As you can see in the image I attached, I tried your suggestion with other values where the original bug is not present because I must always apply the patch. On the left it's the graph whitout the Y-Axis adjustment in OnBeforeLayout where series have good values. On the right it's with the Y-Axis adjustment in OnBeforeLayout. As you will see, the Y-Axis changed but series series stay where they are and now they are not at the good values!

    Is there a way to force a redraw of the series or another event where I can change the Y-Axis?

    Regards
  7. Missing user
    Missing user avatar

    Posted 14 Mar 2013 Link to this post

    Hello Marc,

    I've attached a sample project which demonstrates how to use the solution I proposed in my previous post. Could you please run it and confirm that everything shows up as expected. If it does, I'd like to ask you to try to compare it with your solution and see what the differences are. If you still have troubles, please modify the project so that the issue is reproduced and send it back to us, so that we can review it locally. Thank you.

    Kind regards,
    Ivan N.
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  8. Marc
    Marc avatar
    39 posts
    Member since:
    Nov 2012

    Posted 16 Mar 2013 Link to this post

    HI Ivan, I found what property cause me that behavior...it's ScrollMode. As you will see in the attached file setting ScrollMode to Both totally changed the graph. Also the MarkedZone just go away!

    I also tried to set it by code but no difference.
  9. Missing user
    Missing user avatar

    Posted 20 Mar 2013 Link to this post

    Hello Marc,

    Thank you for pointing out this detail. After setting ScrollMode to Both, the chart's appearance changed right away.

    The next best thing I can suggest is that you implement an algorithm for the Y axis' range yourself based on an offset from the data source's Min and Max values, as you suggested in one of the previous posts. For your convenience, I've outlined a rough implementation of such an algorithm in the project attached to this post, but it's up to you to decide whether it's an acceptable solution given the data the chart is being bound to. Also, please take notice that the way the marked zone is added to the chart has been modified, otherwise it will appear only when the chart is zoomed in. The project itself is based on the one I previously sent to you, this time however with ScrollMode enabled. I've also attached a screenshot of what you should expect when running it.

    Regards,
    Ivan N.
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017