0

I need to format the label inside the BarItem so it can have a time format, like 00:10. I'm using the BarSeries.Format function, but if I don't use the BarSeries.LabelFormatString the labels don't show and if I use LabelFormatString all labels will have the same format/values.

Here's my code:

BarItem baritem = new BarItem {Value = 10};  //in seconds
Object[] time = new object[2];
time [0] = "00";
time [1] = "10";
barSeries.Format("{0}:{1}",baritem,time);

With this code it shows no labels. Using barSeries.LabelFormatString = "{0}" shows 10.

I've tried barSeries.LabelFormatString = barSeries.Format("{0}:{1}",baritem,time) but then all labels became the same...

helloflash
  • 2,457
  • 2
  • 15
  • 19
VeYroN
  • 760
  • 9
  • 19

1 Answers1

0

For someone that had the same problem, the solution is simple, just subclass the BarItem Class, like this:

class TimeBarItem : BarItem {
  public TimeSpan Time { get { return TimeSpan.FromSeconds(this.Value); } }
}

After that we can do: barSeries.LabelFormatString = "{Time}"

VeYroN
  • 760
  • 9
  • 19