PointTemplate in Chart with SeriesDescriptor

3 posts, 0 answers
  1. Daniel
    Daniel avatar
    7 posts
    Member since:
    Feb 2013

    Posted 27 Jun 2014 Link to this post

    Hi, How can I set a PointTemplate to chart series, series are defined using SeriesDescriptor.
    My goal is to show tooltips in each point of the series
    I have tried the following but is not working
    Thanks for your help.
                  <DataTemplate x:Key="PointDataTemplate">
                    <Ellipse Width="6" Height="6" />

    <telerik:RadCartesianChart x:Name="MonitoringParameterChart" >
                   <telerik:ChartTooltipBehavior HorizontalOffset="-17" VerticalOffset="-70"/>
                           <Path Data="M-1236,-441 L-1208,-441 L-1208,-424 L-1228,-424 L-1230.5,-420 L-1233,-424 L-1236,-424 z"
                                           Stretch="Fill" Fill="#FFFFFFFF" Stroke="#FF767676" StrokeThickness="1" />
                           <TextBlock Margin="6,4,6,10" FontSize="11">
                                               <Run Text="{Binding Value, StringFormat=\{0:#########\}}"/>
                                               <Run Text="{Binding Category, StringFormat=\{0:dd MMM yyyy\}}"/>
                   <telerik:ChartSeriesProvider x:Name="MonitoringParametersSeriesProvider" Source="{Binding}">
                       <telerik:ChartSeriesProvider.SeriesDescriptors >
                           <telerik:CategoricalSeriesDescriptor ItemsSourcePath="Values" ValuePath="Value" CategoryPath="Time" >
                                   <Style TargetType="telerik:LineSeries">
                                       <Setter Property="StrokeThickness" Value="1"/>
                                        <Setter Property="PointTemplate" Value="{StaticResource PointDataTemplate}" />
  2. Daniel
    Daniel avatar
    7 posts
    Member since:
    Feb 2013

    Posted 30 Jun 2014 in reply to Daniel Link to this post

    I found a thread that gave me the solution:
    <Setter Property="PointTemplate" ><BR> <Setter.Value><BR>
    <DataTemplate><BR> <Ellipse Width="6" Height="6" Fill="{Binding
    Converter={StaticResource paletteConverter}}"/><BR> </DataTemplate><BR>
    </Setter.Value><BR> </Setter>
    public class PaletteConverter : IValueConverter
            public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
                CategoricalDataPoint point = value as CategoricalDataPoint;
                LineSeries series = point.Presenter as LineSeries;
                RadCartesianChart chart = series.Chart as RadCartesianChart;
                int seriesIndex = chart.Series.IndexOf(series);
                return chart.Palette.GlobalEntries[seriesIndex].Fill;
            public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
               throw new NotImplementedException();

    The only troblue is that I have more series than color in the palette.
  3. Pavel R. Pavlov
    Pavel R. Pavlov avatar
    1237 posts

    Posted 01 Jul 2014 Link to this post

    Hello Daniel,

    I am happy to hear that you have found an approach that achieves your requirement for custom PointTemplate. Regarding the number of the colors in a palette, if you need to extend the palette (to add more colors) you can take a look at the Creating Custom palettes article. Following it, you will be able to define custom colors that will be used to paint your series. This will allow you to control the number of the series with different colors.

    Pavel R. Pavlov
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
Back to Top