I'm dynamically binding a few stacked BarSeries objects to a RadCartesianChart as follows:
BarSeries seriesBar = new BarSeries
{
CategoryBinding = new PropertyNameDataPointBinding() { PropertyName = "seriesName" },
ValueBinding = new GenericDataPointBinding<BarChartBarSeriesViewModel, decimal?>() { ValueSelector = selector => selector.segments[j].value },
ItemsSource = this.barSeries,
CombineMode = Telerik.Charting.ChartSeriesCombineMode.Stack,
DefaultVisualStyle = styleSegment,
ShowLabels = true
};
// Center labels within bar
seriesBar.LabelDefinitions.Clear();
seriesBar.LabelDefinitions.Add(new ChartSeriesLabelDefinition { VerticalAlignment = System.Windows.VerticalAlignment.Center, Format="c" });
The ValueBinding for each series is a decimal? object. I'm trying to apply formatting to the labels within the bars by adding a new LabelDefinition object to the series (see last line of code). The vertical centering of the label within each bar works great but the Format="c" does not work. It causes every label to show as "c". How do I display each bar segment's label as currency?
BarSeries seriesBar = new BarSeries
{
CategoryBinding = new PropertyNameDataPointBinding() { PropertyName = "seriesName" },
ValueBinding = new GenericDataPointBinding<BarChartBarSeriesViewModel, decimal?>() { ValueSelector = selector => selector.segments[j].value },
ItemsSource = this.barSeries,
CombineMode = Telerik.Charting.ChartSeriesCombineMode.Stack,
DefaultVisualStyle = styleSegment,
ShowLabels = true
};
// Center labels within bar
seriesBar.LabelDefinitions.Clear();
seriesBar.LabelDefinitions.Add(new ChartSeriesLabelDefinition { VerticalAlignment = System.Windows.VerticalAlignment.Center, Format="c" });
The ValueBinding for each series is a decimal? object. I'm trying to apply formatting to the labels within the bars by adding a new LabelDefinition object to the series (see last line of code). The vertical centering of the label within each bar works great but the Format="c" does not work. It causes every label to show as "c". How do I display each bar segment's label as currency?