graph line drawing - multiple same value 'X' not plotting the changing 'Y'

5 posts, 0 answers
  1. Rick
    Rick avatar
    8 posts
    Member since:
    Aug 2012

    Posted 09 Dec 2019 Link to this post

    I'm hoping you don't need a sample app of this behavior (because I'm having no luck creating one), but we are using WPF Telerik Reporting for 2D line drawing charts. Our data is from a couple 100 to several thousand data points, and i found that if the 'X' data remains constant for period of time with the 'Y' data varying, I would expect to see a vertical line at that X position going from the minimum Y value to the maximum Y value, but that is not happening. It's acting like there's some filtering going on - I don't see the max value of Y shown, even though it's in the data being plotted. I've tried all 3 LineType's of Smooth, Straight and Stepped and it made no difference. I was assuming at first the 'Smooth' algorithm was the cause, but that wasn't the case.

    I am far from being a reporting expert, but I'm struggling with this issue and can't find any graph setting that seems applicable, but tried many, nothing is working. I'm hoping you have seen or heard of this problem before - I am probably missing seeing it.

    Hope you can help!

     

  2. Ivan Hristov
    Admin
    Ivan Hristov avatar
    220 posts

    Posted 10 Dec 2019 Link to this post

    Hi Rick,

    You are absolutely right in the assumption that the chart must draw a vertical line when the X values are the same and Y values vary. However, the type of the produced line depends on the used axis scales and groups in the graph. I guess the X axis of your report uses a Category scale, which creates a separate slot for each group member defined by the graph's category group. I'm sure it sounds a bit vague, so I will try to explain it below in details:

    I will assume that the data passed to the graph contains just two fields: X and Y to define the horizontal and vertical coordinates per each point. In the current scenario the graph item uses the category groups to divide the X axis in slots. When the Grouping property is set to =Fields.X, all the X entries with equal values will be grouped in a single slot and this slot will have only one corresponding Y value - usually some aggregate like =Sum(Fields.Y). Obviously in this scenario we don't want to group the X data, so the Grouping expression must be set to an expression that produces a new group member per each row in the data source. This is called Detail Grouping and is defined by a Grouping with empty expression.

    Once created the detail grouping for the graph's Category group, you will notice that the Category scale is not the best choice for such scenario, because it creates slots per each X instead of putting the constant ones together. In this case a Numerical scale should be used. When replacing the X axis' scale with Numerical one, you also have to define the series' X expression, because the Category scale infers it from the category groups, but Numerical scale doesn't. Therefore the series should have its X expression set as =Fields.X and the produced graph will look as you expect.

    I shot a small video demonstrating how to create such a chart using the Graph item. The video can be seen here: https://www.screencast.com/t/wm8cppKrD (please note it has no sound and requires Flash to run). I will also attach the produced .trdx file as a reference. I hope the detailed explanations will help you understand how the Graph groups its data and what are the differences between various axis scales. Of course, if you need further assistance, please do not hesitate to ask.

    Regards,
    Ivan Hristov
    Progress 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. Rick
    Rick avatar
    8 posts
    Member since:
    Aug 2012

    Posted 10 Dec 2019 in reply to Ivan Hristov Link to this post

    Thanks Ivan for the quick response! I've been struggling, even on the basic definitions of Categories and Groups as applied to Telerik Reporting - I searched and searched and just can't find a clear explanation. All the samples and tutorials are at 30,000 feet, so I found little to nothing that delves deep in to Graphs. I was thinking/hoping though the answer to my problem would be in this area. In reading this, I believe you are correct - we are using those X and Y grouping properties. I actually have another problem, with a certain data patter, the entire line disappears - I'm thinking it's happening because of the same reason - there's a large portion of the line with the same X value. Actually while in the show this morn, I actually was thinking of checking on unchanging X values and modifying their value slightly if so detected... Let me review your video and try what you suggest - if you can think of any other resources I could refer to , please do so.

    Thanks!!

  4. Rick
    Rick avatar
    8 posts
    Member since:
    Aug 2012

    Posted 10 Dec 2019 Link to this post

    Ok, we got it working!!! We were already using numerical scales but we did have the "Groupings" set to a field. Replaced with a blank entry as you suggested above and it worked! There was a couple more complications however. We had 2 line series per graph, and found we needed change the "Groupings" setting in 3 places per chart: top level "CategoryGroups" of the graph, and once per line series.

     We also did review your video clip - that helped seeing the blank entry made, and did run your downloaded project/. We actually added a line series to your project to duplicate what we have.

    Thanks for the help!! Excellent Support!

  5. Ivan Hristov
    Admin
    Ivan Hristov avatar
    220 posts

    Posted 11 Dec 2019 Link to this post

    Hello Rick,

    I'm glad my suggestions helped you resolve the problem with the detailed groups. I just noticed you mentioned that you needed to change the grouping criteria in three places - in the Graph's CategoryGroups and in each series instance. In fact, there should be no need to do that separately. The Graph's Category groups contains group definitions that are referenced by the series. In other words, you should only change the group definition in the Graph's category group and it will be automatically applied to the series which uses that group.

    Additionally if you have two series that use the same X scale and differ only by their Y values, there is no need to create category groups for each one of the series instances - they can share a single category group. This will improve the performance a bit and simplify your report definition.

    Regards,
    Ivan Hristov
    Progress 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
Back to Top