Page 1 of 1

TeePreviewPanel // Print Titles

Posted: Thu Jan 23, 2014 11:47 am
by 16467044
Hi,

I use TeePreviewPanel and add there multiple charts for printing.
Imagin a bundle of sheets, every has from 4 to 10 small chart windows on itsself.

Everything works fine - except the titles of the charts.

This is what I try (I only write the crucial lines):

I edit my (subchart)
Chart1.Title.Alignment:=.... something.

Then I add the chart by
TeePreviewPanel1.Panels.Add(Chart1);

The formatting of Chart1.Title does something, but not the wanted thing.
e.g. I set it to "taRightJustify".
Something changes, like the titel moves slightly more to the right side.
But this is not "justified".

I watched those title formatting dependent from the count of charts I add side by side.
E.g. if they look acceptable after having added 4 in a row,....
.... then, the ones on the next sheet of 3 in a row experiences a shift and partly-scroll-out-of-sight of the titles.

I found, that there is a "rect" in connection with titles. But I could not find a way with them.

Somebody has some codesnippets for me?
Maybe I have to calculate the position somehow.

Thanks,
Cheryll

Re: TeePreviewPanel // Print Titles

Posted: Fri Jan 24, 2014 12:07 pm
by yeray
Hi Cheryll,

Could you please arrange a simple example project we can run as-is to reproduce the problem here?
Thanks in advance.

Re: TeePreviewPanel // Print Titles

Posted: Fri Jan 24, 2014 5:08 pm
by 16467044
I try to copy from the code lines which I use:



function ChartUmformen

.....

Chart_.Title.Alignment:=taRightJustify;
Chart_.PrintProportional:=false;
.......


=========================



if C2 <> nil then begin // das 2. Chart der obersten Reihe
ChartUmformen(C2, 1); // setzt Titel uam.
C2.PrintMargins:=Rect(Chartbreite,0,Chartbreite*3,mitte);
TeePreviewPanel_Druck.Panels.Add(C2); // Charts werden dem Druck Panel zuweisen
end;

if C3 <> nil then begin
ChartUmformen(C3, 1);
C3.PrintMargins:=Rect(Chartbreite*2,0,Chartbreite*2,mitte);
TeePreviewPanel_Druck.Panels.Add(C3);
end;

if C4 <> nil then begin
ChartUmformen(C4, 1);
C4.PrintMargins:=Rect(Chartbreite*3,0,Chartbreite,mitte);
TeePreviewPanel_Druck.Panels.Add(C4);
end;

.......

Re: TeePreviewPanel // Print Titles

Posted: Fri Jan 24, 2014 5:11 pm
by 16467044
PS:
mitte:=55; // = middle or my preview
Chartbreite:=20; // = width of the single chart

Re: TeePreviewPanel // Print Titles

Posted: Tue Jan 28, 2014 9:45 am
by yeray
Hi Cheryll,

Thanks for the snippets but we'd need to reproduce the problem in a simple project here to fully understand the situation and configuration.
Besides to the simple example project, please tell us what exact TeeChart and IDE versions are you using.
Thanks in advance.

Re: TeePreviewPanel // Print Titles

Posted: Tue Jan 28, 2014 4:33 pm
by 16467044
This really is much work, as my code and units are nested and linked to a DB.
I cannot provide you with my DB and creating something similar, takes at least one day as I am not familiar with it.

Do you think, you have just some code snippets, how to use this rect-property of the header?
Or some code-snippets how to fill in the headers in printpreview with multiple charts?
Or how to put a text-output window on a PrintPreview.

Anything would to it.

Thanks,
Cheryll

Re: TeePreviewPanel // Print Titles

Posted: Wed Jan 29, 2014 4:16 pm
by yeray
Hello Cheryll,
Chartist wrote:This really is much work, as my code and units are nested and linked to a DB.
I cannot provide you with my DB and creating something similar, takes at least one day as I am not familiar with it.
Don't take me wrong but, when we ask customers for a "simple example project we can run as-is to reproduce the problem here", we are not asking customers to take their applications and remove some code so we can run them here. We mean a new simple project, from scratch. The intention of this is to make things easer and clearer for both sides.

In this case, I'm not sure if I have to create an application with 4 charts, 10 charts, one chart with 4 subcharts or one chart with 10 subcharts.
Then, I understand I have to set the titles to taRightJustify, but I'm not sure to understand what's the expected result. You wrote:
Chartist wrote:I watched those title formatting dependent from the count of charts I add side by side.
E.g. if they look acceptable after having added 4 in a row,....
.... then, the ones on the next sheet of 3 in a row experiences a shift and partly-scroll-out-of-sight of the titles.
I don't understand what have you watched.
Do you want to move the title to a side or the contrary depending on the values in the series? How exactly?
Chartist wrote:I found, that there is a "rect" in connection with titles. But I could not find a way with them.
The Titles are members of the TChartTitle class, that inherits from TStringsShape~TTextShape~TTeeCustomShapePosition~TCustomTextShape~TTeeCustomShape~TTeeCustomShapeBrushPen~TPersistent~TObject

A bit more on Titles:
http://wiki.teechart.net/index.php?titl ... ial2#Title
Chartist wrote:Do you think, you have just some code snippets, how to use this rect-property of the header?
Or some code-snippets how to fill in the headers in printpreview with multiple charts?
Or how to put a text-output window on a PrintPreview.
Here you have an example of how to use the ShapeBounds property in the Title:

Code: Select all

uses Series, TeCanvas;

procedure TForm1.FormCreate(Sender: TObject);
begin
  with Chart1.Title do
  begin
    Text.Text:='This is a testing title';
    Transparent:=false;
  end;
end;

procedure TForm1.Chart1AfterDraw(Sender: TObject);
begin
  with Chart1.Canvas do
  begin
    Pen.Color:=clRed;
    Brush.Style:=bsClear;
    Rectangle(Chart1.Title.ShapeBounds);
  end;
end;
I'm not sure if between the info above you'll find the tip you are looking for.
Other examples and references:
http://www.teechart.net/support/viewtop ... 21&p=44964
http://www.teechart.net/support/viewtop ... 22&p=37760

Re: TeePreviewPanel // Print Titles

Posted: Thu Jan 30, 2014 2:53 pm
by 16467044
Hi Yearay,

yes!!!
This works perfectly for me on all my charts independent of their scale.

My code never would have worked.
I failed to use canvas as base and did not set transparency to false.

Thank you so much!
Cheryll