Lazarus

Programming => Packages and Libraries => LazReport => Topic started by: Apiotr on January 25, 2019, 09:11:02 pm

Title: Proble with chart marks in LazReport
Post by: Apiotr on January 25, 2019, 09:11:02 pm
Probably the bug in LazReport.
I have a project which uses lazreport. I would like to print a chart with line series. I have used a method described in demo attached to lazreport components. If the chart is without marks the preview and print are perfect. But, when I turn on the marks, the vertical scale is wrong. For example, my highest point is -0.06 (fig. 1), but in LazReport print preview on the left (vertical axis) the numbers are from 100 to 800. I think that the problem is with TScaledCanvasDrawer. I have tried the second method using PaintOnCanvas and all is OK, however the resolution of print is bad.
Fig.1 – Chart with marks (Lazarus Form)
Fig.2 – LazReport print preview
Title: Re: Proble with chart marks in LazReport
Post by: wp on January 25, 2019, 09:43:43 pm
Which Lazarus/FPC version are you using? On which widgetset? If you use Laz/trunk please update from svn - there were a few recent changes related to series labels.

Does the bug appear only when you print a chart out of fpreport, or also when you print directly to the printer (like in tachart/demo/print)?

Please post a small demo which shows the issue. Pack source files (*.pas, *.lfm, *.lpr, *.lpi) to a common zip which you can upload here via "Attachments and other options". Don't include compiler-generated files like *.exe or *.ppu - otherwise the upload will become too large.

Title: Re: Problem with chart marks in LazReport
Post by: Apiotr on January 25, 2019, 10:51:14 pm
Lazarus 2.0 RC3. LazReport included in this version.
Title: Re: Proble with chart marks in LazReport
Post by: Apiotr on January 25, 2019, 11:09:50 pm
I have checked a direct printing from tachart/demo/print. The result is similar, but no as big as when I print out of LazReport. I attach two figures with and without marks. This time is a problem with size of font in marks.
Title: Re: Proble with chart marks in LazReport
Post by: wp on January 26, 2019, 12:57:49 am
You are right - there was still a bug in the calculation of the mark margins: some contributions were scaled twice.
It is fixed in trunk now and will be backported to v2.0.

As for the too-small series marks in the print demo: This is because the default font size is zero which is replaced for the screen canvas automatically by the size of the system font; but it does not happen for the drawing backends. You can solve it by selecting a non-zero font size, e.g. 10, for the series Marks.LabelFont.
Title: Re: Proble with chart marks in LazReport
Post by: Apiotr on January 26, 2019, 03:54:04 pm
Thank You very much!! Now the print and print preview are perfect!  I have used a corrected version from trunk.