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

时间:2014-02-04 16:03:26

标签: c# wpf oxyplot

以下是我的图表中的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>

在情节系列中有没有办法将情节点显示为圆形或某种性质的东西?

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

Plot points are shown

2 个答案:

答案 0 :(得分:11)

来自链接的讨论:

  

这应该由Marker*中的LineSeries属性涵盖   请参阅示例浏览器中的示例。

您似乎必须设置MarkerFillMarkerType。要仅显示标记(且不显示任何行),请将Color设置为Transparent

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

答案 1 :(得分:2)

在Oxyplot论坛上回答了那些发现此问题的人。

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

相关问题