TeePreviewPanel // Print Titles

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Chartist
Newbie
Newbie
Posts: 60
Joined: Wed Sep 18, 2013 12:00 am

TeePreviewPanel // Print Titles

Post by Chartist » Thu Jan 23, 2014 11:47 am

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
Cheryll

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: TeePreviewPanel // Print Titles

Post by Yeray » Fri Jan 24, 2014 12:07 pm

Hi Cheryll,

Could you please arrange a simple example project we can run as-is to reproduce the problem here?
Thanks in advance.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Chartist
Newbie
Newbie
Posts: 60
Joined: Wed Sep 18, 2013 12:00 am

Re: TeePreviewPanel // Print Titles

Post by Chartist » Fri Jan 24, 2014 5:08 pm

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;

.......
Cheryll

Chartist
Newbie
Newbie
Posts: 60
Joined: Wed Sep 18, 2013 12:00 am

Re: TeePreviewPanel // Print Titles

Post by Chartist » Fri Jan 24, 2014 5:11 pm

PS:
mitte:=55; // = middle or my preview
Chartbreite:=20; // = width of the single chart
Cheryll

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: TeePreviewPanel // Print Titles

Post by Yeray » Tue Jan 28, 2014 9:45 am

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.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Chartist
Newbie
Newbie
Posts: 60
Joined: Wed Sep 18, 2013 12:00 am

Re: TeePreviewPanel // Print Titles

Post by Chartist » Tue Jan 28, 2014 4:33 pm

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
Cheryll

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: TeePreviewPanel // Print Titles

Post by Yeray » Wed Jan 29, 2014 4:16 pm

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
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Chartist
Newbie
Newbie
Posts: 60
Joined: Wed Sep 18, 2013 12:00 am

Re: TeePreviewPanel // Print Titles

Post by Chartist » Thu Jan 30, 2014 2:53 pm

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
Cheryll

Post Reply