wpf 如何在 Oxyplot 中显示折线图的绘图点?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21557334/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 10:43:34  来源:igfitidea点击:

How can I show the plot points in Oxyplot for a line Graph?

c#wpfoxyplot

提问by JBurlison

Here is the xaml code to my graph:

这是我的图表的 xaml 代码:

<oxy:Plot HorizontalAlignment="Left" 
              Height="222" 
              Margin="0,49,0,0" 
              VerticalAlignment="Top" 
              Width="870" 
              Background="Transparent" 
              PlotAreaBorderColor="White" 
              LegendBorder="Transparent"
              Name="viewCountPlot"
              Title="Videos Watched"
              TextColor="White" IsLegendVisible="False" IsManipulationEnabled="False" IsMouseWheelEnabled="False">
        <oxy:Plot.Axes>
            <oxy:DateTimeAxis Name="datetimeAxis" Position="Bottom" MajorGridlineColor="#40FFFFFF" TicklineColor="White" StringFormat="M/d/yy" IntervalType="Days" ShowMinorTicks="False"/>
        </oxy:Plot.Axes>
        <oxy:Plot.Series>
            <oxy:LineSeries 
                Name="viewCountSeries" 
                Title="Videos Viewed"
                DataFieldX="Date" 
                DataFieldY="Value" 
                Color="#CCFA6800" 
                StrokeThickness="2" 
                TrackerFormatString="Date: {2:M/d/yy}&#x0a;Value: {4}"
                ItemsSource="{Binding PlotItems}" MarkerStroke="#FFFDFDFD" />
        </oxy:Plot.Series>
        <oxy:Plot.DefaultTrackerTemplate>
            <ControlTemplate>
                <Canvas>
                    <Grid Canvas.Left="{Binding Position.X}" Canvas.Top="{Binding Position.Y}">
                        <Ellipse Fill="White" Width="12" Height="12" HorizontalAlignment="Left" VerticalAlignment="Top">
                            <Ellipse.RenderTransform>
                                <TranslateTransform X="-6" Y="-6" />
                            </Ellipse.RenderTransform>
                        </Ellipse>
                        <TextBlock Foreground="{DynamicResource OrangeTextColor}" Text="{Binding}" Margin="-60 -40 0 0" />
                    </Grid>
                </Canvas>
            </ControlTemplate>
        </oxy:Plot.DefaultTrackerTemplate>
    </oxy:Plot>

In the plot Series is there any way to show the plot points as circles or something of that nature?

在情节系列中,有没有办法将情节点显示为圆圈或类似的东西?

Here is an example image of what I mean, each plot point has a small circle associated with it:

这是我的意思的示例图像,每个绘图点都有一个与之关联的小圆圈:

Plot points are shown

显示了绘图点

回答by ken

From the linked discussion:

来自链接的讨论:

This should be covered by the Marker*properties in the LineSeriesSee examples in the Example browser.

这应该包含 在示例浏览器Marker*中的LineSeries查看示例中的属性中。

It looks like you have to set MarkerFilland MarkerType. To show only markers (and no line), set the Colorto Transparent.

看起来你必须设置MarkerFillMarkerType。要仅显示标记(没有线),设置ColorTransparent

<oxy:LineSeries ItemsSource="{Binding MyDataPoints}" 
                Color="Transparent" 
                MarkerFill="SteelBlue" 
                MarkerType="Circle" />

回答by JBurlison

Answered on the Oxyplot forums for those who find this.

在 Oxyplot 论坛上为发现此问题的人解答。

https://oxyplot.codeplex.com/discussions/528893

https://oxyplot.codeplex.com/discussions/528893