0

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?

riQQ
  • 9,878
  • 7
  • 49
  • 66
Cristiano Coelho
  • 1,675
  • 4
  • 27
  • 50
  • The OxyPlot control (both WPF and WF) have what's called a "tracker" that implements this functionality equally in both cases. Otherwise, you would need to look into implementing mouse events and checking nearest points. – Ioan Jul 30 '13 at 19:44

1 Answers1

1

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)

Noctis
  • 11,507
  • 3
  • 43
  • 82