Hi,
I made a categorical chart with a bar series definition and a line series definition. The x-axis label always seems to be the category name. How can I change it to something else? I have a custom class with various properties such as XValue, YValue, XCategory and Label. I have tried a few different things as suggested in other posts on the forum, but they don't seem to work and the item on the x-axis is always labelled according to the category.
I have tried setting the item label format in the series mapping (I tried #LABEL and "#DATAITEM.Label") and I have added the item mappings as well, but it still shows the XCategory instead of the label.
var seriesDefinition = new BarSeriesDefinition
{
ShowItemLabels = false,
ShowItemToolTips = true,
ItemToolTipFormat = "#DATAITEM.Label",
ItemLabelFormat = "#DATAITEM.Label",
EmptyPointBehavior = emptyPointBehavior
};
seriesMapping.ItemMappings.Add(new ItemMapping("XValue", DataPointMember.XValue));
seriesMapping.ItemMappings.Add(new ItemMapping("YValue", DataPointMember.YValue));
seriesMapping.ItemMappings.Add(new ItemMapping("XCategory", DataPointMember.XCategory));
seriesMapping.ItemMappings.Add(new ItemMapping("Label", DataPointMember.Label));
I have also tried the following:
chart.DefaultView.ChartArea.AxisX.DefaultLabelFormat = "#DATAITEM.Label"; and chart.DefaultView.ChartArea.AxisX.DefaultLabelFormat = "#LABEL";
Any help would be appreciated.
I made a categorical chart with a bar series definition and a line series definition. The x-axis label always seems to be the category name. How can I change it to something else? I have a custom class with various properties such as XValue, YValue, XCategory and Label. I have tried a few different things as suggested in other posts on the forum, but they don't seem to work and the item on the x-axis is always labelled according to the category.
I have tried setting the item label format in the series mapping (I tried #LABEL and "#DATAITEM.Label") and I have added the item mappings as well, but it still shows the XCategory instead of the label.
var seriesDefinition = new BarSeriesDefinition
{
ShowItemLabels = false,
ShowItemToolTips = true,
ItemToolTipFormat = "#DATAITEM.Label",
ItemLabelFormat = "#DATAITEM.Label",
EmptyPointBehavior = emptyPointBehavior
};
seriesMapping.ItemMappings.Add(new ItemMapping("XValue", DataPointMember.XValue));
seriesMapping.ItemMappings.Add(new ItemMapping("YValue", DataPointMember.YValue));
seriesMapping.ItemMappings.Add(new ItemMapping("XCategory", DataPointMember.XCategory));
seriesMapping.ItemMappings.Add(new ItemMapping("Label", DataPointMember.Label));
I have also tried the following:
chart.DefaultView.ChartArea.AxisX.DefaultLabelFormat = "#DATAITEM.Label"; and chart.DefaultView.ChartArea.AxisX.DefaultLabelFormat = "#LABEL";
Any help would be appreciated.