Page 1 of 1

Printing of Polar series

Posted: Wed Mar 23, 2005 7:58 am
by 8121575
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

Posted: Thu Apr 07, 2005 10:44 am
by narcis
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();

Re: Printing of Polar series

Posted: Thu Aug 06, 2009 3:14 pm
by 13052841
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;

Re: Printing of Polar series

Posted: Thu Aug 06, 2009 3:40 pm
by 13052841
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 745 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);
}

Re: Printing of Polar series

Posted: Fri Aug 07, 2009 2:15 pm
by Chris
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();
    }