WPF chart: how to collapse data points in rows

I have a few lines in a chart. First, the lines of the chart begin, and then the lines go along the lines. This is annoying and the size of large dots makes large datasets just useless. I am currently doing this for each line ...

    <chartingToolkit:LineSeries
          Title="Socket 2"
          Name="LineSocket2"
          LegendItemStyle ="{StaticResource LegendItemStyle}"
          IndependentValueBinding="{Binding timestamp}"
          DependentValueBinding="{Binding wattage}"
          ToolTip="Socket 2">

        <chartingToolkit:LineSeries.DataPointStyle>
            <Style TargetType="{x:Type chartingToolkit:LineDataPoint}">
                <Setter Property="Visibility" Value="Collapsed"/>
            </Style>
        </chartingToolkit:LineSeries.DataPointStyle>

    </chartingToolkit:LineSeries>

But he does not do what I want.

How can I do that?

+3
source share
2 answers

The charting toolkit is actually derived from the charts in the Silverlight toolbox.

Therefore, the answer to the question removing-collapsing-datapoints-in-a-lineseries may work for you.

+3
source

-, :

                <chartingToolkit:Chart DataContext="1,10 2,20 3,30 4,40" HorizontalAlignment="Stretch" Margin="-1,14,0,0" Name="chart1" Title="Chart Title" VerticalAlignment="Stretch" Width="806" Height="Auto">
                    <chartingToolkit:LineSeries Name="Series1" DependentValuePath="X" IndependentValuePath="Y" ItemsSource="{Binding}">
                        <chartingToolkit:LineSeries.DataPointStyle>
                            <Style TargetType="chartingToolkit:LineDataPoint">
                                <Setter Property="Opacity" Value="0" />
                                <Setter Property="Background" Value="Blue" />
                            </Style>
                        </chartingToolkit:LineSeries.DataPointStyle>
                    </chartingToolkit:LineSeries>
                </chartingToolkit:Chart>
+11

Source: https://habr.com/ru/post/1733008/


All Articles