OxyPlot:ColumnSeries/BarSeries显示每列的值

Tvd*_*Tvd 4 wpf stackedbarseries oxyplot

在我的WPF应用程序中,我使用OxyPlot.我将我的数据绑定到PlotModel,一切运行良好.

我想在图表上显示每列的值.可能吗?

作为参考,这个BarSeries现场示例,我希望分别显示2009年,2010年和2011年苹果的实际价值.即2009Apples列的Value1值,2010Apples的Value2值等.

我查看了BarSeries的API(对于可互换使用的WPF ColumnSeries).Bar和其他图表的教程.但无法在任何地方找到这样的东西.

我该如何实现这一目标?

Ste*_*eve 6

是的,只需设置LabelFormatString系列的属性即可.

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);
// ...
Run Code Online (Sandbox Code Playgroud)

还有一个可以设置的可选属性LabelPlacement.默认值为LabelPlacement.Outside:

theSeries.LabelPlacement = LabelPlacement.Middle;
Run Code Online (Sandbox Code Playgroud)