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
Is it possible to define an own pointer style for point seri
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
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.
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 |
Instructions - How to post in this forum |
Works great!
Hi,
many thanks for this hint. It works great!
fano
many thanks for this hint. It works great!
fano