Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WPF > Chart > RadChart XCategory Labels not showing

Not answered RadChart XCategory Labels not showing

Feed from this thread
  • Christian avatar

    Posted on Jan 19, 2012 (permalink)

    Hi All,
    I have a problem where I have gone mad about a solution in the last hours. I have a RadChart with two Y-axis and on the X-Axis I would like to see string labels instead of numbers, but I always see the numbers...
    My XAML is the following:
    <telerik:RadChart ItemsSource="{Binding Chart2Data}" x:Name="chart2" >
            <telerik:RadChart.SamplingSettings>
                <telerik:SamplingSettings SamplingThreshold="240" />
            </telerik:RadChart.SamplingSettings>
            <telerik:RadChart.SeriesMappings>
                <telerik:SeriesMapping LegendLabel="{x:Static p:Resources.Report_MaskingTrail}" >
                    <telerik:SeriesMapping.SeriesDefinition>
                        <telerik:LineSeriesDefinition ShowItemLabels="False" ShowPointMarks="False" ShowItemToolTips="False" />
                    </telerik:SeriesMapping.SeriesDefinition>
                    <telerik:SeriesMapping.ItemMappings>
                        <telerik:ItemMapping DataPointMember="YValue" FieldName="Y2" />
                        <telerik:ItemMapping FieldName="XLabel" DataPointMember="XCategory" />
                    </telerik:SeriesMapping.ItemMappings>
                </telerik:SeriesMapping>
                <telerik:SeriesMapping LegendLabel="{x:Static p:Resources.Report_CoreLoudness}" >
                    <telerik:SeriesMapping.SeriesDefinition>
                        <telerik:LineSeriesDefinition ShowItemLabels="False" ShowPointMarks="False" ShowItemToolTips="False" />
                    </telerik:SeriesMapping.SeriesDefinition>
                    <telerik:SeriesMapping.ItemMappings>
                        <telerik:ItemMapping DataPointMember="YValue" FieldName="Y1" />
                        <telerik:ItemMapping FieldName="XLabel" DataPointMember="XCategory"  />
                    </telerik:SeriesMapping.ItemMappings>
                </telerik:SeriesMapping>
            </telerik:RadChart.SeriesMappings>
            <telerik:RadChart.DefaultView>
                <telerik:ChartDefaultView >
                    <telerik:ChartDefaultView.ChartArea>
                        <telerik:ChartArea LegendName="legendLive"
                                           NoDataString="{x:Static p:Resources.NoMeasurementData}"
                                           EnableAnimations="False">
                            <telerik:ChartArea.AxisX>
                                <telerik:AxisX AutoRange="true" LabelRotationAngle="270"  />
                            </telerik:ChartArea.AxisX>
                            <telerik:ChartArea.AxisY>
                                <telerik:AxisY AutoRange="{Binding Path=Configuration.Chart2ManualConfiguration1, Converter={StaticResource inverseBooleanConverter}}"
                                    MinValue="{Binding Path=Configuration.Chart2Minimum1}"
                                    MaxValue="{Binding Path=Configuration.Chart2Maximum1}"
                                    Step="{Binding Path=Configuration.Chart2YStep1}"
                                               Title="{x:Static p:Resources.Chart2_Series_Title}">
                                    <telerik:AxisY.AxisStyles>
                                        <telerik:AxisStyles AxisLineStyle="{StaticResource AxisLineStyle}"
                                                            TickLineStyle="{StaticResource MajorTickLineStyle}"
                                                            MinorTickLineStyle="{StaticResource MinorTickLineStyle}"
                                                            ItemLabelStyle="{StaticResource CustomLabel}" />
                                    </telerik:AxisY.AxisStyles>
                                </telerik:AxisY>
                            </telerik:ChartArea.AxisY>
                        </telerik:ChartArea>
                    </telerik:ChartDefaultView.ChartArea>
                    <telerik:ChartDefaultView.ChartLegend>
                        <telerik:ChartLegend x:Name="legendLive"
                                             Header="{x:Static p:Resources.ChartLegend}"
                                             LegendItemStyle="{StaticResource CustomLegendItem}"
                                             Visibility="Collapsed"
                                             />
                    </telerik:ChartDefaultView.ChartLegend>
                </telerik:ChartDefaultView>
            </telerik:RadChart.DefaultView>
        </telerik:RadChart>

    The data class has four properties:

    X => The counter of the value, not bound the the chart
    XLabel => a string which should be visible in the X-Axis
    Y1, Y2 => The values for the two Y-axis.

    Can someone explain to me what I am doing wrong?

    Thanks,
    Chris

    Reply

  • Yavor Yavor admin's avatar

    Posted on Jan 24, 2012 (permalink)

    Hi,

    You have two options to format the values. The first one is to use the DefaultLabelFormat, as shown in the following topic:

    http://www.telerik.com/help/silverlight/radchart-features-format-expressions.html

    The other option is to set the text of the labels through code:

    http://www.telerik.com/help/silverlight/radchart-features-axes-labels.html

    I hope this information gets you started properly.

    Kind regards,
    Yavor
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WPF > Chart > RadChart XCategory Labels not showing
Related resources for "RadChart XCategory Labels not showing"

WPF Chart Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  ]