Pre loader

Tick styles broken between version 7.x and 8.x

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

0
0

Hi,

I have problem with Major and MinorTickLinesStyle on axis. The same code produces different results in version 7.x and 8.x. Can you please take a look and let me know what was changed between versions.

Thanks in advance.

Kind regards,
Boštjan

Version
8.1.0.27856
Images
  • Lex
    • Lex
    • 6 months ago
    Hi Boštjan, Thanks for your inquiry. Unfortunately, it’s not enough information to determine the exact cause of the described issue. Could you please provide us with a code sample that can reproduce the mentioned behavior for investigation on our side? Thanks in advance, Lex S., MSEE, SciChart Technical Support Engineer
  • You must to post comments
0
0

Hi,

please see the attached code snippet. The style is the same, just the version is different.

Images
  • You must to post comments
0
0

Hi again,

My goal is to change styles of Major and Minor ticks without re-rendering. I have tried this code where I change the style which are predefined and it only works for minor ticks (thickness is still not working) and not for major ticks.

The code snippets:
The styles:

  <Style x:Key="MajorThickLineStyle" TargetType="Line">
<Setter Property="Stroke" Value="Blue"/>
<Setter Property="StrokeThickness" Value="20" />
<Setter Property="Y2" Value="20" />

<Style x:Key="MajorThinLineStyle" TargetType="Line">
<Setter Property="Stroke" Value="Red"/>
<Setter Property="StrokeThickness" Value="5" />
<Setter Property="Y2" Value="40" />

<Style x:Key="MinorThickLineStyle" TargetType="Line">
<Setter Property="Stroke" Value="Green"/>
<Setter Property="StrokeThickness" Value="2" />
<Setter Property="Y2" Value="50" />

<Style x:Key="MinorThinLineStyle" TargetType="Line">
<Setter Property="Stroke" Value="Yellow"/>
<Setter Property="StrokeThickness" Value="1" />
<Setter Property="Y2" Value="20" />

The xaml part:

<apdf:ViewUserControl.Resources>
<ResourceDictionary>
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/XRDviewCommon.Wpf;component/SciChart/Styles/LineChartStyles.xaml"/>
        <ResourceDictionary Source="/XRDviewCommon.Wpf;component/SciChart/Styles/LineChartAxesStyles.xaml"/>
        <ResourceDictionary Source="/XRDviewCommon.Wpf;component/Resources/PathGeomtries.xaml"></ResourceDictionary>
    </ResourceDictionary.MergedDictionaries>
    <!-- ReSharper disable once Xaml.RedundantResource -->
    <Style x:Key="{x:Static presenters:MultiLineChartPresenterService.XAxisStyleKey}" TargetType="{x:Type s:NumericAxis}"  BasedOn="{StaticResource DefaultXAxisStyle}">          
        <Setter Property="local:MultiLineChartView.GridStrokeThickness" 
                Value="{Binding  RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:MultiLineChartView}}, Path=DataContext.GridStrokeThickness}" />
    </Style>
    <!-- ReSharper disable once Xaml.RedundantResource -->
    <Style  x:Key="{x:Static presenters:MultiLineChartPresenterService.YAxisStyleKey}" TargetType="{x:Type s:NumericAxis}" BasedOn="{StaticResource DefaultYAxisStyle}">
        <Setter Property="local:MultiLineChartView.GridStrokeThickness" 
                Value="{Binding  RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type local:MultiLineChartView}}, Path=DataContext.GridStrokeThickness}" />
    </Style>
    <Style x:Key="MultiLineChartSurfaceStyle"
           BasedOn="{StaticResource DefaultLineChartSurfaceStyle}"
           TargetType="s:SciChartSurface">
        <Setter Property="RenderSurfaceStyle" Value="{StaticResource MultiLineRenderSurfaceStyle}" />
        <Setter Property="BorderThickness" Value="{Binding GridStrokeThickness}"></Setter>
    </Style>
</ResourceDictionary>

<commonWpf:SciChartSurface

ViewportManager=”{Binding ViewportManager}”
RenderPriority=”Normal”
RenderableSeries=”{Binding RenderableSeries, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}”
Annotations=”{s:AnnotationsBinding Annotations}”
Style=”{StaticResource MultiLineChartSurfaceStyle}”
XAxes=”{s:AxesBinding XAxes}”
YAxes=”{s:AxesBinding YAxes}”
attachedBehaviors:SciChartExportBehavior.ExportAction=”{Binding ExportAction, Mode=TwoWay}”
attachedBehaviors:SciChartExportBehavior.ExportThumbnail=”{Binding ExportThumbnail, Mode=TwoWay}”
attachedBehaviors:MinWidthForScrollbarParentBehavior.ChartPanelMinWidth=”200″>
<behaviors:Interaction.Behaviors>
<attachedBehaviors:SciChartStyleClearBehavior/>
<attachedBehaviors:SciChartExportBehavior/>
<attachedBehaviors:MinWidthForScrollbarParentBehavior/>
</behaviors:Interaction.Behaviors>
<commonWpf:SciChartSurfaceExtended.ChartModifier>





            <s:LegendModifier x:Name="LegendModifier"
                              LegendPlacement="{Binding LegendPlacement}" 
                              Orientation="{Binding LegendOrientation}"
                              IsEnabled="True"
                              ShowLegend="{Binding IsLegendVisible}" 
                              ShowVisibilityCheckboxes="False"
                              ShowSeriesMarkers="True" 
                              ScrollViewer.VerticalScrollBarVisibility="Auto"
                              ScrollViewer.HorizontalScrollBarVisibility="Auto"
                              HorizontalAlignment="{Binding LegendHorizontalAlignment}"
                              VerticalAlignment="{Binding LegendVerticalAlignment}"
                              GetLegendDataFor="AllVisibleSeries"
                              Background="Transparent"
                              FontSize="{Binding LegendFontSize}">
                <s:LegendModifier.LegendItemTemplate >
                    <DataTemplate>
                        <Grid Margin="0,0,0,3">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                                 <!--this aligns long text correctly, why??--> 
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>

                            <controls:ChartLineSymbol Grid.Row="0" Grid.Column="0" DataContext="{Binding RenderableSeries}" 
                                                      MarkerStyle="{Binding PointMarker.Tag, Mode=TwoWay, FallbackValue={x:Static treeModels:MarkerStyle.None}}" 
                                                      StrokeDashArray="{Binding StrokeDashArray, Mode=TwoWay}" 
                                                      Stroke="{Binding Stroke, Mode=TwoWay}" VerticalAlignment="Center" Margin="0,0,0,0"/>

                            <TextBlock Grid.Row="0" Grid.Column="1" 
                                       TextWrapping="Wrap" 
                                       MaxWidth="300"
                                       Margin="10,0,10,0"
                                       HorizontalAlignment="Left"
                                       VerticalAlignment="Center"
                                       Padding="0"
                                       TextAlignment="Left"
                                       Foreground="{x:Static apdf:AntonPaarBrushes.Gray102}"
                                       FontSize="{Binding ElementName=LegendModifier, Path=FontSize}"
                                       Text="{Binding SeriesName}" />
                        </Grid>
                    </DataTemplate>
                </s:LegendModifier.LegendItemTemplate>
                <!--- LegendTemplate is just needed to enable cursor to switch to Arrow (default)--> 
                <s:LegendModifier.LegendTemplate>
                    <ControlTemplate>
                        <s:SciChartLegend ItemTemplate="{Binding LegendItemTemplate}"
                                          LegendData="{Binding LegendData}"
                                          Orientation="{Binding Orientation}"
                                          ScrollViewer.HorizontalScrollBarVisibility="{Binding Path=(ScrollViewer.HorizontalScrollBarVisibility)}"
                                          ScrollViewer.VerticalScrollBarVisibility="{Binding Path=(ScrollViewer.VerticalScrollBarVisibility)}"
                                          ShowSeriesMarkers="{Binding ShowSeriesMarkers}"
                                          ShowVisibilityCheckboxes="{Binding ShowVisibilityCheckboxes}" 
                                          Background="Transparent"
                                          BorderThickness="0"
                                          Cursor="Arrow"/>
                    </ControlTemplate>
                </s:LegendModifier.LegendTemplate>
            </s:LegendModifier>
        </s:ModifierGroup>
    >

And the code behind part where the styles are changed based on the change value of “GridStrokeThickness” values

public partial class MultiLineChartView

{
public static readonly DependencyProperty GridStrokeThicknessProperty = DependencyProperty.RegisterAttached(
“GridStrokeThickness”, typeof(double), typeof(MultiLineChartView), new PropertyMetadata(default(double), GridStrokeThicknessPropertyChangedCallback));

private static void GridStrokeThicknessPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
    if (d is NumericAxis axis && e.NewValue is double thickness)
    {
        var res = new ResourceDictionary()
        {
            Source = new Uri(
                "pack://application:,,,/XRDviewCommon.Wpf;component/SciChart/Styles/LineChartAxesStyles.xaml")
        };
        var gridLineStyle = res["GridLineStyle"] as Style;
        var style = new Style(typeof(Line), gridLineStyle);
        style.Setters.Add(new Setter(Line.StrokeThicknessProperty, thickness));

        //axis.MajorGridLineStyle = style;
        axis.MinorGridLineStyle = style;

        if (thickness > 3)
        {
            axis.MajorTickLineStyle = res["MajorThickLineStyle"] as Style;
            axis.MinorTickLineStyle = res["MinorThickLineStyle"] as Style;
        }
        else
        {
            axis.MajorTickLineStyle = res["MajorThinLineStyle"] as Style;
            axis.MinorTickLineStyle = res["MinorThinLineStyle"] as Style;
        }
    }
}

public static void SetGridStrokeThickness(DependencyObject element, double value)
{
    element.SetValue(GridStrokeThicknessProperty, value);
}

public static double GetGridStrokeThickness(DependencyObject element)
{
    return (double)element.GetValue(GridStrokeThicknessProperty);
}
public MultiLineChartView()
{
    InitializeComponent();
    EffectManager.EnableDropShadows = false;

}

}

  • You must to post comments
0
0

Hi Boštjan,

Hope you are doing well.
I’m glad to inform you that the reported issue has been fixed and the changes will be delivered with the next SciChart version.

We’ll get you informed as soon as the new release is available.

Kind regards,
Lex

  • You must to post comments
0
0

Hi Boštjan,

Please be informed that we have published the new SciChart v8.6.0.28199 update containing the fix for the reported issue.

The release is available in the official NuGet feed. Here you can find more details:
SciChart WPF Changelog – SciChart

Please try it out and let us know your feedback.

Kind regards,

Lex,
SciChart Technical Support Engineer

  • You must to post comments
Showing 4 results
Your Answer

Please first to submit.