Custom AxisY Label

5 posts, 1 answers
  1. Igor
    Igor avatar
    4 posts
    Member since:
    Nov 2011

    Posted 18 Sep 2013 Link to this post

    Hi,
    I have a RadChart:
    <telerik:RadChart x:Name="radChartDowntime" telerik:StyleManager.Theme="Windows8"
                                                ItemsSource="{Binding Items}" MaxHeight="200">
                        <telerik:RadChart.SamplingSettings>
                            <telerik:SamplingSettings SamplingThreshold="0" />
                        </telerik:RadChart.SamplingSettings>
                        <telerik:RadChart.SeriesMappings>
                            <telerik:SeriesMapping LegendLabel="Test">
                                <telerik:SeriesMapping.SeriesDefinition>
                                    <telerik:StepLineSeriesDefinition ShowItemLabels="False" ShowPointMarks="False" />
                                </telerik:SeriesMapping.SeriesDefinition>
                                <telerik:SeriesMapping.ItemMappings>
                                    <telerik:ItemMapping DataPointMember="XValue" FieldName="Created"></telerik:ItemMapping>
                                    <telerik:ItemMapping DataPointMember="YValue" FieldName="State"></telerik:ItemMapping>
                                </telerik:SeriesMapping.ItemMappings>
                            </telerik:SeriesMapping>
                        </telerik:RadChart.SeriesMappings>
                        <telerik:RadChart.DefaultView>
                            <telerik:ChartDefaultView>
                                <telerik:ChartDefaultView.ChartLegend>
                                    <telerik:ChartLegend Visibility="Collapsed" />
                                </telerik:ChartDefaultView.ChartLegend>
                                <telerik:ChartDefaultView.ChartArea>
                                    <telerik:ChartArea>
                                        <telerik:ChartArea.AxisY>
                                            <telerik:AxisY Step="1" MinorTicksVisibility="Collapsed"
                                                                   MaxValue="2" AutoRange="False" StripLinesVisibility="Collapsed">
                                                <telerik:AxisY.AxisStyles>
                                                    <telerik:AxisStyles ItemLabelStyle="{StaticResource ChartVerticalLabelStyle}" />
                                                </telerik:AxisY.AxisStyles>
                                            </telerik:AxisY>
                                        </telerik:ChartArea.AxisY>
                                        <telerik:ChartArea.AxisX>
                                            <telerik:AxisX LabelRotationAngle="90" IsDateTime="True"
                                                                   DefaultLabelFormat="dd.MM hh:mm">
                                            </telerik:AxisX>
                                        </telerik:ChartArea.AxisX>
                                        <telerik:ChartArea.ZoomScrollSettingsX>
                                            <telerik:ZoomScrollSettings ScrollMode="None" />
                                        </telerik:ChartArea.ZoomScrollSettingsX>
                                    </telerik:ChartArea>
                                </telerik:ChartDefaultView.ChartArea>
                            </telerik:ChartDefaultView>
                        </telerik:RadChart.DefaultView>
                    </telerik:RadChart>
    How do I display a custom AxisY label? For example, 0 - Downtime, 1 - Slowdown, 2 - InWork
  2. Igor
    Igor avatar
    4 posts
    Member since:
    Nov 2011

    Posted 18 Sep 2013 Link to this post


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

    Posted 20 Sep 2013 Link to this post

    Hi Igor,

    You can achieve this by overriding the default label template using an implicit style and a converter to modify the TextBlocks' Text.

    I have attached a sample project demonstrating that.
     

    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 >>
  5. Igor
    Igor avatar
    4 posts
    Member since:
    Nov 2011

    Posted 23 Sep 2013 Link to this post

    Thanks, it works!
    But if I use the "Windows 8" Theme, that does not work.

    ...
    <Grid x:Name="LayoutRoot" Background="White" Width="640" Height="480">
            <telerik:RadChart x:Name="RadChart1" telerik:StyleManager.Theme="Windows8">
                <telerik:RadChart.SeriesMappings>
                    <telerik:SeriesMapping ItemsSource="{Binding Data}">
    ...


    Perhaps this is due to the Dependency Property Value Precedence
  6. Igor
    Igor avatar
    4 posts
    Member since:
    Nov 2011

    Posted 23 Sep 2013 Link to this post

    Applying theme globally in your application solved my problem.

    P.S. NoDataControl not applying Windows 8 style...
Back to Top
DevCraft banner