Here is the "secret" code that will enable the scaling and the scrolling for your composite chart.
using Infragistics.UltraChart.Shared.Events;
using Infragistics.UltraChart.Resources.Appearance;
using Infragistics.UltraChart.Shared.Styles;
...
public Form1()
{
InitializeComponent();
this.ultraChart1.CompositeChart.ChartAreas[0]. Axes[0].ScrollScale.Visible = true;
this.ultraChart1.CompositeChart.ChartAreas[0]. Axes[1].ScrollScale.Visible = true;
}
Enabling the scaling for a composite chart, will render only one scaling/scrolling region, so it will affect only one chart layer. To fix this I have to handle the scrolling and the scaling manually:
private void ultraChart1_Scrolling(object sender, ChartScrollScaleEventArgs e)
{
foreach (ChartLayerAppearance layer in this.ultraChart1.CompositeChart.ChartLayers)
{
if (layer.Visible == true)
{
switch (e.AxisNumber)
{
case AxisNumber.X_Axis:
layer.AxisX.ScrollScale.Scroll = e.NewValue;
break;
case AxisNumber.Y_Axis:
layer.AxisY.ScrollScale.Scroll = e.NewValue;
break;
}
}
}
}
private void ultraChart1_Scaling(object sender, ChartScrollScaleEventArgs e)
{
foreach (ChartLayerAppearance layer in this.ultraChart1.CompositeChart.ChartLayers)
{
if (layer.Visible == true)
{
switch (e.AxisNumber)
{
case AxisNumber.X_Axis:
layer.AxisX.ScrollScale.Scale = e.NewValue;
break;
case AxisNumber.Y_Axis:
layer.AxisY.ScrollScale.Scale = e.NewValue;
break;
}
}
}
}
1 comment:
Thanks a ton dude. It really helped me out from my problem. I have a quick question. Do you know how to share the same X-axis in the code layout for Infragistics Chart. In my Chart i have 4 chart out of which 3 charts share x and y-axis and the last has different y-axis and same x-axis. If you know this please reply me at janiamit123@yahoo.co.in
Post a Comment