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

Setting Point Label Style FontFamily

3 Answers 72 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Brian
Top achievements
Rank 1
Brian asked on 22 Jul 2011, 10:14 PM
I am trying to set the FontFamily for the point label on my chart.  I have copied the default style for the SeriesItemLabel using ExpressionBlend and have named it DefaultSeriesItemLabelStyle.  I created two styles based on this style, RairSeriesItemLabelStyle and RairDarkTextSeriesItemLabelStyle:

<Style x:Key="RairSeriesItemLabelStyle" TargetType="telerik:SeriesItemLabel" BasedOn="{StaticResource DefaultSeriesItemLabelStyle}">
            <Setter Property="FontFamily" Value="Tacoma,Arial"/>
        </Style>
        <Style x:Key="RairDarkTextSeriesItemLabelStyle" TargetType="telerik:SeriesItemLabel" BasedOn="{StaticResource RairSeriesItemLabelStyle}">
            <Setter Property="Foreground" Value="#333"/>
        </Style>

I have set them on two LineSeriesDefinitions on my chart, but while the text color changes to match the foreground color, the font family does not change.  How can I change the font family for the point labels?

3 Answers, 1 is accepted

Sort by
0
Sia
Telerik team
answered on 25 Jul 2011, 04:26 PM
Hi Brian,

I have tested this and it works as expected on my end. I think that you have a typo:
<Style x:Key="RairSeriesItemLabelStyle" TargetType="telerik:SeriesItemLabel" BasedOn="{StaticResource SeriesItemLabelStyle}">
    <Setter Property="FontFamily" Value="Tahoma,Arial"/>
</Style>

Please let me know whether this is true.

Kind regards,
Sia
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Brian
Top achievements
Rank 1
answered on 25 Jul 2011, 04:38 PM
Sia,
I think that is probably a typo in the original stylesheet that I am basing these styles on, however, correcting the typo still doesn't fix the issue for me, and I am using the same font family value for the axis labels and it is falling back to Arial as it should.  I have attached a screenshot of part of my chart that shows the problem (chart fonts.png).  You can see that the font color for the yellow series is dark, so the Foreground property in RairDarkTextSeriesitemLabelStyle appears to be applied.  As you can see by the difference in the bottom of the 1 on the point label and the the axis, the font family is not being applied.

Edit: The issue seems to be related to style inheritance.  If I put the font family setter directly on the RairDarkTextSeriesItemLabelStyle, then the font family is applied.  If I rely on the inheritance from RairSeriesItemLabelStyle, it doesn't work.  This works:

<Style x:Key="RairSeriesItemLabelStyle" TargetType="telerik:SeriesItemLabel" BasedOn="{StaticResource DefaultSeriesItemLabelStyle}">
            <Setter Property="FontFamily" Value="Tacoma,Arial"/>
        </Style>
        <Style x:Key="RairDarkTextSeriesItemLabelStyle" TargetType="telerik:SeriesItemLabel" BasedOn="{StaticResource RairSeriesItemLabelStyle}">
            <Setter Property="FontFamily" Value="Tacoma,Arial"/>
            <Setter Property="Foreground" Value="#333"/>
        </Style>
 (see chart fonts 2.png)
0
Sia
Telerik team
answered on 26 Jul 2011, 01:24 PM
Hello Brian,

I confirm that there is a problem with the SeriesItemLabel when you use a style based on another one and setting the font family in the first one. Please use the suggested workaround.

All the best,
Sia
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
Chart
Asked by
Brian
Top achievements
Rank 1
Answers by
Sia
Telerik team
Brian
Top achievements
Rank 1
Share this question
or