4

In my WPF app, I use OxyPlot. I bind my data to the PlotModel and all is working well.

I want to display the value of each column on the chart. Is it possible?

For reference, this example of BarSeries on site, I wish to show actual value of Apples of 2009, 2010 & 2011 respectively on each column. i.e. value of Value1 for the 2009Apples column, Value2 for 2010Apples and so on.

I looked up at the APIof the BarSeries (For WPF ColumnSeries used interchangeably). Tutorials of Bar & other plots. But couldn't find such thing anywhere.

How do I achieve this?

Steve
  • 6,334
  • 4
  • 39
  • 67
Tvd
  • 4,463
  • 18
  • 79
  • 125

1 Answers1

6

Yes, just set the LabelFormatString property of your series.

var theSeries = new ColumnSeries();
theSeries.LabelFormatString = "{0:F2}"; // Example: 1.2311 will display like "1.23"

// Add your columns
theSeries.Items.Add(new ColumnItem(someValue);
// ...

There is also an optional property you can set called LabelPlacement. The default value is LabelPlacement.Outside:

theSeries.LabelPlacement = LabelPlacement.Middle;
Steve
  • 6,334
  • 4
  • 39
  • 67
  • Thanks for support. FYI, FormatString is not options, u got to enter else nothing shows up. – Tvd Jan 04 '14 at 09:54