Hi,
I would like to use a personal icon as a point style shape of a series, and similar icon should be able to display in Legend also.
Currently, TeeChart offers some internal Style type like Circle, Triangle and so on.
The tutorial has a chapter "using Custom drawing on the Chart Panel" to draw special shape on Chart, but can It draw similar icon at Legend.
Thanks for any help in advance.
Lewis
Using a personal icon as Point Style of a Series
-
- Newbie
- Posts: 2
- Joined: Mon Apr 03, 2006 12:00 am
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Lewis,
You can easily do it by implementing a custom series where you can set the image you want as pointer as shown in this example:I would like to use a personal icon as a point style shape of a series, and similar icon should be able to display in Legend also.
Currently, TeeChart offers some internal Style type like Circle, Triangle and so on.
Code: Select all
namespace ChartSamples
{
public partial class ChartSamples : Form
{
public ChartSamples()
{
InitializeComponent();
ImagePoint imagePoint = new ImagePoint(tChart1.Chart);
imagePoint.Image = pictureBox1.Image;
imagePoint.FillSampleValues(100);
}
private void tChart1_Click(object sender, EventArgs e)
{
tChart1.ShowEditor();
}
}
public class ImagePoint : Steema.TeeChart.Styles.CustomPoint
{
private Image image;
public ImagePoint(Steema.TeeChart.Chart c) : base(c)
{
}
public Image Image
{
get{return image;}
set{image = value;}
}
public override string Description
{
get
{
return "ImagePoint";
}
}
public override void DrawValue(int index)
{
Rectangle R;
if(image == null) base.DrawValue(index);
else
{
Pointer.HorizSize = image.Width;
Pointer.VertSize = image.Height;
int left = CalcXPos(index) - (Pointer.HorizSize / 2);
int top = CalcYPos(index) - (Pointer.VertSize / 2);
R = Rectangle.FromLTRB(left,
top,
left + Pointer.HorizSize,
top + Pointer.VertSize);
Graphics3D g = Chart.Graphics3D;
g.Draw(R, image, true);
//g.TextOut(R.Left, R.Top, "A");
}
}
}
}
This can also be done as shown in the What's New?\Welcome !\New in Legend\OnDrawSymbol Event example at TeeChart features demo. You'll find the demo at TeeChart's program group.The tutorial has a chapter "using Custom drawing on the Chart Panel" to draw special shape on Chart, but can It draw similar icon at Legend.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |