Hello,
If you are associating an image with the start panel axes (before zoom) then I assume that you have already checked that the default coordination between image and x,y chart coordinates is correct. For that to coordinate correctly after zoom I suggest that you set it up in the following way:
This example is somewhat simplified. It starts with a Chart that has a scale of 100 on the Y axis and 100 on the x axis. The principles can be generically applied to any axis scales.
These steps:
- load the image as an image draw in the BeforeDrawAxes event (for the image to appear below the grid). Don't load the image as a Panel or BackWall image. The image should have the same Pixel dimensions as the axes enclosed space to which it renders.
- Confirm the required start axes sizes; the min, max for each Axis. The image will locate to this start size and will have knowledge of this start size throughout any subsequent zooms or scrolls.
ie:
This example runs a simple straight line with 100 values across a chart. It loads a back image whose dimensions are the same as the chart rectangle (the rectangle enclosed by the axes).
Code: Select all
private void Form1_Load(object sender, EventArgs e)
{
for (int i = 0; i < 100; i++)
fastLine1.Add(i, i);
tChart1.Axes.Left.SetMinMax(0, 100);
tChart1.Axes.Bottom.SetMinMax(0, 100);
}
private void tChart1_BeforeDrawAxes(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
Image myBackImage = Image.FromFile(@"D:\myBackImages\imyImage.png");
Rectangle rect = new Rectangle(tChart1.Axes.Bottom.CalcPosValue(0), tChart1.Axes.Left.CalcPosValue(100),
tChart1.Axes.Bottom.CalcPosValue(100) - tChart1.Axes.Bottom.CalcPosValue(0),
tChart1.Axes.Left.CalcPosValue(0) - tChart1.Axes.Left.CalcPosValue(100));
g.Draw(rect, myBackImage, false);
}
Note that the rectangle used to plot the image takes the original start values of the image as related to axes, even if those values are way off the chart after a zoom or scroll.
Regards,
Marc