Page 1 of 1
Graphical Interaction with Graphs
Posted: Mon Jun 26, 2006 12:36 pm
by 5886636
Hi!
Is there a function available within your charts to have like two line dividers that can be moved accross the graph on the horizontal axis. The graph then must report on the starting value as well as the ending value. I'd like to develop a graphical delete function. All data between these two dividers will then be deleted in the original dataset.
Regards
Jaco Pretorius
Posted: Mon Jun 26, 2006 12:57 pm
by narcis
Hi Jaco,
Yes, TColorBandTool exactly does what you request. For examples on how to use it you can have a look at the features demo at TeeChart's program group.
Posted: Tue Jun 27, 2006 8:31 am
by 5886636
Hi again
I had no demo as you suggested, but I came accross the TColorLine tool which has an extra function than the TColorBand tool and that is to be able to move the lines.
I am using a Chart that displays data over a time period. It should be possible to delete data between two date time values. The TColorLine tool gives you a double value as you move the line, but how on earth do I convert this double value to the exact date time on which the line is.
Have any suggestions/help?
Regards
Jaco
Posted: Tue Jun 27, 2006 9:31 am
by narcis
Hi Jaco,
TColorBandTool also supports line dragging. You can do something like this using a TColorBandTool:
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.View3D:=false;
Series1.XValues.DateTime:=true;
Series1.FillSampleValues(50);
With ChartTool1 do
begin
Axis:=Chart1.Axes.Bottom;
ResizeEnd:=true;
ResizeStart:=true;
StartValue:=Series1.XValue[5];
EndValue:=Series1.XValue[15];
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var i1, i2: integer;
begin
i1:=Series1.XValues.Locate(Round(ChartTool1.StartValue));
i2:=Series1.XValues.Locate(Round(ChartTool1.EndValue));
if CheckBox1.Checked then
begin
Series1.Delete(i1,i2-i1, true);
ChartTool1.StartValue:=Series1.XValue[i1];
ChartTool1.EndValue:=Series1.XValue[i2];
end
else
Series1.Delete(i1,i2-i1);
end;
Posted: Tue Jun 27, 2006 9:36 am
by 5886636
Thanks!
Will try it soon.
Regards
Jaco
Posted: Tue Jun 27, 2006 2:50 pm
by 5886636
Hi Again
How can I actually get the date/time value on which this ColorLine is? I have decided to use the Color Lines and not the Color Bands. My graph is not connected to a dataset, but I have to delete data in a dataset according to this selecteion of the lines.
Regards
Jaco - Thanks for the help so far. It is good.
Posted: Tue Jun 27, 2006 2:59 pm
by narcis
Hi Jaco,
Have you tried using the Locate method and Series.XValue[index] as in the code snippet I posted before?
Posted: Wed Jun 28, 2006 6:37 am
by 5886636
Hi
Yes I did. It returns a double that I convert to a TDateTime value. That value is wrong.
Regards
Jaco
Posted: Wed Jun 28, 2006 9:09 am
by narcis
Hi Jaco,
It works fine for me here doing something like this:
Code: Select all
uses Math;
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.View3D:=false;
Series1.XValues.DateTime:=true;
Series1.FillSampleValues(50);
SetRoundMode(rmUP);
end;
procedure TForm1.ChartTool1DragLine(Sender: TColorLineTool);
var
i1,i2: Integer;
y,m,d: Word;
begin
i1:=Series1.XValues.Locate(Trunc(ChartTool1.Value));
i2:=Series1.XValues.Locate(Round(ChartTool1.Value));
DecodeDate(Series1.XValue[i1],y,m,d);
Memo1.Lines.Add(IntToStr(d)+'/'+IntToStr(m)+'/'+IntToStr(y));
DecodeDate(Series1.XValue[i2],y,m,d);
Memo1.Lines.Add(IntToStr(d)+'/'+IntToStr(m)+'/'+IntToStr(y));
end;
Could you please check if this works at your end and if the problem persists 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 newsgroup.
Posted: Tue Jul 04, 2006 7:54 pm
by 5891343
narcis wrote:Hi Jaco,
TColorBandTool also supports line dragging. You can do something like this using a TColorBandTool:
I thought tOlorBandTool are lacking an important event for that, an event that tell the program that a line has been dragged?
Maybe somethng for next version?
Would also be interesting if the area also could be moved around, I have a use here where the area should change dependent on data it covers.
Posted: Wed Jul 05, 2006 7:30 am
by narcis
Hi achristouio,
I thought tOlorBandTool are lacking an important event for that, an event that tell the program that a line has been dragged?
Maybe somethng for next version?
Yes, I added your request to our wish-list to be considered for inclusion in future releases.
Would also be interesting if the area also could be moved around, I have a use here where the area should change dependent on data it covers.
Could you please give us more specific information on that request?