SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

Welcome to the SciChart Community Forums!

Please use the forums below to ask questions about SciChart. Take a moment to read our Question asking guidelines on how to ask a good question and our support policy

We also have a tag=SciChart on Stackoverflow.com where you can earn rep for your questions!

1
0

Hi There!

I created a UserControl that contains amongst other stuff a SciChartSurface. That control can be resized by the user to any size and is together with a lot of other stuff in a grid. The user can create a PDF of the whole whole grid using RenderTargetBitmap.

For the PDF the grid is resized by a factor x to get a higher resolution. All children of that grid are repostioned and so on and it all works. The Chart looking really good in the PDF, but the TickLabels are not resizing when changing the FontSize of their axis.

I tried to bind the FontSize in the TickLabelStyle to the Axis FontSize in XAML and tried to set the binding in code behind but I can’t get it to work.

Anyone got an idea how to set TickLabelStyle.FontSize the same as its axis FontSize?

UPDATE: Manged to set a binding in the TickLabelStyle to the upper NumericAxis, but now I have the tick labels font size changing itself between the new and old font size all the time until I it change back to the old font size.

Thanks for any help!

  • You must to post comments
0
0

Hi there

Seems that RelativeSource and ElementName binding doesn’t work for all labels if try to use it in TickLabelStyle. Some of ticks are successfuly bounded but some of them don’t because binding can’t locate source. The strange behavior of axis ticks labels caused by reusing of ticklabels during redrawing of chart. Chart doesn’t create new labels unless it’s necessary so style and binding expression remains the same for all of them.

To woraround I created static resource and used it to bind font size( this can be some property in view model locator or something else) and everything works:

 <Style TargetType="sciChart:AxisBase" x:Key="NumericAxisStyle">
        <Setter Property="TickLabelStyle">
            <Setter.Value>
                <Style TargetType="sciChart:NumericTickLabel">
                    <Setter Property="FontSize" Value="{Binding Source={StaticResource FontVm}, Path=Font}"/>
                </Style>
            </Setter.Value>
        </Setter>
    </Style>

Best regards,
Yura

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.