How to import an Exported Chart image into a Crystal Report.

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
APJ
Newbie
Newbie
Posts: 3
Joined: Tue Nov 04, 2003 5:00 am

How to import an Exported Chart image into a Crystal Report.

Post by APJ » Tue Feb 24, 2004 8:07 am

I encountered with a problem when I was putting the exported Chart image files into crystal report.

My method is that:
Step 1 Write BLOB Data by Using ADO.NET in a DataSet
http://support.microsoft.com/default.as ... -us;308042

Step 2 Write the DataSet to XML-Schema

Step 3 Make this Schema to a typed DataSet

Step 4 Develop your Report with the typed DataSet

Step 5 Use a DataSet equal with the typed DataSet, but filled dynamicly at runtime and set the DataSource of to the Report DataSetConverter.SetDataSource(rcDoc, ds)

But I got a error of "System.ArgumentException: Type System.Byte[] can not be marshaled as an unmanaged structure; no meaningful size or offset can be computed". Reported problem to Crystal and they assigned it Track ID ADAPT00162936.
Tried it with managed and unmanaged dataset...same error.

I do not know how to resolve this problem.

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Post by Christopher » Tue Feb 24, 2004 8:39 am

Hi --

As an alternative to exporting a chart as a bitmap image, you might consider using the Steema.TeeChart.Chart.Draw Method (see the TeeChart for .NET Help for details). The two overloads of this method look like this:
Overload List
Paints the Chart on the Drawing Canvas g.

public Void Draw(System.Drawing.Graphics)
Paints the Chart on the Drawing Canvas g and region r.

public Void Draw(System.Drawing.Graphics, System.Drawing.Rectangle)


Remarks

Use the Draw method to paint the Chart in your preferred Drawing Canvas and region.

It can also be used to Print the Chart in a customized way.
Thank you!

Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/

APJ
Newbie
Newbie
Posts: 3
Joined: Tue Nov 04, 2003 5:00 am

Question of using Canvas ....

Post by APJ » Tue Feb 24, 2004 10:09 am

Hi Chris, thanks for the advice.
I have 1 more question regarding the Canvas:

Where should I put the Canvas inside the code ?

Can you please kindly give me some code example ?

Thanks and much appreciate for your help

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Post by Christopher » Tue Feb 24, 2004 10:31 am

Hi -
Can you please kindly give me some code example ?
Here's a very simple code example:

Code: Select all

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace ttee3d {
  public class Form1 : System.Windows.Forms.Form {
    private System.ComponentModel.Container components = null;
    private Steema.TeeChart.Chart Chart1;

    public Form1() {
      InitializeComponent();

      Chart1 = new Steema.TeeChart.Chart(); 
      Chart1.Series.Add(new Steema.TeeChart.Styles.Bar());
      Chart1.Series[0].FillSampleValues();
    }

    protected override void Dispose( bool disposing ) {
      if( disposing ) {
        if (components != null) {
          components.Dispose();
        }
      }
      base.Dispose( disposing );
    }

    #region Windows Form Designer generated code
 
    private void InitializeComponent() {
      this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
      this.ClientSize = new System.Drawing.Size(816, 462);
      this.Name = "Form1";
      this.Text = "Form1";
      this.Paint += new System.Windows.Forms.PaintEventHandler(this.Form1_Paint);
    }
    #endregion

    [STAThread]
    static void Main() {
      Application.Run(new Form1());
    }

    private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e) {
      Chart1.Draw(e.Graphics, new System.Drawing.Rectangle(0, 0, 200, 100));
    }
  }
}
Thank you!

Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/

APJ
Newbie
Newbie
Posts: 3
Joined: Tue Nov 04, 2003 5:00 am

Question of using Canvas in ASP.Net ...

Post by APJ » Wed Feb 25, 2004 3:19 am

Dear Chris,

Thanks very much for your code example,
However, can you please give me some coding example of using the Canvas on ASP.Net coding ?

Highly appreciate.

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Post by Christopher » Wed Feb 25, 2004 7:43 am

Hi --
Thanks very much for your code example,
However, can you please give me some coding example of using the Canvas on ASP.Net coding ?
The principles of the code example I gave you are identical throughout the .NET framework, that is, that you can use the Steema.TeeChart.Chart.Draw Method to draw your chart onto any System.Drawing.Graphics canvas.
Thank you!

Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/

Post Reply