Is it possible to define an own pointer style for point seri

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
fano
Newbie
Newbie
Posts: 56
Joined: Wed Jun 22, 2005 4:00 am
Location: USA, California

Is it possible to define an own pointer style for point seri

Post by fano » Fri Jun 30, 2006 10:50 pm

Hi,

Is it possible to define an own pointer style for point series?

Currently some default enums are there with nice things in it.
I just wondered if I could make an own one which would be
useful for some applications. I was thinking of a pointer style
that represents a little test-tube or such.

Thanks,
fano

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

Post by Narcís » Mon Jul 03, 2006 7:40 am

Hi fano,

Yes, you can create a custom series style derived from standard point series type. The code below is an example of that using an image as the series pointer.

Code: Select all

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Steema.TeeChart;
using Steema.TeeChart.Drawing;
using Steema.TeeChart.Editors;


namespace ChartSamples
{
  public partial class Form1 : Form
  {
    public Form1()
    {
      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.Points
  {
    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);
      }
    }
  }


}
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

fano
Newbie
Newbie
Posts: 56
Joined: Wed Jun 22, 2005 4:00 am
Location: USA, California

Works great!

Post by fano » Wed Jul 05, 2006 4:29 pm

Hi,

many thanks for this hint. It works great!

fano

Post Reply