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

Chart zoom/scroll

3 Answers 131 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Adiel
Top achievements
Rank 2
Adiel asked on 22 Apr 2010, 02:58 PM
Hi
I've follow the example of zoom/scroll in charts.
I can see the scroll bar and change the range but then the chart only freaze for second and stay in the older range no changing.
I use databind to the itemssource not effect.

my chart contain multiple series mapping with collection of data.
any ideas?
Thanks
Adiel

3 Answers, 1 is accepted

Sort by
0
Vladimir Milev
Telerik team
answered on 27 Apr 2010, 09:01 AM
Hello Adiel,

Without taking a look at some runnable code it is difficult to tell what is the problem. Are you using XValue item mappings? They are required for zooming and scrolling to work.

Sincerely yours,
Vladimir Milev
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
ravikiran jogu
Top achievements
Rank 1
answered on 27 May 2010, 04:15 PM
Hi, this is the code I have and i can never get scrolling working. I do not need zoom. and the chart just mushes up and scrolling just does not work. Please help. What am I missing? Please note the different ways I tried binding. I would like to use ActualSeries.Add(new DataPoint() { YValue method of binding as I am doing it for other charts with multiple series.

Thanks
 
 
private void GetData()   
{  
SilverBusiness.BusinessSoapClient _Business1 = new SilverBusiness.BusinessSoapClient();   
   
_Business1.GetMetricDetailsCompleted +=   
 
 
new EventHandler<SilverBusiness.GetMetricDetailsCompletedEventArgs>(BindActualChart);   
   
 
_Business1.GetMetricDetailsAsync(0, 0,   
 
 
 
Convert.ToInt32(this.parameters["MetricID"]), 3, Convert.ToDateTime("1/1/1900"), 0);   
   
 
}  
 
   
 
 
 
private void InitRadChat()   
   
 
{  
 
RadChart1.DefaultView.ChartLegendPosition =   
 
 
 
Dock.Left;   
   
 
RadChart1.DefaultView.ChartTitle.HorizontalContentAlignment =   
 
 
 
HorizontalAlignment.Left;   
   
 
RadChart1.DefaultView.ChartLegend.UseAutoGeneratedItems =   
 
 
 
true;   
   
 
RadChart1.DefaultView.ChartArea.EnableAnimations =   
 
 
 
false;   
   
 
   
 
 
 
SamplingSettings samplingSettings = new SamplingSettings();   
   
 
samplingSettings.SamplingFunction =   
 
 
 
ChartSamplingFunction.KeepExtremes;   
   
 
samplingSettings.SamplingThreshold = 1000;  
 
RadChart1.SamplingSettings = samplingSettings;  
 
   
 
 
 
//ZoomScrollSettings zoomSettings = new ZoomScrollSettings();   
   
 
 
 
   
 
//zoomSettings.ScrollMode = ScrollMode.ScrollOnly;   
   
 
 
 
   
 
//zoomSettings.MinZoomRange=10;   
   
 
 
 
   
 
//this.RadChart1.DefaultView.ChartArea.ZoomScrollSettingsX = zoomSettings;   
   
 
 
 
   
 
//   
   
 
 
 
   
 
//RadChart1.DefaultView.ChartArea.AxisX.TicksDistance = 300;   
   
 
 
 
   
 
//RadChart1.DefaultView.ChartArea.AxisX.Step = 1;   
   
 
 
 
   
 
////RadChart1.DefaultView.ChartArea.AxisX.MinValue = new DateTime( 2009, 1, 31 ).ToOADate();   
   
 
 
 
   
 
////RadChart1.DefaultView.ChartArea.AxisX.MaxValue = new DateTime( 2009, 4, 30 ).ToOADate();   
   
 
 
 
   
 
//RadChart1.DefaultView.ChartArea.AxisX.LabelStep = 1;   
   
 
 
 
   
 
//RadChart1.DefaultView.ChartArea.AxisX.IsDateTime = true;   
   
 
 
 
   
 
//RadChart1.DefaultView.ChartArea.AxisX.LabelRotationAngle = 25;   
   
 
 
 
   
 
//RadChart1.DefaultView.ChartArea.AxisX.DefaultLabelFormat = "MMM-yyyy";   
   
 
 
 
   
 
//RadChart1.DefaultView.ChartArea.AxisX.LayoutMode = AxisLayoutMode.Auto;   
   
 
 
 
   
 
//RadChart1.DefaultView.ChartArea.ItemWidthPercent = 100;   
   
 
 
 
}  
 
   
 
private void BindActualChart(object sender, SilverBusiness.GetMetricDetailsCompletedEventArgs e)   
   
 
{  
 
InitRadChat();  
 
   
 
 
 
//RadChart1.DefaultView.ChartTitle.Content = e.Result[0].MetricName.ToString();   
   
 
 
 
   
 
//RadChart1.DefaultView.ChartTitle.Width = e.Result.Count * 40 + 300;   
   
 
 
 
RadChart1.DefaultView.ChartArea.Height=110;  
 
   
 
//RadChart1.Width = e.Result.Count * 40 + 300;   
   
 
 
 
RadChart1.DefaultView.ChartArea.ZoomScrollSettingsX.ScrollMode =   
 
ScrollMode.ScrollOnly;   
   
 
   
 
 
 
this.RadChart1.DefaultView.ChartArea.AxisX.LabelStep = 10;   
   
 
   
 
 
 
this.RadChart1.DefaultView.ChartArea.AxisX.DefaultLabelFormat = "D";   
   
 
   
 
 
 
SeriesMapping seriesMapping = new SeriesMapping();   
   
 
seriesMapping.SeriesDefinition =   
 
 
 
new BarSeriesDefinition();   
   
 
   
 
 
 
ItemMapping itemMapping = new ItemMapping();   
   
 
itemMapping.DataPointMember =   
 
 
 
DataPointMember.YValue;   
   
 
itemMapping.FieldName =   
 
 
 
"MetricValue";   
   
 
seriesMapping.ItemMappings.Add(itemMapping);  
 
itemMapping =   
 
 
 
new ItemMapping();   
   
 
itemMapping.DataPointMember =   
 
 
 
DataPointMember.XValue;   
   
 
itemMapping.FieldName =   
 
 
 
"MetricDate";   
   
 
seriesMapping.ItemMappings.Add(itemMapping);  
 
RadChart1.SeriesMappings.Add(seriesMapping);  
 
RadChart1.ItemsSource = e.Result;  
 
   
 
   
 
 
 
//DataSeries ActualSeries = new DataSeries();   
   
 
 
 
   
 
//ActualSeries.LegendLabel = "Actual";   
   
 
 
 
   
 
//ActualSeries.Definition = new BarSeriesDefinition();   
   
 
 
 
   
 
//for (int i = 0; i < e.Result.Count; i++)   
   
 
 
 
   
 
//{   
   
 
 
 
   
 
// ActualSeries.Add(new DataPoint() { YValue = Convert.ToDouble(e.Result[i].MetricValue), XValue = e.Result[i].MetricDate.ToOADate() });   
   
 
 
 
   
 
//}   
   
 
 
 
   
 
//RadChart1.DefaultView.ChartArea.DataSeries.Add(ActualSeries);   
   
 
 
 
}  
 
0
Vladimir Milev
Telerik team
answered on 02 Jun 2010, 07:11 AM
Hello ravikiran jogu,

In order to use zooming and scrolling you need to use the ItemsSource property. Please, check this example for more information.

Best wishes,
Vladimir Milev
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
Adiel
Top achievements
Rank 2
Answers by
Vladimir Milev
Telerik team
ravikiran jogu
Top achievements
Rank 1
Share this question
or