Page 1 of 1

Is this possible - display an icon on chart?

Posted: Fri Nov 21, 2003 12:25 am
by 8122607
Is it possible to display a series of icon (or small bitmaps) on a chart? The icons would be placed either at the data point pointer or at the series mark locations.

If a line series shows 10 data points, each point would show as an icon representing that y value (in my case).

If this can be done, where can I find a sample or example or some tips?

Thanks.

Posted: Sun Nov 23, 2003 11:28 pm
by Marc
Hello,

You can use the TeeChart Draw method to render an image at any location.

eg.

Code: Select all

private void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
    {
      tChart1.Graphics3D.Draw(new Rectangle(20,20,80,80),imageList1.Images[1]);
    }
<br>
The above code renders an image at a fixed location, but the TeeChart Axes and Series CalcXPos and CalcYPos methods return point and value locations on the Chart according to the data. Stepping through Series values in OnAfterDraw and replacing the render location co-ordinates will enable you to place images at data points, etc. See the TeeChart 'Custom Drawing' Tutorial for more detail about using CalXPos/CalcYPos.

Best regards,
Marc Meumann
Steema Support

Posted: Sat Nov 29, 2003 4:37 am
by 8122607
This works very nicely! I have 3 more quick questions:

1. When is the appropriate time to call Refresh() on the chart after drawing images in the AfterDraw() method?

2. I assume AfterDraw() is called only once for a chart, not once for each series in the chart, correct?

3. Is there a property similar to the series.Marks.Clip = true property? I'm finding that images are drawn outside the chart region when I have multiple pages (or axis data that extends beyond the maximum value I set).

Thanks!

Posted: Wed Dec 03, 2003 12:16 pm
by Chris
1. When is the appropriate time to call Refresh() on the chart after drawing images in the AfterDraw() method?
Could I ask you why you would want to call refresh after the AfterDraw() event has fired but before the chart is painted?
2. I assume AfterDraw() is called only once for a chart, not once for each series in the chart, correct?
Correct.
3. Is there a property similar to the series.Marks.Clip = true property? I'm finding that images are drawn outside the chart region when I have multiple pages (or axis data that extends beyond the maximum value I set).
Have a look at the:
Steema.TeeChart.Drawing.Graphics3D.ClipRectangle Method