Page 1 of 1
Stacking Charts
Posted: Thu Jun 09, 2005 6:37 pm
by 9341114
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
Posted: Fri Jun 10, 2005 8:21 am
by narcis
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".
Posted: Fri Jun 10, 2005 4:25 pm
by 9341114
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
Posted: Sat Jun 11, 2005 4:31 pm
by 9341114
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
Posted: Mon Jun 13, 2005 8:19 am
by narcis
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.
Posted: Tue Jun 14, 2005 11:03 pm
by 9341114
Thanks - that's perfect!
Paul
Posted: Thu Jul 14, 2005 6:14 pm
by 9341114
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
Posted: Fri Jul 15, 2005 7:23 am
by narcis
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.
Posted: Fri Jul 15, 2005 3:53 pm
by 9341114
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
Posted: Mon Jul 18, 2005 9:02 am
by narcis
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;
Posted: Mon Jul 18, 2005 3:06 pm
by 9341114
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.
Posted: Mon Jul 18, 2005 3:39 pm
by narcis
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;