Printing of Polar series

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
lars
Newbie
Newbie
Posts: 7
Joined: Tue Jul 08, 2003 4:00 am
Location: Sweden

Printing of Polar series

Post by lars » Wed Mar 23, 2005 7:58 am

When printing a rectangular chart (Line or Point series) using the TeeChart.Printer.Print(rect) the outprint is the same regardless of the size of the chart on the screen. It scales to the given rectangle exactly as we want. Fine!
But for a Polar chart the outprint depends on the size on screen. If I maximize the chart on screen the outprint will be cropped so only 60% of the chart will fit into the given rectangle on the paper. And if the chart is very small on screen it will be small in the outprint.

We are using the TeeChart .NET version 1.0.1189.31308 on W2K SP4.

Is this a known bug?
Is the bug fixed in a newer version?
Is there a workaround?

Regards
Lars Jönson

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Apr 07, 2005 10:44 am

Hi Lars,

You'd better do this using PrintDocument as in the snipet below which works fine here using the latest version available from our customer download area.

Code: Select all

			tChart1.Printer.BeginPrint();
			tChart1.Printer.Print(new Rectangle(100,10,300,200));
			System.Drawing.Printing.PrintDocument pDoc = tChart1.Printer.PrintDocument;
			pDoc.Print();
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

LibDundas
Newbie
Newbie
Posts: 55
Joined: Fri Mar 20, 2009 12:00 am

Re: Printing of Polar series

Post by LibDundas » Thu Aug 06, 2009 3:14 pm

I am having the same problem. I initially attempted to get a preview of the chart before printing and it was small and centered on the page (probably just over 1/4 of the page size).

I then tried your suggestion above and it appears to work, but the rectangle is bad for my chart.\

Is there an easy way to calculate the outer pixel parameter of a multi-series chart?
With one chart, I used the following code, but this won't easily work for a chart with many series.

horizMin = tChart.Series[0].MinXValue();
horizMax = tChart.Series[0].MaxXValue();
vertMin = tChart.Series[0].MinYValue();
vertMax = tChart.Series[0].MaxYValue();

int x = tChart.Series[0].CalcXPosValue(horizMin);
int y = tChart.Series[0].CalcYPosValue(vertMax);
int width = tChart.Series[0].CalcXPosValue(horizMax) - x;
int height = tChart.Series[0].CalcYPosValue(vertMin) - y;

LibDundas
Newbie
Newbie
Posts: 55
Joined: Fri Mar 20, 2009 12:00 am

Re: Printing of Polar series

Post by LibDundas » Thu Aug 06, 2009 3:40 pm

I wrote up an algorithm that works for finding the outer param of a chart with multiple series. However, it is costly in that it iterates through every chart and compares the values. A faster (built-in) method would be very welcoming.

This still doesn't solve the printing issue though! I have uploaed a couple of pdfs to show you what it looks like.
document2.zip
PDF of graph
(98.81 KiB) Downloaded 618 times
Another question: Is it possible to print the axis numbers as well? As of now, there is no scale information.

private Rectangle GetChartPixelParams()
{
int x = 9999;
int y = -9999;
int width = -9999;
int height = -9999;

for (int chart = 0; chart < tChartLogData.Series.Count; chart++)
{
double xMin = tChartLogData.Series[chart].MinXValue();
x = Math.Min(x, tChartLogData.Series[chart].CalcXPosValue(xMin));

double xMax = tChartLogData.Series[chart].MaxXValue();
width = Math.Max(width, tChartLogData.Series[chart].CalcXPosValue(xMax) - x);

double yMax = tChartLogData.Series[chart].MaxYValue();
y = Math.Max(y, tChartLogData.Series[chart].CalcYPosValue(yMax));

double yMin = tChartLogData.Series[chart].MinYValue();
height = Math.Max(height, tChartLogData.Series[chart].CalcYPosValue(yMin) - y);
}

return new Rectangle(x, y, width, height);
}

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

Re: Printing of Polar series

Post by Christopher » Fri Aug 07, 2009 2:15 pm

Hello,

Using teechart.net v2009, an evaluation copy of which is available from the download section of http://www.steema.com, the following code works as expected and gives the results attached:

Code: Select all

    private Points points1, points2;
    private Polar polar1, polar2;

    private void InitializeChart()
    {
      tChart1.Aspect.View3D = false;
      //points.pdf
      //tChart1.Series.Add(points1 = new Points()).FillSampleValues();
      //tChart1.Series.Add(points2 = new Points()).FillSampleValues();

      //polar.pdf
      tChart1.Series.Add(polar1 = new Polar()).FillSampleValues();
      tChart1.Series.Add(polar1 = new Polar()).FillSampleValues();
    }

    private void button1_Click(object sender, EventArgs e)
    {
      Rectangle rect = Utils.FromLTRB(10, 10, 500, 1000);
      tChart1.Printer.BeginPrint();
      tChart1.Printer.Print(rect);
      tChart1.Printer.EndPrint();
    }
Attachments
temp.zip
(590.94 KiB) Downloaded 647 times
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