Multiple Line Series With Multiple Axes

5 posts, 1 answers
  1. Ryan
    Ryan avatar
    35 posts
    Member since:
    Jul 2015

    Posted 03 Mar Link to this post

    Hello,

    I have several lines (the exact amount will be determined at runtime), each with a different Y axis (but a shared X axis), that I would like to display on the same chart. The X axis should be in date/time format while all of the Y axes should consist of integers. The Y axes should alternate between the left & right sides of the chart. If possible, I'd like all of these to come from a single datasource (a datatable) and be grouped into lines based on a column. I also need the axes to either have labels or colors to distinguish which one goes with which line.

    I have no idea how to approach this - I couldn't find much documentation on it and the forum threads that I looked at were quite old. I watched the tutorial here and read the documentation here but I would like to generate all of this at runtime if possible. If what I'm asking is possible, could someone provide me with a sample project or some sample code?

    Thank you!

  2. Nasko
    Admin
    Nasko avatar
    909 posts

    Posted 08 Mar Link to this post

    Hello Ryan,

    Additional axes can be added as described in the How to: Add Secondary Axis help article. After you create the graph with multiple axes at design-time, you can view the automatically generated code in the report's .Designer.cs file to see how to do the same programmatically. Attached you can find a sample report demonstrating the approach.

    Regards,
    Nasko
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
  3. DevCraft banner
  4. Ryan
    Ryan avatar
    35 posts
    Member since:
    Jul 2015

    Posted 10 Mar in reply to Nasko Link to this post

    Thanks Nasko! That sample helped a lot. I have a couple more questions:

    1. I've managed to create multiple axes & multiple lines, but I need a way to distinguish which axis goes with which line. In the RadChartView I could change the axis color. Is there any way to do something similar with reporting?

    2. My data is in a different layout than yours. Could you advise me how to work with this layout:

    DateTimeStamp       | Group | Value
    3/10/2016 8:00AM    | 1     | 1
    3/10/2016 9:00AM    | 1     | 2
    3/10/2016 10:00AM   | 1     | 1
    3/10/2016 11:00AM   | 1     | 3
    3/10/2016 8:00AM    | 2     | 8
    3/10/2016 9:00AM    | 2     | 12
    3/10/2016 10:00AM   | 2     | 9
    3/10/2016 11:00AM   | 2     | 10

    Group would be the line that should be represented on the chart.

    Thanks again!

  5. Answer
    Nasko
    Admin
    Nasko avatar
    909 posts

    Posted 15 Mar Link to this post

    Hello Ryan,

    The axes' colors can be changed via the Style property of the axis. More information is available in the Formatting a Graph help articles.

    Your data can be used to feed the graph as demonstrated in the attached sample report. 

    Regards,
    Nasko
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
  6. Ryan
    Ryan avatar
    35 posts
    Member since:
    Jul 2015

    Posted 23 Mar in reply to Nasko Link to this post

    Worked perfectly - thank you, Nasko!
Back to Top
DevCraft banner