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#)
 Data labels are far too big when printing
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

hamfree

11 Posts

Posted - 04 Nov 2010 :  11:10:40  Show Profile  Reply with Quote
Hello,

we use the DevExpress printing functionality. Therefore it's necessary, to draw the chart view onto a given Graphics object within a given Rectangle.

This works almost perfectly, but: On the print preview and on the print output, the data labels are far too big!

This is how it looks on the screen:


This is how it looks on the print preview:


Attached is the source code that we use to draw the chart view to that given Graphics object.
Do you have any idea why this could happen and what we could do to fix it?

Thank you!


       public void PrintContent(Graphics graphics, Rectangle rect)
       {
            double componentwidth = this.Chart.ClientSize.Width;
            double componentheight = this.Chart.ClientSize.Height;

            // setup transform matrix to translate and scale drawing
            Matrix oldTransform = graphics.Transform; // save current transform
            Matrix printTransform = graphics.Transform;
            printTransform.Translate((float)rect.X, (float)rect.Y);
            printTransform.Scale(rect.Width / (float)componentwidth, (float)rect.Height / (float)componentheight);
            graphics.Transform = printTransform;

            bool charviewbackgroundmode = this.Chart.GetBackgroundDrawEnable(); // save background enable flag
            this.Chart.SetBackgroundDrawEnable(false); // switch off chart background
            this.Chart.SetViewport(0, 0, componentwidth, componentheight);

            // Make sure all objects rejustified before final rendering
            this.Chart.ResetPreviousChartObjectList();
            this.Chart.RenderingMode = ChartObj.PRINTER_RENDERING;
            this.Chart.Draw(graphics);
            this.Chart.RenderingMode = ChartObj.SCREEN_RENDERING;

            this.Chart.SetBackgroundDrawEnable(charviewbackgroundmode); // restore background enable flag
            graphics.Transform = oldTransform; // restore original transform
            graphics.ResetClip();

            RectangleF rectF = new RectangleF(rect.X, rect.Y, rect.Width, rect.Height);

        }

quinncurtis

1164 Posts

Posted - 04 Nov 2010 :  11:34:01  Show Profile  Reply with Quote
I'm not sure we can be of much help, since we do not have any idea what goes on in DevExpress.

If you print your chart using our print class, ChartPrint, does it print correctly?

Could you use an buffered image instead of trying to print the chart? The File and Printer rendering chapter of the manual has a section on headless rendering of chart images at specific sizes.
Go to Top of Page

hamfree

11 Posts

Posted - 05 Nov 2010 :  04:19:00  Show Profile  Reply with Quote
Hello,

thank you for your answer. I'm sure that your printing approach works. But the example in the manual only shows how to print one chart view. But we need to print several chart views together with captions, company logo, page numbers at once.

What would you suggest as a best practice to achieve this?

Thank you!

Edited by - hamfree on 05 Nov 2010 07:02:34
Go to Top of Page

quinncurtis

1164 Posts

Posted - 05 Nov 2010 :  08:44:52  Show Profile  Reply with Quote
You should try and print your chart using our standard ChartPrint class. This will tell us whether or not the problem is in the printing, or in your use of the labels which are printing larger than expected.

The current version of the ChartPrint class includes a constructor which accepts an array of ChartView objects, and an array of positioning rectangles, which will print all on the same page. That sounds like what you want. It assumes that 100% of your graphical objects were created using our QCChart2D classes and added to a ChartView.


public ChartPrint(ChartView [] components, Rectangle2D [] posrects)
Go to Top of Page

hamfree

11 Posts

Posted - 08 Nov 2010 :  05:36:49  Show Profile  Reply with Quote
I checked the QC printing functionality using the BufferedImage class. The output looks fine.

The problem is, that most of our objects are NOT QCChart objects. The chart view is just one of several views that are stacked on each other and share a common, custom drawn ruler. So it is not an option for us to use your ChartPrint class.

Do you have any other suggestion?

By the way: Our approach with drawing to a graphics object worked perfectly for the past years (we thought)! We just recently noticed that only the data labels are messed up.

Thank you!
Go to Top of Page

quinncurtis

1164 Posts

Posted - 08 Nov 2010 :  08:57:56  Show Profile  Reply with Quote
Are the labels printing large created using our QCChart2D objects, or are they created some other way? If they are QCChart2D objects, how are they created. Show the code.

You could try and save the chart as a buffered image, then load the image into an image control in your display form. Then you could print the form with the image and all of your other objects, independent of our software.
Go to Top of Page

quinncurtis

1164 Posts

Posted - 08 Nov 2010 :  13:44:51  Show Profile  Reply with Quote
By the way, output as a BufferedImage class is not same as output to the ChartPrint class. You should print the chart, as you create it in your application, using our ChartPrint class, and describe if you get the same large data labels.
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