Page 1 of 1

Series Markers

Posted: Thu Oct 19, 2006 3:43 pm
by 9790735
Hi,

in a printing application I want to print the PointerStyle used for a series with some other information.

Is there an easy way to get an Image or bitmap of a single PointerStyle that I can use in Print?



thanks,

Posted: Mon Oct 23, 2006 1:43 pm
by narcis
Hi matthbri,

Yes, in the next TeeChart for .NET maintenance release you'll be able to do something like this:

Code: Select all

    private void button1_Click(object sender, EventArgs e)
    {
      Bitmap bmp = new Bitmap(10, 10);
      Graphics g = Graphics.FromImage(bmp);
      SeriesPointer pointer = new SeriesPointer(tChart1.Chart, tChart1[0]);
      Graphics3D oldGraphics = tChart1.Graphics3D;
      (tChart1.Graphics3D as Graphics3DGdiPlus).Graphics = g;
      pointer.Draw(tChart1.Graphics3D, false, 0, 0, 10, 10, points1.Color, points1.Pointer.Style);
      bmp.Save("bitmap.bmp");
      tChart1.Graphics3D = oldGraphics;
    }
However, in the meantime, you can create a class doing this:

Code: Select all

  class MyCanvas : Graphics3DGdiPlus
  {
    public MyCanvas(System.Drawing.Graphics e, Steema.TeeChart.Chart chart) : base(chart)
    {
      this.g = e;
    }

  }
and use MyCanvas like this:

Code: Select all

    private void button1_Click(object sender, EventArgs e)
    {
      Bitmap bmp = new Bitmap(10, 10);
      Graphics g = Graphics.FromImage(bmp);
      SeriesPointer pointer = new SeriesPointer(tChart1.Chart, tChart1[0]);

      MyCanvas gg = new MyCanvas(g, tChart1.Chart);
      gg.Brush.Color = tChart1.Graphics3D.Brush.Color;
      gg.Brush.Visible = tChart1.Graphics3D.Brush.Visible;
      pointer.Draw(gg, false, 0, 0, 10, 10, points1.Color, points1.Pointer.Style);
      bmp.Save("bitmap.bmp");
    }