Dynamic zoom based on another chart zoom event
Posted: Tue Jan 31, 2006 8:58 pm
I have two charts (contain 2D point series):
order chart : x-axis (6:00 - 17:00) and y-axis (stock price)
size chart : x-axis (6:00 - 17:00) and y-axis (trade size)
If the user zooms in using the mouse drag in order chart, I want to zoom the size chart in the same ratio. E.g. after zooming order chart is from 8:00 to 8:30, I want to programmatically zoom size chart to 8:00 to 8:30.
This is my code to do the dynamic zooming:
private void OrderChart_Zoomed(object sender, EventArgs e)
{
Steema.TeeChart.TChart chart = (Steema.TeeChart.TChart)sender;
Rectangle r = new Rectangle(chart.Zoom.x0, chart.Zoom.y0, chart.Zoom.x1-chart.Zoom.x0, chart.Zoom.y1-chart.Zoom.y0);
SizeChart.Zoom.ZoomRect(r);
}
The end result is not what I want. Two problmes:
1. the x-axis is different (order char : 8:00-8:30, size chart : 7:50 - 9:00)
2. how to I keep y-axis value in the same ratio?
What is the best way to handle this?
Thanks,
order chart : x-axis (6:00 - 17:00) and y-axis (stock price)
size chart : x-axis (6:00 - 17:00) and y-axis (trade size)
If the user zooms in using the mouse drag in order chart, I want to zoom the size chart in the same ratio. E.g. after zooming order chart is from 8:00 to 8:30, I want to programmatically zoom size chart to 8:00 to 8:30.
This is my code to do the dynamic zooming:
private void OrderChart_Zoomed(object sender, EventArgs e)
{
Steema.TeeChart.TChart chart = (Steema.TeeChart.TChart)sender;
Rectangle r = new Rectangle(chart.Zoom.x0, chart.Zoom.y0, chart.Zoom.x1-chart.Zoom.x0, chart.Zoom.y1-chart.Zoom.y0);
SizeChart.Zoom.ZoomRect(r);
}
The end result is not what I want. Two problmes:
1. the x-axis is different (order char : 8:00-8:30, size chart : 7:50 - 9:00)
2. how to I keep y-axis value in the same ratio?
What is the best way to handle this?
Thanks,