【问题标题】:C# oxyplot get data from graphC# oxyplot 从图中获取数据
【发布时间】:2013-04-02 07:01:05
【问题描述】:

我试图使用它绘制一些点的图,但是我想在用户单击窗口中图的任何点时显示实际值。不知何故,这是在执行 WPF 应用程序时自动完成的,但不是在执行 Windows 窗体应用程序时。有人对此有任何想法吗?还是我必须自己使用事件处理程序等来实现它?

【问题讨论】:

  • OxyPlot 控件(WPF 和 WF)具有所谓的“跟踪器”,在这两种情况下均能实现此功能。否则,您需要考虑实现鼠标事件并检查最近的点。

标签: c# plot oxyplot


【解决方案1】:

你可以看看这个讨论。

但是假设你有一个看起来像这样的类:

class ExercisePoint : IDataPoint
{
    public double X { get; set; }
    public double Y { get; set; }
    public int Lvl { get; set; }
    public DateTime DateTime { get; set; }
    public string Exercise { get; set; }
}

您可以让您的智能设备显示如下信息:

var line_series_array = new LineSeries()
{
  ... other propreties initialization here ...
  TrackerFormatString = "{DateTime:dd.MM.yy}"+ Environment.NewLine +"{Exercise}, lvl {Lvl}:{Y}"
};

(在“{}”中使用您的类属性。如果您使用默认的 DataPoint,您只会得到 X 和 Y)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-12-23
    • 1970-01-01
    • 1970-01-01
    • 2013-01-22
    相关资源
    最近更新 更多