I make one Series1(TFastLineSeries) to the running time.
How i Can question, whethever this exists or not?(True/False)
Checking whetever Series1 exists? (TFastlineseries)
-
- Newbie
- Posts: 7
- Joined: Mon Sep 26, 2005 4:00 am
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Hallo_Thomas,
You can do something like this:
If this doesn't fit your needs could you please let us know what are you exactly trying to do?
You can do something like this:
Code: Select all
if Chart1.SeriesCount>0 then
for i:=0 to Chart1.SeriesCount-1 do
if (Chart1[i] is TFastLineSeries) then
begin
//Your code here
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 |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 7
- Joined: Mon Sep 26, 2005 4:00 am
I always delete the TFastLineSerie again and other series (also:TFastLineseries )draws in Chart1, I always get an error message after the Halt [x]: TFastlineseries are deleted in the Chart1
and
I get an error message if other TFastlineseries are there, but Halt [x] not.
The Code
and
Code: Select all
if Chart1.SeriesCount>0 then
for i:=0 to Chart1.SeriesCount-1 do
if (Chart1[i] is TFastLineSeries) then
begin
//Your code here
end;
Code: Select all
Halt: Array [0..11]of TFastLineseries;
The Code
Code: Select all
procedure TForm2.Chart1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var z,tmp,i, tmpL,x1,y1 : Integer;
begin
for z:=0 to 11 do
begin
//if Form2.Halt[z].Count>0 Then
begin
With Chart1 do
begin
for x1 := Round(Form2.Halt[z].XValues[0]) to Round(Form2.Halt[z].XValues[1]) do // Series5.XValue[1]
for y1 := 0-Form2.Halt[z].LinePen.Width div 2to Form2.Halt[z].LinePen.Width div 2 do
begin
If (Form2.Halt[z].Clicked(X+x1, Y+y1) <> -1) And (OnSeriesPoint = False) Then
begin
Canvas.Brush.Style := bsSolid;
Canvas.Pen.Color := clBlack;
Canvas.Brush.Color := clWhite;
canvas.TextOut(x+10,y,FormatFloat('#.00',Form2.Halt[z].XScreenToValue(x))+','+FormatFloat('#.00',Series1.YScreenToValue(y)));
OnSeriesPoint := True;
end;
If (Form2.Halt[z].Clicked(X+x1, Y+y1) = -1) And (OnSeriesPoint = True) Then
OnSeriesPoint := False;
end;
end;
end;
end;
end;
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Hallo_Thomas,
Sorry but I don't understand which is your exact problem. Could you please send us an example we can run "as-is" to reproduce the problem here? You can post your files at news://www.steema.net/steema.public.attachments newsgroups.
Thanks in advance.
Sorry but I don't understand which is your exact problem. Could you please send us an example we can run "as-is" to reproduce the problem here? You can post your files at news://www.steema.net/steema.public.attachments newsgroups.
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 |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 7
- Joined: Mon Sep 26, 2005 4:00 am
Somehow do not create selves to send what about the Outlook for newsgroup.
Therefore publishes I call example here
P.S Problem is Button2Click with Chart1MouseDown
Therefore publishes I call example here
P.S Problem is Button2Click with Chart1MouseDown
Code: Select all
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, TeEngine, TeeFunci, Series, ExtCtrls, TeeProcs, Chart, StdCtrls,math,
DBChart, Buttons,csPerformance;
type
TForm1 = class(TForm)
Chart1: TChart;
Button1: TButton;
Label1: TLabel;
Button2: TButton;
procedure Button2Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Chart1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Chart1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
Series1,Series2,Series3,Series4,Series5,Series6:TFastLineseries;
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
OnSeriesPoint:Boolean;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
i : Integer;
y : Double;
MyX,MyY: TChartValues;
Anzahl : Array Of Double;
ID : TTimerID;
const l=10;
begin
//inherited;
ID:=0;
csPerformance.StartTimer(ID);
Chart1.UndoZoom;
Chart1.FreeAllSeries;
Series6 := TFastLineSeries.Create(Form1.Chart1);Form1.Chart1.AddSeries(Series6);Series6.BeginUpdate;
Series2 := TFastLineSeries.Create(Form1.Chart1);Form1.Chart1.AddSeries(Series2);Series2.BeginUpdate;
Series1 := TFastLineSeries.Create(Form1.Chart1);Form1.Chart1.AddSeries(Series1);Series1.BeginUpdate;
Series3 := TFastLineSeries.Create(Form1.Chart1);Form1.Chart1.AddSeries(Series3);Series3.BeginUpdate;
Series4 := TFastLineSeries.Create(Form1.Chart1);Form1.Chart1.AddSeries(Series4);Series4.BeginUpdate;
Series5 := TFastLineSeries.Create(Form1.Chart1);Form1.Chart1.AddSeries(Series5);Series5.BeginUpdate;
Series6.DrawAllPoints:=False;
Chart1.Axes.FastCalc:=True;
SetLength(MyX,l); SetLength(MyY,l);
for i:=0 to l-1 do
Begin
MyX[i]:=i;
MyY[i]:= random(5000)/100;
end;
with Series6 do
begin
xValues.Count:=l;
XValues.Value:=MyX;
yValues.Count:=l;
yValues.Value:=Myy;
end;
Series6.LinePen.Width := 3;
Series6.SeriesColor:=clred;
Series3.AddXY(5,0);
Series3.AddXY(5,50);
Series3.SeriesColor:=clblack;
Series3.LinePen.Width := 5;
Series4.SeriesColor:=clblack;
Series4.AddXY(25,0);
Series4.AddXY(25,50);
SetLength(Anzahl,25-5+1);
Series4.LinePen.Width := 5;
for i:=5 to 25 do Anzahl[i-5]:=Series6.YValue[i];
y:= MinValue(Anzahl);
Series5.AddXY(25,y);
Series5.AddXY(5,y);
Series5.SeriesColor:=clnavy;
Series5.LinePen.Width := 20;
Series1.EndUpdate;Series2.EndUpdate; Series3.EndUpdate;Series4.EndUpdate;Series5.EndUpdate;
//Label1.Caption:= (Format ('Hat %6.6f sekunden gedauert',[StopTimer(ID)]));
end;
procedure TForm1.FormShow(Sender: TObject);
begin
randomize;
end;
procedure TForm1.Chart1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var x1,y1,i : Integer;
begin
if Chart1.SeriesCount>0 then
for i:=0 to Chart1.SeriesCount-1 do
if (Chart1[i] is TFastLineSeries) then
With Chart1 do
begin
for x1 := 5 to 25 do
for y1 := 0 to Series5.Count do
begin
If (Series5.Clicked(X+x1, Y+y1) <> -1) And (OnSeriesPoint = False) Then
begin
Canvas.Brush.Style := bsSolid;
Canvas.Pen.Color := clBlack;
Canvas.Brush.Color := clWhite;
canvas.TextOut(x+10,y,FormatFloat('#.00',Series5.XScreenToValue(x))+','+FormatFloat('#.00',Series5.YScreenToValue(y)));
OnSeriesPoint := True;
end;
If (Series6.Clicked(X+x1, Y+y1) = -1) And (OnSeriesPoint = True) Then
OnSeriesPoint := False;
end;
end;
end;
procedure TForm1.Chart1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
Chart1.Repaint;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.View3D := False;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
MyX,MyY: TChartValues;
i : Integer;
const l=10;
begin
Chart1.UndoZoom;
Chart1.FreeAllSeries;
Series6 := TFastLineSeries.Create(Form1.Chart1);Form1.Chart1.AddSeries(Series6);Series6.BeginUpdate;
Series6.DrawAllPoints:=False;
Chart1.Axes.FastCalc:=True;
SetLength(MyX,l); SetLength(MyY,l);
for i:=0 to l-1 do
Begin
MyX[i]:=i;
MyY[i]:= random(5000)/100;
end;
with Series6 do
begin
xValues.Count:=l;
XValues.Value:=MyX;
yValues.Count:=l;
yValues.Value:=Myy;
end;
end;
-
- Newbie
- Posts: 7
- Joined: Mon Sep 26, 2005 4:00 am
I have found a code this one works. Does this go also with a one If query?
Code: Select all
if Form1.Series5 <>nil Then
if Form1.Series5.Count >0 Then
begin
My Code
end;