Componente dentro de un tchart
Publicado por Diego Gutierrez (15 intervenciones) el 25/10/2007 20:10:01
hola, cree una funcioncilla que al darle click sobre un punto en un bdchart, me inserta una label dentro del grafico con el valor del punto donde hice click, de la sifuietne forma:
procedure TfrmTableroNominas.ClickEnSerie(Sender: TChartSeries;ValueIndex: Integer; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
etiqueta: tlabel;
begin
etiqueta:=Tlabel.Create(self);
etiqueta.Parent:=sender.ParentChart;
etiqueta.Color:=$0080ffff;
etiqueta.AutoSize:=true;
etiqueta.caption:=formatfloat(sender.ValueFormat,sender.YValues.Value[Valueindex]);
etiqueta.Top:=Y+5;
etiqueta.Transparent:=false;
etiqueta.Left:=X-Trunc(etiqueta.Width/2);
if (etiqueta.Left+etiqueta.Width)>sender.ParentChart.Width then
etiqueta.Left:=sender.ParentChart.Width-etiqueta.Width-5;
if etiqueta.left<5 then
etiqueta.left:=5;
etiqueta.Visible:=true;
end;
y funciona de maravilla, pero quize hacer otra funcioncilla que borre todos los tlabels que creé dentro del tchar y no se como, le cale con elgracfico.getcomponents blab bla bla, pero no me regresa los componentes que yo cree, o no se si lo estoy usando bien
procedure TfrmTableroNominas.ClickEnSerie(Sender: TChartSeries;ValueIndex: Integer; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
etiqueta: tlabel;
begin
etiqueta:=Tlabel.Create(self);
etiqueta.Parent:=sender.ParentChart;
etiqueta.Color:=$0080ffff;
etiqueta.AutoSize:=true;
etiqueta.caption:=formatfloat(sender.ValueFormat,sender.YValues.Value[Valueindex]);
etiqueta.Top:=Y+5;
etiqueta.Transparent:=false;
etiqueta.Left:=X-Trunc(etiqueta.Width/2);
if (etiqueta.Left+etiqueta.Width)>sender.ParentChart.Width then
etiqueta.Left:=sender.ParentChart.Width-etiqueta.Width-5;
if etiqueta.left<5 then
etiqueta.left:=5;
etiqueta.Visible:=true;
end;
y funciona de maravilla, pero quize hacer otra funcioncilla que borre todos los tlabels que creé dentro del tchar y no se como, le cale con elgracfico.getcomponents blab bla bla, pero no me regresa los componentes que yo cree, o no se si lo estoy usando bien
Valora esta pregunta


0