Hi,
I have a simple composite chart with the following scenario:
When scaling in on the x axis the contents of the chart shift to the right. When scaling out the contents shift to the left. Note that the scroll value does not shift and is set to 0.
Is there a simple way to keep the contents of the chart centered while scaling in and out? If not what is the best way to dynamically adjust the scrolling as the scale value changes so that the contents of the chart remain centered and do not shift left or right.
Thanks
Hi gracol,
That seems like a bug we solved recently. Could you try applying the latest service release.
Regards,
Ivan Kotev
Thanks Ivan,
Which service release was this fixed in?
Note we are using version UltraWinChart v7.3 (7.3.20073).
Grant
Hi Grant,
Could you provide a screenshot with the issue ?
Hi Ivan,
See attached.
Note that when I zoom in on the x-axis the red line in the middle of the chart shifts to the right and eventually goes out of view. If I zoom out then the red line shifts back again (this time to the left).
When I zoom in or out then what ever is in the center of the chart, lets assume it is the red line, must remain in the center without shirting left or right.
It seems to me that this behaviour is by design. Could you provide the code to produce the above chart and we will investigate the cause of the issue ?
Please take a look at this page: http://help.infragistics.com/NetAdvantage/WinForms/2010.3/CLR2.0/?page=Chart_Scrolling_and_Scaling_Charts.html, it desribes chart's scrolling and scaling.
When scaling value is increased or decreased the contents of the chart shift, because scalling is changed. If you want to prevent certain content of the chart from shifting you can attach to the chart's FillSceneGraph and manipulate chart's primitives. Take a look at this sample: http://samples.infragistics.com/2010.3/WebFeatureBrowser/contents.aspx?showCode=true&t=WebCharts/Customization/FillSceneGraph.aspx~srcview.aspx?path=../WebFeatureBrowserVB/WebCharts/Customization/FillSceneGraph.src~srcview.aspx?path=WebCharts/Customization/FillSceneGraph.src. In that sample, custom Line and Text primitives are added to indicate a target value for the data set.
Please let me know if that works for you.
Thanks for the link, however, it is still not clear to me whether I need to manually adjust the scroll value when scaling in order to prevent the contents of the chart from shifting right or left (and if so how do I do this), or if there is a setting that will handle this automatically.
This is how we generate the chart (to keep it simple I am showing only one XYSeries):
private Infragistics.Win.UltraWinChart.UltraChart chart_smile;
this.chart_smile = new Infragistics.Win.UltraWinChart.UltraChart();
this.chart_smile.ChartType = Infragistics.UltraChart.Shared.Styles.ChartType.Composite;
this.chart_smile.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.chart_smile.Name = "chart_smile";
this.Controls.Add(this.chart_smile);
ChartArea myChartArea = new ChartArea();
AxisItem axisX1 = new AxisItem();
axisX1.OrientationType = AxisNumber.X_Axis;
axisX1.DataType = AxisDataType.Numeric;
axisX1.Visible = true;
axisX1.Labels.ItemFormatString = "<DATA_VALUE:0.##>";
axisX1.Labels.Orientation = TextOrientation.VerticalLeftFacing;
axisX1.SetLabelAxisType = SetLabelAxisType.ContinuousData;
axisX1.Margin.Near.MarginType = LocationType.Percentage;
axisX1.Margin.Near.Value = 0;
axisX1.Margin.Far.MarginType = LocationType.Percentage;
axisX1.Margin.Far.Value = 0;
axisX1.Extent = 30;
AxisItem axisY1 = new AxisItem();
axisY1.OrientationType = AxisNumber.Y_Axis;
axisY1.Labels.ItemFormatString = "<DATA_VALUE:0.##>";
axisY1.Visible = true;
axisY1.SetLabelAxisType = SetLabelAxisType.ContinuousData;
axisY1.Margin.Near.MarginType = LocationType.Percentage;
axisY1.Margin.Near.Value = 0;
axisY1.Margin.Far.MarginType = LocationType.Percentage;
axisY1.Margin.Far.Value = 0;
axisY1.Extent = 30;
myChartArea.Axes.Add(axisX1);
myChartArea.Axes.Add(axisY1);
this.Chart_smile.CompositeChart.ChartAreas.Add(myChartArea);
CompositeLegend scatterLegend = new CompositeLegend();
scatterLegend.Bounds = new Rectangle(85, 0, 25, 40);
scatterLegend.BoundsMeasureType = MeasureType.Percentage;
scatterLegend.PE.ElementType = PaintElementType.Gradient;
scatterLegend.PE.FillGradientStyle = GradientStyle.ForwardDiagonal;
scatterLegend.PE.Fill = Color.Transparent;
scatterLegend.PE.FillStopColor = Color.Transparent;
scatterLegend.Border.CornerRadius = 0;
scatterLegend.Border.Thickness = 0;
ChartLayerAppearance chartLayerAppearance = new ChartLayerAppearance();
chartLayerAppearance.ChartType = ChartType.ScatterChart;
chartLayerAppearance.ChartArea = myChartArea;
chartLayerAppearance.AxisX = axisX1;
chartLayerAppearance.AxisY = axisY1;
chartLayerAppearance.Key = "Fitted";
ScatterChartAppearance sca = ((ScatterChartAppearance)chartLayerAppearance.ChartTypeAppearance);
sca.LineAppearance.Thickness = 1;
sca.ConnectWithLines = true;
sca.Icon = SymbolIcon.Circle;
sca.IconSize = SymbolIconSize.Small;
XYSeries dataSeries = dataSeriesCollection[i];
dataSeries.PEs.Add(new PaintElement(Color.Red));
dataSeries.Label = "Fitted";
dataSeries.Key = "Fitted";
dataSeries.Visible = true;
chartLayerAppearance.Series.Add(dataSeries);
scatterLegend.ChartLayers.Add(chartLayerAppearance);
this.chart_smile.CompositeChart.ChartLayers.Add(chartLayerAppearance);
this.chart_smile.CompositeChart.Legends.Add(scatterLegend);
this.chart_smile.CompositeChart.ChartAreas[0].Axes[0].ScrollScale.Visible = true;
this.chart_smile.CompositeChart.ChartAreas[0].Axes[0].Extent = 50;
this.chart_smile.CompositeChart.ChartAreas[0].Axes[0].ScrollScale.Scale = xaxisScaleValue;
this.chart_smile.CompositeChart.ChartAreas[0].Axes[0].TickmarkPercentage = xaxisTickPercentage;
this.chart_smile.CompositeChart.ChartAreas[0].Axes[1].ScrollScale.Visible = true;
this.chart_smile.CompositeChart.ChartAreas[0].Axes[1].Extent = 50;
this.chart_smile.CompositeChart.ChartAreas[0].Axes[1].ScrollScale.Scale = yaxisScaleValue;
this.chart_smile.CompositeChart.ChartAreas[0].Axes[1].TickmarkPercentage = yaxisTickPercentage;
this.chart_smile.CompositeChart.ChartAreas[0].Axes[1].ScrollScale.Height = 3;
this.chart_smile.DataBind();
this.chart_smile.Refresh();