WPF Charting: how to collapse datapoint dots in lineseries

送分小仙女□ 提交于 2019-12-21 20:33:02

问题


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 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 it doesn't do what I want.

How can it be done?


回答1:


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.




回答2:


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>


来源:https://stackoverflow.com/questions/2273268/wpf-charting-how-to-collapse-datapoint-dots-in-lineseries

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!