View Issue Details

IDProjectCategoryView StatusLast Update
0027163LazarusTAChartpublic2015-05-09 14:18
ReportermhigginsAssigned Towp 
Status closedResolutionfixed 
PlatformPCOSWindowsOS VersionWin 7
Product Version1.2.6Product Build46529 
Target Version1.2.8Fixed in Version 
Summary0027163: Printing Page with TAchart using TPrinterDrawer and TextOut
DescriptionI want to print a page with a TAChart and additional text. The page prints correctly the first time. However, if I reprint immediately afterwards then the TAChart prints OK but the text is turned and jumbled
Steps To Reproducevar
MyPrinter : TPrinter;
  MyPrinter := Printer;
  myprinter.Orientation:=poportrait; // set orientation
// some stuff to set line spaces, etc
  PWidth:=myPrinter.Pagewidth div 13;
  Linespace := round(1.2 * myprinter.canvas.textheight('Ty'));
// print some text
  textOut(pwidth, LineNo*Linespace,'CSDCorrections '+get_version);
// print a graph
  graph_rect:=rect(OriX+(XSize div 10), MaxY+linespace, MaxX-(XSize div 10), 30*linespace);

  semi_log.draw (TPrinterDrawer.Create(myPrinter), graph_rect);
Additional InformationIf I put the TAChart draw before the textout then I get the same problem on the first try.
TagsNo tags attached.
Fixed in Revision
Attached Files



2014-12-14 00:55


test1.pdf (4,213 bytes)


2014-12-14 11:17

developer   ~0079798

Last edited: 2014-12-14 11:52

View 2 revisions

Could you please prepare a little demo project which shows the errors? I do see the rotated text if I add additional text to the print demo, but I don't see the red background.


2014-12-15 00:50

developer   ~0079809

Last edited: 2014-12-15 00:52

View 2 revisions

When zooming into your pdf I see that the data points have a red fill.

I am not sure if the issue reported is a bug of TAChart or not. It is certainly a consequence of the canvas being a state machine. This means that if some property of the canvas is changed it is kept for all drawing operations until it is changed again. TAChart does a lot of changes with the canvas. The last text which is drawn in your example is the vertical title of the y axis - this rotates the font - and leaves it rotated... The last brush used seems to change the fill color to red for painting the data points. And it remains there after the drawing has finished.

Then you draw the additional text, you only set the font name and size. But font orientation and BrushColor are kept. Therefore your text is rotated and gets the red background.

In principle it is your responsibility to set all canvas parameters such as you need them for your output.

I do agree, however, that having the font rotated is something no one would expect.

Therefore, at the end of the chart's drawing method, I reset now some parameters of the chart drawer (in case of the printer, these are canvas parameters) to reasonable values. This is not harmful to the chart because painting is already finished, and the parameters will be set to what is needed when the chart repaints. But it protects the user from surprises when additional non-chart data are printed afterwards.

I am not sure if my solution fixes all cases, therefore, I'd say that it is still the responsibility of the user to prepare the canvas before painting something onto a canvas.

Fixed in r47195.

I also saw that the data point symbols turn out to be very small in the print-out. This is fixed in r47196 and r48199.

Please test and close if ok.


2014-12-15 03:33

reporter (1,507,604 bytes)


2014-12-15 03:34

reporter   ~0079813

I have added a small test program that reproduces this fault (

There is also another small additional problem. The points print up much too small.


2014-12-15 09:49

developer   ~0079815

Printer orientation is ignored on first print/scrambled up on second print


2014-12-15 10:52

developer   ~0079817

Fixed in r47201. Please test.


2014-12-15 14:55

reporter   ~0079825

Thank you for your help

Issue History

Date Modified Username Field Change
2014-12-14 00:55 mhiggins New Issue
2014-12-14 00:55 mhiggins File Added: test1.pdf
2014-12-14 11:15 wp Assigned To => wp
2014-12-14 11:15 wp Status new => assigned
2014-12-14 11:17 wp Note Added: 0079798
2014-12-14 11:52 wp Note Edited: 0079798 View Revisions
2014-12-15 00:50 wp LazTarget => 1.2.8
2014-12-15 00:50 wp Note Added: 0079809
2014-12-15 00:50 wp Status assigned => resolved
2014-12-15 00:50 wp Resolution open => fixed
2014-12-15 00:50 wp Target Version => 1.2.8
2014-12-15 00:52 wp Note Edited: 0079809 View Revisions
2014-12-15 03:33 mhiggins File Added:
2014-12-15 03:34 mhiggins Note Added: 0079813
2014-12-15 09:49 wp Note Added: 0079815
2014-12-15 09:49 wp Status resolved => assigned
2014-12-15 09:49 wp Resolution fixed => reopened
2014-12-15 10:52 wp Note Added: 0079817
2014-12-15 10:52 wp Status assigned => resolved
2014-12-15 10:52 wp Resolution reopened => fixed
2014-12-15 14:55 mhiggins Note Added: 0079825
2015-05-09 14:18 Bart Broersma Status resolved => closed