Conditional Visiblity of Markers on a line graph

5 posts, 0 answers
  1. Ramya
    Ramya avatar
    7 posts
    Member since:
    Jun 2016

    Posted 07 Jun Link to this post

    I have a line graph in my telerik report. I Need to display markers only if they satisfy a condition.

    Otherwise the points should just make the line, but markers  shouldn't be visible unless it satisfies the condition

     Can this feature be achieved ?

     

  2. Katia
    Admin
    Katia avatar
    567 posts

    Posted 08 Jun Link to this post

    Hi Ramya,

    By default, markers cannot be hidden based on the condition, only the whole series can be hidden.

    To achieve the required behavior, you can hide the markers of the existing LineSeries and add a second LineSeries with markers only (bound to the same data source). The idea of the additional LineSeries is to display the data points conditionally using the required expression in DataPointConditionalFormatting property.
    Legend item of the additional series can be hidden with LegendItem.Style.Visible property set to false.

    The attached report demonstrates the above approach. It can be opened in Standalone Designer R2 2017 and it uses some sample data from AdventureWorks SQL database.

    Hope this will help.
     

    Regards,
    Katia
    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. Ramya
    Ramya avatar
    7 posts
    Member since:
    Jun 2016

    Posted 08 Jun in reply to Katia Link to this post

    Hi Katia,

    Thank you for the response. It does the trick. 

  4. Carl
    Carl avatar
    1 posts
    Member since:
    Aug 2017

    Posted 06 Oct Link to this post

    Had kind of the same problem. On a graph with a number of series I needed an identification (not the color) of the actual series.

    I added two columns to my datasource: 'marker' and 'showMarker'. I used the 'marker' as DataPointLabel and used the 'showMarker' in a DataPointyLabelConditionalFormat to control the display of the marker. If 'showMarker' is true the marke is displyed, if 'showMarkes' is false the marker is removed in the StyleBuilder by removing the checmark in 'Layout'->visible.

    This works very fine for me and since the control is in the datasource a lot of flexibility is achieved. I've used the same sytem to control other marking.

    BTW: It appears that the DataPointLabelStyle also controls the style used in the legend. That's pretty confusing! Do we have an error here?

    br. Carl

  5. Katia
    Admin
    Katia avatar
    567 posts

    Posted 09 Oct Link to this post

    Hi Carl,

    That is correct, the color of the legend marker and its line properties are affected by the DataPointStyle definition. The diagram in Style Resolving Fallback Algorithm help article displays how the series styles are propagated.

    To apply different styles to the legend, you need to use Series.LegendItem style properties.


    Regards,
    Katia
    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