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

RadChart XCategory Labels not showing

1 Answer 66 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Christian
Top achievements
Rank 1
Christian asked on 19 Jan 2012, 09:16 PM
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

1 Answer, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 24 Jan 2012, 09:18 AM
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 >>

Tags
Chart
Asked by
Christian
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Share this question
or