Lineseries PointTempate strech width and height

4 posts, 1 answers
  1. Sivakumar
    Sivakumar avatar
    29 posts
    Member since:
    Dec 2015

    Posted 17 Mar 2016 Link to this post

    My chart having step line series along with data point highlighting based on conditions.I would like stretch height and width of point template to occupy all the space.I am facing issue With the rectangle fixed size height and width , it is not aligning properly during zooming.Please see attached..

    1.I need to auto adjust or stretch height and width of point template to along with particular line height and width. 

    2.How can i access relative parent point template ?




  2. Sivakumar
    Sivakumar avatar
    29 posts
    Member since:
    Dec 2015

    Posted 20 Mar 2016 in reply to Sivakumar Link to this post

    Hi Team ,

    Please suggest the solution...I need to highlight the data point or background of line based on data item conditions.Please refer image from above post...


    <DataTemplate x:Key="LinePointTemplate" >
                           <Rectangle Width="16" Height="28"  Stroke="Transparent" >
                                   <Style  TargetType="Rectangle">
                                       <Setter Property="Fill" Value="Transparent" />
                                           <DataTrigger Binding="{Binding DataItem.IsPass}" Value="False">
                                               <Setter Property="Fill" Value="Red" />
                                           <DataTrigger Binding="{Binding IsSelected}" Value="True">
                                               <Setter Property="Fill" Value="Yellow" />



  3. Answer
    Martin Ivanov
    Martin Ivanov avatar
    1442 posts

    Posted 21 Mar 2016 Link to this post

    Hello Sivakumar,

    In order to highlight the item Rectangle in the PointTemplate based on a condition you can use its Stroke property for example. Or you can change its color as demonstrated in the code snippet from your last reply. Also, another approach of setting the colors in the PointTemplate is instead of using data triggers to binding the Fill property directly to the property from the model (DataItem.IsPass or IsSelected) with an IValueConverter.

    About stretching the element in the PointTemplate, since all chart elements are drawn and positioned in a Canvas you will need to manually recalculate the size of the Rectangle element each time the chart's layout is updated. In your case you can do it when the PanOffsetChanged or ZoomChanged events of the chart are fired.

    As for accessing the relative parent point template, I am not sure that I understand what this means. Can you please clarify it for me? Also, if you want to change something in the elements in the PointTemplate at runtime you can bind them to the view model of the data point. If you want to get the data point under the mouse you can use the Conversion API of RadChartView.

    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  4. Sivakumar
    Sivakumar avatar
    29 posts
    Member since:
    Dec 2015

    Posted 21 Mar 2016 in reply to Martin Ivanov Link to this post

    Thanks Martin
Back to Top