Using a personal icon as Point Style of a Series

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
marketsnapshot
Newbie
Newbie
Posts: 2
Joined: Mon Apr 03, 2006 12:00 am

Using a personal icon as Point Style of a Series

Post by marketsnapshot » Wed May 24, 2006 11:23 pm

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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu May 25, 2006 8:53 am

Hi Lewis,
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.
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:

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");
            }
        }
    }


}
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.
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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply