Hi,
I have a BarChart with two data series. On click event on the bar, I open a gridview with detailed information about the bar. The BarChart has ZoomScrollSettingsY on Y-axis. Every time I click on the bar chart and opne up the gridview and then close the gridview, I go into some kind of selection mode. I see that the zoom selection is somehow enabled on the chart area. I initially tried to catch the PropertyChanged event in ZoomScrollSettingsY. But this doesn't help. Please see the code below. How can I prevent the chart area from being selected when I click on a bar chart area?
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 };
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;
}
)