TeeLineSeparator not working with axis labels

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Corey Panno
Newbie
Newbie
Posts: 8
Joined: Fri Sep 02, 2005 4:00 am

TeeLineSeparator not working with axis labels

Post by Corey Panno » Fri Feb 02, 2007 8:42 pm

We are using TeeChart pro 7.04 and are trying to pain a few series/axis lables in multiple lines. To Achieve this we tried using TeeLineSeparator as demonstrated in demo also but it does not works. We also trying to insert Character 13 (#13) at the point where we want to break the labels but that also does not works. Instead of wrapping the text on that character even #13 character is painted as a rectangle.

Please suggest if we need to do something else or set some property in the chart before this could be achieved?

Regards

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

Post by Yeray » Mon Feb 05, 2007 10:11 am

Hello Corey Panno,

We tryed the following simple example code and it works fine for us. We only added a Chart in a new form and added a Bar series in design time. The other modifications we made were those following, in runtime:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
  Series1.Add(123,'Here is'+TeeLineSeparator+'Value'+TeeLineSeparator+'123');
  Series1.Add(321,'Here is'+TeeLineSeparator+'Value'+TeeLineSeparator+'321');
  Series1.Add(234,'Here is'+TeeLineSeparator+'Value'+TeeLineSeparator+'234');
  Series1.Add(432,'Here is'+TeeLineSeparator+'Value'+TeeLineSeparator+'432');
  Series1.Add(345,'Here is'+TeeLineSeparator+'Value'+TeeLineSeparator+'345');
  Series1.Add(543,'Here is'+TeeLineSeparator+'Value'+TeeLineSeparator+'543');

  Chart1.MarginBottom := 10;
end;
Note that we changed the bottom margin to show the label properly; if doesn't, you'll see the bottom axis labels cutted.

Please, could you check if that code works for you?

If this doesn't help, could you please send us a simple example project we can run "as-is" to reproduce the problem here?
You can post your files at [url]news://www.steema.net/steema.public.attachments[/url] newsgroup or at our upload page
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

Corey Panno
Newbie
Newbie
Posts: 8
Joined: Fri Sep 02, 2005 4:00 am

problem is not with labels but with titles

Post by Corey Panno » Wed Feb 28, 2007 10:01 am

thanks for you kind reply and code but the problem I am facing with using line separator is not with the labels but with the series titles. If you show the series titles near its bottom axis and if the title is a big string then it gets truncated. For this I was trying to wrap it in multiple lines and I tried using TeeLineSeparator as well as #13 but on the chart it is still being plotted in single line with rectangles at the place where line separator should have come.

any clue?

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Feb 28, 2007 10:49 am

Hi Corey,

Could you please let us know where are you displaying the series titles that are clipped?

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Corey Panno
Newbie
Newbie
Posts: 8
Joined: Fri Sep 02, 2005 4:00 am

displaying series titles on Depth Axis labels

Post by Corey Panno » Thu Mar 01, 2007 12:07 pm

Thanks for your reply Narcis. We are trying to show series name on Depth Axis labels. The series are bars types and stack type is none.

Please help if possible.

Thanking in advance in anticipation.

Warm regards

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

Post by Yeray » Fri Mar 02, 2007 10:16 am

In the following project I added in design time:
-bar series
-edit box and updown button relationed and inicialized to 12. This is only to see and change the right margin. You can consider it optional.

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
  //Adding some data to the bar series
  Series1.Add(123,'');
  Series1.Add(321,'');
  Series1.Add(234,'');
  Series1.Add(432,'');
  Series1.Add(345,'');
  Series1.Add(543,'');

  //Setting series to multibar as you suggested
  Series1.MultiBar := mbNone;

  Chart1.MarginRight := 12;

  Chart1.Legend.Visible := False;
end;

//This changes the right margin. So you should add a UpDown Command and a edit box
//(and associate them properly) to use this function
procedure TForm1.UpDown1Click(Sender: TObject; Button: TUDBtnType);
begin
  Chart1.MarginRight := UpDown1.Position;
end;

//This is to Show/Hide Depth Axis visiblility. Its necessary to be active to show Depth
//axis titles and GetAxisLabels event.
procedure TForm1.DepthVisibilityClick(Sender: TObject);
begin
  if DepthVisibility.Checked then
  begin
    Chart1.Axes.Depth.Visible := true;
  end
  else
  begin
    Chart1.Axes.Depth.Visible := false;
  end;
end;

//This checkbox shows/hides depth axis title. I supose its the problem you need to solve.
//I added this checkbow to show the problem. Note that to see it, you should enable
//DepthVisibility checkbox previously.
procedure TForm1.DepthTitleClick(Sender: TObject);
begin
  if DepthTitle.Checked then
  begin
    Chart1.Axes.Depth.Title.Visible := true;
    //Chart1.Axes.Depth.Title.Caption := 'my series1 '#13' depth right very'#13'very large title';
    Chart1.Axes.Depth.Title.Caption := 'my series1 '+TeeLineSeparator+' depth right very'+TeeLineSeparator+'very large title';
  end
  else
  begin
    Chart1.Axes.Depth.Title.Visible := false;
  end;
end;

//This is for show/hide the custom labels example. Note that when you get active the custom labels,
//the GetAxisLabels event becomes inactive
procedure TForm1.CustomLabelsClick(Sender: TObject);
begin
  if CustomLabels.Checked then
  begin
    //Chart1.Axes.Depth.Items.Add(0,'my series1'#13'depth right very'#13'very large title').Transparent:=False;
    Chart1.Axes.Depth.Items.Add(0,'my series1'+TeeLineSeparator+'depth right very'+TeeLineSeparator+'very large title').Transparent:=False;
  end
  else
  begin
    Chart1.Axes.Depth.Items.Clear;
  end;
end;

//This is the previously mentioned GetAxisLabels event.
procedure TForm1.Chart1GetAxisLabel(Sender: TChartAxis;
  Series: TChartSeries; ValueIndex: Integer; var LabelText: String);
begin
     if Sender = Chart1.Axes[4] then
     begin
          //LabelText:= 'my series1'#13'depth right very'#13'very large title';
          LabelText:= 'my series1'+TeeLineSeparator+'depth right very'+TeeLineSeparator+'very large title';
     end;
end;

//This shows/hides an annotation tool
procedure TForm1.AnnotationToolClick(Sender: TObject);
begin
  if AnnotationTool.Checked then
  begin
    ChartTool1 := TAnnotationTool.Create(Self);
    ChartTool1.ParentChart := Chart1;
    ChartTool1.Position := ppRightBottom;

    //ChartTool1.Text := 'my series1'#13'depth right very'#13'very large title';
    ChartTool1.Text := 'my series1'+TeeLineSeparator+'depth right very'+TeeLineSeparator+'very large title';

    ChartTool1.Visible := true;
  end
  else
  begin
    ChartTool1.Visible := false;
  end;
end;
I hope it helps you to choose the better way to do what you want.
If it confuses you, take a look at the demos:
All features -> Tools -> Annotation
All features -> Axes -> Labels -> Custom Labels
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