Stacking Charts

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Paul
Newbie
Newbie
Posts: 20
Joined: Tue Mar 01, 2005 5:00 am

Stacking Charts

Post by Paul » Thu Jun 09, 2005 6:37 pm

Is it possible to stack multiple charts (series) each with a different axis? (e.g. the Financial demo shown on the web site). I need to display more than two (up to 10 or more) lines on a single horizontal axis. Not even sure if "stacked" is the correct term. Do I create a custom axis?

Thanks

Paul

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

Post by Narcís » Fri Jun 10, 2005 8:21 am

Hi Paul,

I don't understand exactly what you mean but there are several possibilities:

1. Using custom vertical axes, associating each series vertical axis to the desired one and position each axes wherever you want in the chart. An example of this would be at TeeChart features demo: "All Features\ Welcome!\ Axes\ Scrolling multiple". You can also find a tutorial on how to use custom axes at TeeCharts documentation folder.

2. Stack series as shown at features demo: "All Features\ Welcome!\ Chart Styles\ Standard\ Line (Strip)\ Stack and Overlap".
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

Paul
Newbie
Newbie
Posts: 20
Joined: Tue Mar 01, 2005 5:00 am

Post by Paul » Fri Jun 10, 2005 4:25 pm

It sounds like example #2 might do it ... however, I'm at a loss as where to find the demos you're referring to (I'm new to this forum). Are these paths located on the Steema Website, or in the Teechart installation directory? I've searched both places and have not found anything that looks like "All features\Welcome ..."

Thanks

Paul

Paul
Newbie
Newbie
Posts: 20
Joined: Tue Mar 01, 2005 5:00 am

Post by Paul » Sat Jun 11, 2005 4:31 pm

Ok, disregard my previous post - I found the examples. However, I have a follow up question. If I set a custom vertical axis for the top 33%, the middle 33%, and the bottom 33% of the chart. Is there a way to place a solid horizontal line the border between the three sections? (that would be two lines)

Thanks again

Paul

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

Post by Narcís » Mon Jun 13, 2005 8:19 am

Hi Paul,

Yes, you can use a ColorLine Tool. You will find examples at the TeeChart features demo under All Features\ Welcome!\ Tools\ Color Line.
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

Paul
Newbie
Newbie
Posts: 20
Joined: Tue Mar 01, 2005 5:00 am

Post by Paul » Tue Jun 14, 2005 11:03 pm

Thanks - that's perfect!

Paul

Paul
Newbie
Newbie
Posts: 20
Joined: Tue Mar 01, 2005 5:00 am

Post by Paul » Thu Jul 14, 2005 6:14 pm

The example code "All Features\ Welcome!\ Tools\ Color Line" show that the ColorLineTool components are not created at run time, but rather via the design Editor. I need to be able to create at run time - is there sample code that shows how to do this?

Thanks

Paul

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

Post by Narcís » Fri Jul 15, 2005 7:23 am

Hi Paul,

You can do it using:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var
  MyLine: TColorLineTool;
begin
  Series1.FillSampleValues();

  MyLine:=TColorLineTool.Create(Chart1);

  with MyLine do
  begin
    AllowDrag:=False;
    Pen.Color:=clRed;
    Axis:=Chart1.Axes.Left;
    Style:=clMaximum;
  end;
end;
Also don't forget to include TeeTools unit to the uses section.
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

Paul
Newbie
Newbie
Posts: 20
Joined: Tue Mar 01, 2005 5:00 am

Post by Paul » Fri Jul 15, 2005 3:53 pm

Still not getting the lines to appear, and I believe it's related to the axis. At run time, I'm creating up to 10 custom axis, and it's one of these axis I need to assign the ColorLine to. I can do it in the Editor, but at run time, no lines. Example:

var
LeftAxes : array [1..10] of TChartAxis;
BorderLine : TColorLineTool;
begin

LeftAxes[1] := TChartAxis.Create (Chart.CustomAxes);

BorderLine := TColorLineTool.Create (Chart);
BorderLine.Axis := LeftAxes[1];

end;

Is this correct? If so, it's not working. Or maybe it's something else entirely?

Thanks

Paul

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

Post by Narcís » Mon Jul 18, 2005 9:02 am

Hi Paul,

It is redundant that you create LeftAxes array as TeeChart already has a custom axes array Chart1.CustomAxes.Items. The snippet below shows you the appropiate way to get what you request.

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
Var MyAxis : TChartAxis ;
begin
  Series1.FillSampleValues();
  MyAxis := TChartAxis.Create(  Chart1 );
  Series1.CustomVertAxis := MyAxis;

  ChartTool1.Axis:=Chart1.CustomAxes.Items[0];
end;
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

Paul
Newbie
Newbie
Posts: 20
Joined: Tue Mar 01, 2005 5:00 am

Post by Paul » Mon Jul 18, 2005 3:06 pm

I still cannot get the color line to appear. The line appears via the Chart Editor, but I need to create everything at run time. Below is a sample project. The axis and series display fine, but no color line I'm also having the same problem with the cursor tools. What am I missing?

Thanks

Paul

Code: Select all

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  TeeTools, Series, ExtCtrls, TeeProcs, TeEngine, Chart;

type
  TForm1 = class(TForm)
    Chart1: TChart;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
var
  MyAxis : TChartAxis;
  Series : TFastLineSeries;
  BorderLine : TColorLineTool;
begin
  Series := TFastLineSeries.Create(Self);
  Series.ParentChart := Chart1;
  Series.FillSampleValues;

  MyAxis := TChartAxis.Create (Chart1);
  Series.CustomVertAxis := MyAxis;

  BorderLine := TColorLineTool.Create(Chart1);
  BorderLine.Axis := Chart1.CustomAxes.Items[0];

end;

end.

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

Post by Narcís » Mon Jul 18, 2005 3:39 pm

Hi Paul,

This is because you need to set a style or value for the tool as shown here:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
var
  MyAxis : TChartAxis;
  Series : TFastLineSeries;
  BorderLine : TColorLineTool;
begin
  Series := TFastLineSeries.Create(Self);
  Series.ParentChart := Chart1;
  Series.FillSampleValues;

  MyAxis := TChartAxis.Create (Chart1);
  Series.CustomVertAxis := MyAxis;

  BorderLine:=TColorLineTool.Create(Chart1);
  BorderLine.Axis := Chart1.CustomAxes.Items[0];
  BorderLine.Style:=clMaximum;
  //BorderLine.Value:=500;
  Chart1.MarginLeft:=5;
end;
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

Post Reply