Setting Graph's Y-Axis Scale Programatically

3 posts, 0 answers
  1. Brent Hetland
    Brent Hetland avatar
    61 posts
    Member since:
    Aug 2009

    Posted 27 Apr 2015 Link to this post

    Hi,

    I am using Q2 2014 SP1 of Telerik Reporting.  My report contains a single Graph in the detail section, but my datasource contains alot of items that will be graphed (so I'll get one of my graphs for every item in the data source I'm binding it to).  Each of the graphs that are created, may have wildly different values.

    In the cases where the values of a single graph are both very small and very large, I will want to set the Y-Axis Scale to "Logarithmic".  But the challenge is that I'll need to do that at run-time since I can't set that property in the designer (since most of the time it will be a Numeric Scale, not Logarithmic).

    It doesn't seem like any of the events (ItemDataBinding, ItemDataBound, or NeedDataSource) can be used to help me do this?

    So, can I change the Graph's Y-Axis Scale anywhere in the report's code behind?

    Thanks,
    Brent

  2. Brent Hetland
    Brent Hetland avatar
    61 posts
    Member since:
    Aug 2009

    Posted 27 Apr 2015 in reply to Brent Hetland Link to this post

    I also want to add that I'm using a DateTime for the X-Axis and some of my chart data will be daily, some weekly, some monthly, etc... Currently in the designer for the chart, I have the XAxis LabelFormat set to {0:MMM-yy}, which works great when my data is Monthly.  But it is not the format I want to use for weekly and daily data.

     

    So I also need to be able to set the XAxis LabelFormat property at runtime.  Where can I do this?

  3. Ivan Hristov
    Admin
    Ivan Hristov avatar
    203 posts

    Posted 29 Apr 2015 Link to this post

    Hello Brent,

    You cannot change the type of the scale at runtime, because this would mean to change the definition, which is currently processing and that is not allowed by design. However, you can create two graphs (one with a Numeric and one with a Logarithmic scale) in your details section and make one of them invisible according to your data using Bindings.

    As from Q1 2015 you can set the Graph's axis label format using Bindings, which is a very handy feature in such cases. You can read more about that in this documentation article: How to: Use Bindings to Control the Coordinate System Properties.

    Hope it helps.

    Regards,
    Ivan Hristov
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
Back to Top