ChartGrid multiline heading?

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Track1
Newbie
Newbie
Posts: 13
Joined: Mon Sep 21, 2009 12:00 am

ChartGrid multiline heading?

Post by Track1 » Thu Jul 22, 2010 7:18 am

Hi
Is it possible to add multiple lines to a ChartGrid top line. I want to add more information about the series on say 3 lines of data.

If I use #13#10 (or #13) in the title string for the Series.Title it doesn't place multiple lines on the grid, but shows on continuous one line.
I have set the row height to be suitable to accommodate multiple lines.

How can I change the ChartGrid top line for each series and add multiple lines of text for each series added?

Many thanks

Trevor

Track1
Newbie
Newbie
Posts: 13
Joined: Mon Sep 21, 2009 12:00 am

Re: ChartGrid multiline heading?

Post by Track1 » Thu Jul 22, 2010 7:24 am

This is what I would like over 3 lines instead of one
Attachments
22-07-2010 5-22-25 PM.png
22-07-2010 5-22-25 PM.png (3.45 KiB) Viewed 4529 times

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

Re: ChartGrid multiline heading?

Post by Yeray » Mon Jul 26, 2010 10:41 am

Hi Trevor,

I cound reproduce it.
I've seen that a workaround for the TCustomDrawGrid is to use OnDrawCell event as in the example bellow. But this event is defined in TCustomDrawGrid and this class inherits from TCustomGrid, and TChartGrid inherits from TCustomGrid too, so this event isn't defined.
I've added it to the wish list to be enhanced in future releases (TV52015047).

Code: Select all

procedure TForm1.StringGrid1DrawCell(Sender: TObject; Col, Row: Longint; Rect: TRect; State: TGridDrawState); 
var 
   Line1: string; 
   Line2: string; 
   ptr: integer; 
   padding: integer; 
   hGrid: TStringGrid; 
begin 
  hGrid:= (Sender as TStringGrid); 
  ptr := Pos(';', hGrid.Cells[Col, Row]); 
  if ptr > 0 then 
  begin 
     Line1 := Copy(hGrid.Cells[Col, Row], 1, ptr - 1); 
     Line2 := Copy(hGrid.Cells[Col, Row], ptr + 1, Length(hGrid1.Cells[Col,Row]) - ptr); 
  end 
  else Line1 := hGrid.Cells[Col, Row]; 
  hGrid.Canvas.FillRect(Rect); 
  hGrid.Canvas.TextOut(Rect.Left, Rect.Top + 2, Line1); 
  if ptr > 0 then 
     hGrid.Canvas.TextOut(Rect.Left, Rect.Top - hGrid.Canvas.Font.Height + 3, Line2); 
end; 
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

Post Reply