Is this possible - display an icon on chart?

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
MTB
Newbie
Newbie
Posts: 30
Joined: Tue Mar 11, 2003 5:00 am
Location: USA
Contact:

Is this possible - display an icon on chart?

Post by MTB » Fri Nov 21, 2003 12:25 am

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.

Marc
Site Admin
Site Admin
Posts: 1274
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Post by Marc » Sun Nov 23, 2003 11:28 pm

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

MTB
Newbie
Newbie
Posts: 30
Joined: Tue Mar 11, 2003 5:00 am
Location: USA
Contact:

Post by MTB » Sat Nov 29, 2003 4:37 am

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!

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Post by Christopher » Wed Dec 03, 2003 12:16 pm

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
Thank you!

Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/

Post Reply