TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
-
nitin
- Newbie
- Posts: 51
- Joined: Thu Aug 22, 2002 4:00 am
Post
by nitin » Thu Apr 05, 2007 6:48 am
in design mode i set color of serie as white.
during programm i create dynamically values of serie from DB.
Code: Select all
case FBLDsql1.FieldByNameAsInt64('VALUE') of
0 : Chart1.Series[0].AddXY(FBLDsql1.FieldByNameAsDateTime('DATE'), FBLDsql1.FieldByNameAsInt64('FUEL'), '', clGreen);
1 : Chart1.Series[0].AddXY(FBLDsql1.FieldByNameAsDateTime('DATE'), FBLDsql1.FieldByNameAsInt64('FUEL'), '', clYellow);
end;
i wanted to have lineseries with two colors, some pixels in one color some in other.
How to do it corect because now i have serie in one color - white
please help me ASAP
thanks in advance
-
Yeray
- Site Admin
- Posts: 9612
- Joined: Tue Dec 05, 2006 12:00 am
- Location: Girona, Catalonia
-
Contact:
Post
by Yeray » Thu Apr 05, 2007 11:18 am
Hello guzial,
Ensure that you have set the following properties to true:
Code: Select all
YourLineSeries.ColorEachLine:=true;
YourLineSeries.ColorEachPoint:=true;
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 news://
www.steema.net/steema.public.attachments newsgroup or at our
upload page
-
nitin
- Newbie
- Posts: 51
- Joined: Thu Aug 22, 2002 4:00 am
Post
by nitin » Thu Apr 05, 2007 11:34 am
i don't have such a property like
ColorEachLine
i use teeChart 7.08
-
Narcís
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
-
Contact:
Post
by Narcís » Thu Apr 05, 2007 11:44 am
Hi guzial,
Have you tried ColorEachPoint property instead? If this doesn't help please let us know which series style are you using.
Thanks in advance.
-
nitin
- Newbie
- Posts: 51
- Joined: Thu Aug 22, 2002 4:00 am
Post
by nitin » Thu Apr 05, 2007 11:48 am
yes i tried and it doesnt work
i use fastLineSeries
-
Narcís
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
-
Contact:
Post
by Narcís » Thu Apr 05, 2007 1:46 pm
Hi guzial,
Are you setting this before populating your series? If the problem persists please send us a simple example project we can run "as-is" to reproduce the problem here.
Thanks in advance.
-
nitin
- Newbie
- Posts: 51
- Joined: Thu Aug 22, 2002 4:00 am
Post
by nitin » Fri Apr 06, 2007 8:34 am
i send to newsgroup and im waiting impatiently for solution
-
Yeray
- Site Admin
- Posts: 9612
- Joined: Tue Dec 05, 2006 12:00 am
- Location: Girona, Catalonia
-
Contact:
Post
by Yeray » Tue Apr 10, 2007 8:08 am
Hi guzial,
We're sorry but you should use TLineSeries to achieve ColorEachPoint to work properly.
-
nitin
- Newbie
- Posts: 51
- Joined: Thu Aug 22, 2002 4:00 am
Post
by nitin » Tue Apr 10, 2007 8:16 am
i cann't use lineseries due to a large amount of points
-
Yeray
- Site Admin
- Posts: 9612
- Joined: Tue Dec 05, 2006 12:00 am
- Location: Girona, Catalonia
-
Contact:
Post
by Yeray » Tue Apr 10, 2007 9:08 am
Hi guzial,
you can take a look at this
article to optimize your LineSeries.
-
nitin
- Newbie
- Posts: 51
- Joined: Thu Aug 22, 2002 4:00 am
Post
by nitin » Tue Apr 10, 2007 9:16 am
i cann't use tlineseries because i make at runtime chart with few lines with points between 500000 - 1000000 and more each line
-
Yeray
- Site Admin
- Posts: 9612
- Joined: Tue Dec 05, 2006 12:00 am
- Location: Girona, Catalonia
-
Contact:
Post
by Yeray » Tue Apr 10, 2007 10:23 am
Hi guzial,
Following the steps in the article above I've made an example with 6 series and 1000000 points in each one and it takes about 8 seconds to draw the chart in my machine. The code I use is:
Code: Select all
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, TeEngine, Series, ExtCtrls, TeeProcs, Chart, StdCtrls;
type
TForm1 = class(TForm)
Chart1: TChart;
Series1: TLineSeries;
Series2: TLineSeries;
Series3: TLineSeries;
Series4: TLineSeries;
Series5: TLineSeries;
Series6: TLineSeries;
Button1: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure AddValues(i: Integer);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var MaxPoints, ScrollPoints : Double;
begin
// Prepare chart for maximum speed:
with Chart1 do
begin
ClipPoints := False;
Title.Visible := False;
Legend.Visible := False;
LeftAxis.Axis.Width:=1;
BottomAxis.Axis.Width:=1;
BottomAxis.RoundFirstLabel := False;
View3D := False;
end;
// Number of points we'll be displaying
MaxPoints:=10000;
// Number of points deleted when scrolling chart
ScrollPoints := 5000;
// Prepare series.
// Disable AutoRepaint and X Order
Chart1.AutoRepaint := False;
// Set Ordering to none, to increment speed when adding points
Series1.XValues.Order := loNone;
Series2.XValues.Order := loNone;
Series3.XValues.Order := loNone;
Series4.XValues.Order := loNone;
Series5.XValues.Order := loNone;
Series6.XValues.Order := loNone;
// Initialize axis scales
// we're assuming left axis values are within [0,1000]
// Chart1.LeftAxis.SetMinMax(0,10000);
// Chart1.BottomAxis.SetMinMax(1,MaxPoints);
// Speed tips:
// When using only a single thread, disable locking:
Chart1.Canvas.ReferenceCanvas.Pen.OwnerCriticalSection := nil;
Series1.LinePen.OwnerCriticalSection := nil;
Series2.LinePen.OwnerCriticalSection := nil;
Series3.LinePen.OwnerCriticalSection := nil;
Series4.LinePen.OwnerCriticalSection := nil;
Series5.LinePen.OwnerCriticalSection := nil;
Series6.LinePen.OwnerCriticalSection := nil;
end;
procedure TForm1.AddValues(i : Integer);
Var X,Y : Array of Double; // TChartValues
t : Integer;
Num : Integer;
begin
{ 1M points }
Num:= 1000000;
{ allocate our custom arrays }
SetLength(X,Num);
SetLength(Y,Num);
{ fill data in our custom arrays }
X[0]:=0;
Y[0]:=Random(10000);
for t:=1 to Num-1 do
begin
X[t]:=t;
Y[t]:=Y[t-1]+Random(101)-50;
end;
{ set our X array }
With Chart1[i].XValues do
begin
Value:=TChartValues(X); { <-- the array }
Count:=Num; { <-- number of points }
Modified:=True; { <-- recalculate min and max }
end;
{ set our Y array }
With Chart1[i].YValues do
begin
Value:=TChartValues(Y);
Count:=Num;
Modified:=True;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
Var i : Integer;
begin
for i := 0 to 5 do
AddValues(i);
{ Show data }
Chart1.AutoRepaint := True;
Series1.Repaint;
end;
end.
-
nitin
- Newbie
- Posts: 51
- Joined: Thu Aug 22, 2002 4:00 am
Post
by nitin » Tue Apr 10, 2007 11:47 am
ok, but you prepare your data in memory and everything depend on your computer; in my situation i have to preapre data from database so it takes few seconds than i use method addxy and before each point is divided and than multiply by some value and everthing makes that it takes so long time