【问题标题】:Hide some points in Oxyplot Line series隐藏 Oxyplot Line 系列中的一些点
【发布时间】:2018-05-10 12:12:39
【问题描述】:

我需要在 oxyplot 线系列中显示/隐藏一些数据点。可能吗? 虽然有些标记是不可见的,但线应该穿过不可见的标记。

【问题讨论】:

    标签: wpf oxyplot


    【解决方案1】:

    您可以使用两个系列来实现这一点。第一个将在没有标记的情况下绘制完整的点(和线)。第二个系列将绘制可见点(带有标记,但线条样式设置为无)。例如

     DataPoint[] points = new DataPoint[]
            {
                new DataPoint(1,12),
                new DataPoint(2,10),
                new DataPoint(3,9),
                new DataPoint(4,13),
                new DataPoint(5,14),
                new DataPoint(6,10)
            };
            var seriesComplete = new OxyPlot.Series.LineSeries();
    
            seriesComplete.Points.AddRange(points);
    
    
            var seriesVisible = new OxyPlot.Series.LineSeries();
            seriesVisible.Points.AddRange(points.Where(x => x.Y % 2 == 0));
            seriesVisible.MarkerFill = OxyColors.Blue;
            seriesVisible.MarkerType = MarkerType.Circle;
            seriesVisible.MarkerSize = 10;
            seriesVisible.LineStyle = LineStyle.None;
    
            this.MyModel.Series.Add(seriesComplete);
            this.MyModel.Series.Add(seriesVisible);
    

    结果附在图片

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-12-09
      • 2014-02-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多