ShowLabel=True : Change label font-color

3 posts, 1 answers
  1. Nitin Nitin
    Nitin Nitin avatar
    41 posts
    Member since:
    Apr 2010

    Posted 26 Jul 2013 Link to this post

    Hi,

    I am enabling ShowLabels property to True on user selection of contextmenu option "Show Markers"

    xRadCartesianChart.Series(i).ShowLabels = True

    I am able to see the labels at all datapoints on the chart as attached.

    Now, I want to change the font-color of those labels to match the color of the chart series.

    How can I achieve this?

    Thanks,
    Nitin 
  2. Nitin Nitin
    Nitin Nitin avatar
    41 posts
    Member since:
    Apr 2010

    Posted 29 Jul 2013 Link to this post

    Hello Telerik,

    Can you please reply to my question, if it is possible or not?

  3. DevCraft banner
  4. Answer
    Petar Kirov
    Admin
    Petar Kirov avatar
    425 posts

    Posted 30 Jul 2013 Link to this post

    Hi Nitin,

    All ChartSeries have a LabelDefinitions property which you can use to customize the series item labels. The ChartSeriesLabelDefinition class exposes a Template property, which you can use to specify how each label should be displayed. Here's an example:
    <telerik:LineSeries>
      <telerik:LineSeries.LabelDefinitions>
          <telerik:ChartSeriesLabelDefinition>
              <telerik:ChartSeriesLabelDefinition.Template>
                  <DataTemplate>
                     <TextBlock Text="{Binding Value}" Foreground="White"/>
                  </DataTemplate>
              </telerik:ChartSeriesLabelDefinition.Template>
          </telerik:ChartSeriesLabelDefinition>
      </telerik:LineSeries.LabelDefinitions>
    </telerik:LineSeries>
    The DataContext of this DataTemplate is DataPoint (depending on type of series could be CategoricalDataPoint, RangeDataPoint, OhlcDataPoint, ScatterDataPoint, PolarDataPoint or PieDataPoint).

    I hope this helps.
     
    Regards,
    Petar Kirov
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
Back to Top