简体   繁体   中英

C# oxyplot get data from graph

im trying to make a plot of some points using this, however i would like to show the actual values when the user clicks on any point of the plot in the window. Somehow this is done automatically when doing a WPF app, but not when doing a windows form app. Does anyone have any idea about this? Or do i have to implement it myself with event handlers and such?

You could have a look at this discussion.

But assuming you have a class that looks like:

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; }
}

you could get your tracker to display info like this:

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

(Use your class properties inside the "{ }". If you use the default DataPoint you get only X and Y)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM