AxisX DefaultLabelFormat="#DATAITEM.Title"

2 posts, 0 answers
  1. Cole
    Cole avatar
    1 posts
    Member since:
    Oct 2011

    Posted 09 Nov 2011 Link to this post

    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>

     

     

     

  2. Evgenia
    Admin
    Evgenia avatar
    1437 posts

    Posted 14 Nov 2011 Link to this post

    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 >>
Back to Top