Hi Sadaqat,
The LabelSource of ChartAxis should be collection of Double, String or DateTime. It should not be any other class. So you need to calculate the Labels for Axis manually as shown in below code snippet.
Code Snippet(C#):
List<double> _labelSource = new List<double>();
for (int i = 0; i < _viewModel.DataCollection.Count; i++)
{
_labelSource.Add(_viewModel.DataCollection[i].XData);
}
ChartSeries series = new ChartSeries() {Type=ChartTypes.Line, DataSource = _viewModel.DataCollection, BindingPathX = "XData", BindingPathsY = new List<String> {"YData"} };
series.XAxis = new ChartAxis() { IsAutoSetRange = true,RangeCalculationMode=RangeCalculationMode.ConsistentAcrossChartTypes,RangePadding=ChartRangePaddingType.None};
ChartArea area = new ChartArea();
area.PrimaryAxis = new ChartAxis() { IsAutoSetRange=false,Range=new DoubleRange(_labelSource[0],_labelSource[_labelSource.Count-1]),LabelsMode = ChartAxisLabelsMode.DataSource, LabelsSource = _labelSource };
area.SecondaryAxis = new ChartAxis() { IsAutoSetRange = true };
area.Series.Add(series);
Chart chart = new Chart();
chart.Areas.Add(area);
We have prepared a sample based on this. Please find the attached sample.
If you still facing any issues, please revert to us by modifying the sample. This would be more helpful to assist you better.
Sample:
Please let us know if you have any queries.
Thanks,
Vinoth Kumar J
MultipleXAxis_176b88a2.zip