ZoomScrollSettingsY and the ScrollMode to ScrollAndZoom. Under certain conditions when zooming in, the index on the Y-axis is repeated twice. Please see attached image. How can this be prevented?
private
void BindDataToChart()
{
RadChart1.DefaultView.ChartArea.DataSeries.Clear();
DataSeries seriesCategory1 = new DataSeries();
DataSeries seriesCategory2 = new DataSeries();
int startIndx = 0;
int endIndx = _ForecastViewModel.ForecastSummary[0].Count();
int i = 0;
int nIndx = 0;
string category = "";
for (nIndx = startIndx; nIndx < endIndx; nIndx++)
{
ForecastSummaryData data = (ForecastSummaryData)(_ForecastViewModel.ForecastSummary[0][nIndx]);
DataPoint category1dataPoint = new DataPoint();
DataPoint category2dataPoint = new DataPoint();
category = data.category;
string year = "";
if (category == "1") {
category1dataPoint.LegendLabel =
"1";
category1dataPoint.XValue =
double.Parse(data.month);
if (data.schedule_amount > 0)
category1dataPoint.YValue = (double)(data.amount / 1000);
category1dataPoint.XCategory = Convert.ToString(data.monthname.TrimEnd().Substring(0, 3) + " " + year);
category1dataPoint.Tooltip =
String.Format("{0} contracts/{1:C}", data.count, (double)(data.amount));
seriesCategory1.Add(category1dataPoint);
}
else {
category2dataPoint.LegendLabel =
"2";
category2dataPoint.XValue =
double.Parse(data.month);
if (data.schedule_amount > 0)
category2dataPoint.YValue = (double)(data.amount / 1000);
category2dataPoint.XCategory =
Convert.ToString(data.monthname.TrimEnd().Substring(0, 3) + " " + year);
category2dataPoint.Tooltip =
String.Format("{0} contracts/{1:C}", data.count, (double)(data.amount));
seriesCategory2.Add(category2dataPoint);
}
}
// Set the bar chart properties
RadChart1.DefaultView.ChartArea.DataSeries.Clear();
RadChart1.DefaultView.ChartArea.LabelFormatBehavior =
LabelFormatBehavior.HumanReadable;
RadChart1.DefaultView.ChartArea.AxisY.DefaultLabelFormat = (
"$0K");
RadChart1.DefaultView.ChartArea.AxisX.LayoutMode = AxisLayoutMode.Between;
RadChart1.DefaultView.ChartArea.AxisX.Step = 2;
RadChart1.DefaultView.ChartArea.AxisX.LabelRotationAngle = 45;
RadChart1.DefaultView.ChartLegend.HorizontalAlignment =
HorizontalAlignment.Right;
RadChart1.DefaultView.ChartLegend.FontSize = 10;
seriesCategory1.LegendLabel =
"Scheduled";
seriesCategory1.Definition = new BarSeriesDefinition();
seriesCategory2.LegendLabel =
"Unscheduled";
seriesCategory2.Definition =
new BarSeriesDefinition();
byte[] fillColor1 = { 255, 106, 148, 200 };
byte[] strokeColor1 = { 255, 106, 148, 200 };
SetBarLayout((
BarSeriesDefinition)seriesCategory1.Definition,
fillColor1,
strokeColor1,
4d,
3);
byte[] fillColor2 = { 255, 145, 178, 80 };
byte[] strokeColor2 = { 255, 145, 178, 80 };
SetBarLayout((BarSeriesDefinition)seriesCategory2.Definition, fillColor2,
strokeColor2,
4d,
3);
if (endIndx == 0) {
RadChart1.ItemsSource = null;
RadChart1.DefaultView.ChartArea.IsNoDataMessageEnabled =
false;
}
else
{
RadChart1.DefaultView.ChartArea.ZoomScrollSettingsY.ScrollMode =
ScrollMode.ScrollAndZoom; RadChart1.DefaultView.ChartArea.DataSeries.Add(seriesCategory1);
RadChart1.DefaultView.ChartArea.DataSeries.Add(seriesCategory2);
RadChart1.DefaultView.ChartArea.EnableAnimations =
false;
}
this.Cursor = Cursors.Arrow;
}
)