Page 1 of 1
Is it possible to define an own pointer style for point seri
Posted: Fri Jun 30, 2006 10:50 pm
by 9637279
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
Posted: Mon Jul 03, 2006 7:40 am
by narcis
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);
}
}
}
}
Works great!
Posted: Wed Jul 05, 2006 4:29 pm
by 9637279
Hi,
many thanks for this hint. It works great!
fano