Quinn-Curtis Forums
Quinn-Curtis Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Tools for Microsoft .Net & .Net Compact Framework
 QCChart2D and QCChart2D CF (VB and C#)
 Size of Saved Images
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

FPHealthcare

22 Posts

Posted - 19 Jul 2006 :  22:40:37  Show Profile  Reply with Quote
I have created a chart, not to be displayed but to be saved as an image to be used with a report. Once the chart is initalized, I create a BufferedImage as a jpg format. then I call the Render() method, then I call the SaveImage(filename) method. This works, but I have a problem.

The size of the image saved is directly proportional to the size of the chart on screen (I'm assuming it's pixel for pixel). I have tried to set the size of the form, and the size of the actual ChartView object to a larger size, but I can't set it beyond the resolution of the desktop I'm running it on.

Once the image is saved, I'm using it in portrait A4 report. I need to strech the image to cover the whole page. Streaching the image decreases the quality by a lot.

Is there a way to save the chart as an image, but in a higher res than is being displayed on the screen?

Or is there an alternative you can suggest to save a high res image of the chart?

Thanks

quinncurtis

1164 Posts

Posted - 20 Jul 2006 :  09:28:11  Show Profile  Reply with Quote
You can create a ChartView of any size, and save the image as a bitmap using that. If you don't add the ChartView to a Form, the image does not get displayed on the screen. This is what we do to serve images from a headless (without a display) server to web pages. The technique is describe in Chapter 24 -Using QCChart2D for .Net to Create Web Applications of the QCChart2D Manual. The technique works with .Net Windows application too.


int imagewidth = 2000;
int imageheight = 1600;
ChartView chartVu = new ChartView();
// Set size of view to match the size of target image for
chartVu.Size = new Size(imagewidth, imageheight);
.
.
.
Background graphbackground1 = new Background( pTransform1,
ChartObj.GRAPH_BACKGROUND, Color.White);
chartVu.AddChartObject(graphbackground1);

.
.
.
BufferedImage savegraph = new BufferedImage(chartVu, fileimageformat);
savegraph.Render();
savegraph.SaveImage("YourImageFile.jpg");

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Quinn-Curtis Forums © 2000-07 Quinn-Curtis, Inc. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07