TrackerFormatString not only show X, Y or Value ? or other method ?

Oystein Bjorke 10 years ago 0
This discussion was imported from CodePlex

tony_codeplex wrote at 2012-09-16 09:43:

Hello:

Since OxyPlot no ToolTip feature currently, so I was trying to use TrackerFormatString of LineSeries to show data point information but I failed (I am using Silverlight). for example I have an object like the following:

Class myObj
{
  int x;
  int y;
  double status;   //I need this status show as a status string after calculation by a method when mouse click or hover current point
}

LineSeries only show X, Y, so I tried ScatterSeries (I actually need LineSeries but not ScatterSeries), but ScatterSeries still can not show a method converted string in TrackerFormatString.

So is there any other solution? Am I using wrong way? 

Thanks!


objo wrote at 2012-09-16 11:37:

try adding a public property to your class

public double Status { get { return status; } }

and set the TrackerFormatString of the LineSeries to something like "{Status:0.00}"

I will add an example later. Note that the status values will not be interpolated if you click between points.


tony_codeplex wrote at 2012-09-16 17:12:

Thanks! objo.

Waiting for your example...

please note I need to show x, y and status string (currently I only need show 3 data, but maybe more in the future, i mean, is it possible show all object properties using LineSeries? ) on my screen when mouse click or hover. 

and, my status string is not simple like "{Status:0.00}", the status handle method similar like the following code:

public string GetStatusString(double status)
{
   if((status & FLAG_A) == 0)
{
   return "Status A";
} 
else
{
  if(status & FLAG_B) == 0)
      return "Status B";
  else
 {
    switch(AnotherProperty)
{
  case xxx:
     if(stauts & ..)
      return "Status xxx";
     break;
   case xxxx:
      ...
    break;
} 
} 

} 
return "Status Fail"; 
} 

so do you think is it possible to implement using oxyplot LineSeries ?

Thanks!


tony_codeplex wrote at 2012-09-16 20:07:

Hi objo:

I got it just now!

I did not know I could use  object's property directly like "{Status}" in TrackerFormatString, all existing examples just show "{0}", "{1}", "{2}".....

It is very helpful!  Thank you very much!  OxyPlot is really great!

BTW: I think there is not ONLY me don't know this usage, hope they can get help from this post too.