开发者

WPF Charting: how to collapse datapoint dots in lineseries

开发者 https://www.devze.com 2022-12-20 19:44 出处:网络
I have multiple line series in a chart. Chart lines are drawn first and then dots follow the lines. It\'s annoying and the size of big dots makes large datasets simply useless.

I have multiple line series in a chart. Chart lines are drawn first and then dots follow the lines. It's annoying and the size of big dots makes large datasets simply useless. Currently I am doing this for each lineseries...

    <chartingToolkit:LineSeries
          Title="Socket 2"
          Name="LineSocket2"
          LegendItemStyle ="{StaticResource Le开发者_StackOverflowgendItemStyle}"
          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 it doesn't do what I want.

How can it be done?


If it helps anyone, the following works for me:

                <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>


The charting toolkit is actually a derivative of the Charting in the Silverlight toolkit.

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

0

精彩评论

暂无评论...
验证码 换一张
取 消