I am binding my chart to a DataTable. Using the following code in the chart's constructor to display two bar series works:
However, if I replace both instances of DataPointMember.XCategory with DataPointMember.XValue, I get the following error:
InvalidOperationException - The binary operator GreaterThanOrEqual is not defined for the types 'System.Object' and 'System.Double'.
Also if I use just one series on the chart (with DataPointMember.XValue), it works fine.
SeriesMapping histCostSeriesMapping = new SeriesMapping { LegendLabel = "Historic Cost", SeriesDefinition = new BarSeriesDefinition()}; histCostSeriesMapping.ItemMappings.Add(new ItemMapping("YEAR", DataPointMember.XCategory)); histCostSeriesMapping.ItemMappings.Add(new ItemMapping("HISTCOST", DataPointMember.YValue)); chart.SeriesMappings.Add(histCostSeriesMapping); SeriesMapping replCostSeriesMapping = new SeriesMapping { LegendLabel = "Replacement Cost", SeriesDefinition = new BarSeriesDefinition()}; replCostSeriesMapping.ItemMappings.Add(new ItemMapping("YEAR", DataPointMember.XCategory)); replCostSeriesMapping.ItemMappings.Add(new ItemMapping("REPLCOST", DataPointMember.YValue)); chart.SeriesMappings.Add(replCostSeriesMapping); chart.ItemsSource = _model.Data;
However, if I replace both instances of DataPointMember.XCategory with DataPointMember.XValue, I get the following error:
InvalidOperationException - The binary operator GreaterThanOrEqual is not defined for the types 'System.Object' and 'System.Double'.
Also if I use just one series on the chart (with DataPointMember.XValue), it works fine.