This is a migrated thread and some comments may be shown as answers.

After GridView is closed the user is switched to some select mode when using ZoomScrollSettingsY in CartArea

3 Answers 44 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Sheetal
Top achievements
Rank 1
Sheetal asked on 29 Jun 2010, 02:15 PM

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;

 

}

 

 

 

)

3 Answers, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 02 Jul 2010, 09:24 AM
Hi Sheetal,

This is the default behavior of RadChart when ChartArea.ZoomScrollSettingsY.ScrollMode is set to ScrollMode.ScrollAndZoom. This defines the area you need to zoom in. You can disable it by setting the ScrollMode to ScrollMode.None or ScrollMode.ScrollOnly. In you choose the latter, you may want to provide an initial zoom level by setting ZoomScrollSettingsY.RangeStart and RangeEnd properties with values between 0 and 1, defining the initially visible area.

Greetings,
Ves
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Sheetal
Top achievements
Rank 1
answered on 07 Jul 2010, 02:37 PM
I would like to keep the mode set to scroll and zoom because I want to the user to be able to zoom in/out when the bar chart is very small and not visible. However, I am not sure how to prevent the bar from being selected when the user clicks on a bar. I did observe that the selection doesn't happen if I click in the empty chart area other than the bar. I tried to set the ChartArea.ZoomScrollSettingsY.ScrollMode = None when the Chart is clicked (in the Chart clicked event) and then reset it back to ScrollAndZoom, but the selection was still made.

Thanks,
Sheetal.
0
Ves
Telerik team
answered on 09 Jul 2010, 03:53 PM
Hello Sheetal,

The selection, shown in the image attached to your initial post is a zoom selection and its purpose is to show the area which will be zoomed. It does not specifically select any bar. I am afraid it would not be possible to show the bars above this selection.

Sincerely,
Ves
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Chart
Asked by
Sheetal
Top achievements
Rank 1
Answers by
Ves
Telerik team
Sheetal
Top achievements
Rank 1
Share this question
or