This is a migrated thread and some comments may be shown as answers.

AxisX DefaultLabelFormat="#DATAITEM.Title"

1 Answer 50 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Cole
Top achievements
Rank 1
Cole asked on 10 Nov 2011, 02:13 AM
A data entity has three values; Title, GoalTotal, ShipmentsTotal
I have a chart with two horizontal series.
I am trying unsucessfully to show the Title field as an AxisX Label using :
DefaultLabelFormat
="#DATAITEM.Title"

P.S.   The tool tips using the same format specification work fine...

(XAML Code follows)
<telerik:RadChart ItemsSource="{Binding Path=TheObservableCollection}">
 
  <telerik:RadChart.DefaultView>
    <telerik:ChartDefaultView>
      <telerik:ChartDefaultView.ChartTitle>
        <telerik:ChartTitle Style="{StaticResource styleChartTitle}" Content="Program Goals vs. Shipments" HorizontalAlignment="Center"/>
      </telerik:ChartDefaultView.ChartTitle>
      <telerik:ChartDefaultView.ChartLegend>
        <telerik:ChartLegend Header="Legend" x:Name="chartLegend" />
      </telerik:ChartDefaultView.ChartLegend>
      <telerik:ChartDefaultView.ChartArea  >
        <telerik:ChartArea LegendName="chartLegend" ItemOverlapPercent="70" SmartLabelsEnabled="True" >
 
          <telerik:ChartArea.AxisX>
            <telerik:AxisX DefaultLabelFormat="#DATAITEM.Title" >
              <telerik:AxisX.AxisStyles>
                <telerik:AxisStyles>
                  <telerik:AxisStyles.ItemLabelStyle>
                    <Style TargetType="TextBlock">
                      <Setter Property="TextAlignment" Value="Right" />
                      <Setter Property="Padding" Value="1" />
                      <Setter Property="Width" Value="200" />
                      <Setter Property="TextWrapping" Value="Wrap" />
                    </Style>
                  </telerik:AxisStyles.ItemLabelStyle>
                </telerik:AxisStyles>
              </telerik:AxisX.AxisStyles>
            </telerik:AxisX>
          </telerik:ChartArea.AxisX>
 
        </telerik:ChartArea>
      </telerik:ChartDefaultView.ChartArea>
    </telerik:ChartDefaultView>
  </telerik:RadChart.DefaultView>
 
  <telerik:RadChart.SeriesMappings  >
 
    <telerik:SeriesMapping LegendLabel="Program Goals">
      <telerik:SeriesMapping.SeriesDefinition>
        <telerik:HorizontalBarSeriesDefinition ShowItemToolTips="True" ItemToolTipFormat="#DATAITEM.Title" />
      </telerik:SeriesMapping.SeriesDefinition>
      <telerik:ItemMapping DataPointMember="YValue" FieldName="GoalTotal" />
    </telerik:SeriesMapping>
 
    <telerik:SeriesMapping LegendLabel="Program Shipments">
      <telerik:SeriesMapping.SeriesDefinition>
        <telerik:HorizontalBarSeriesDefinition ShowItemToolTips="True" ItemToolTipFormat="#DATAITEM.Title" />
      </telerik:SeriesMapping.SeriesDefinition>
      <telerik:ItemMapping  DataPointMember="YValue" FieldName="ShipmentsTotal" />
    </telerik:SeriesMapping>
 
  </telerik:RadChart.SeriesMappings>
</telerik:RadChart>

 

 

 

1 Answer, 1 is accepted

Sort by
0
Evgenia
Telerik team
answered on 14 Nov 2011, 01:01 PM
Hello Cole,

Can you elaborate a bit more on what do you want to achieve? What is the purpose of the Title property - DataPoint.Label, DataPoint.LegendLabel or DataPoint.XCategory? Knowing this will help us to provide you with a more proper support based on your case.
Also have in mind that using the #DATAITEM token can't be used with formatting AxisX labels as it can bes used to format  Series Items Labels and Tooltips only. More information about it can be found in our help topic

All the best,
Evgenia
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Tags
Chart
Asked by
Cole
Top achievements
Rank 1
Answers by
Evgenia
Telerik team
Share this question
or