Page 1 of 1

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

Posted: Tue Feb 24, 2004 8:07 am
by 8722117
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.

Posted: Tue Feb 24, 2004 8:39 am
by Chris
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.

Question of using Canvas ....

Posted: Tue Feb 24, 2004 10:09 am
by 8722117
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

Posted: Tue Feb 24, 2004 10:31 am
by Chris
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));
    }
  }
}

Question of using Canvas in ASP.Net ...

Posted: Wed Feb 25, 2004 3:19 am
by 8722117
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.

Posted: Wed Feb 25, 2004 7:43 am
by Chris
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.