ramonibk
24-02-2011, 19:57:04
Buenas. primero y antetodo soy nuevo en esto de los Tchart y em programacion en jeneral. je,je,je.
la cuestion es que tengo un PageControl en el cul genero unos ttabsheet en tiempo de ejecucion sobre ellos genero un TChart y el problema surge cuando genero las Series en el TChar. la primera lo hace correctamente pero la sugunda vez lo que hace es eliminar el Series del primer TChart y pintar el primero y el segundo sobre el segundo Tchart.
aqui os pongo el codigo.
Var
Grafica: tchart;
Solapa:ttabsheet;
begin
Solapa:=ttabsheet.Create(self);
with Solapa do
begin
PageControl:=PageControl1;
Caption := 'Nombre ' + IntToStr(i);
end;
Grafica:=tchart.Create(self);
With Grafica do
Begin
Grafica.Parent:=Solapa;
Grafica.Name := Solapa.Name;
Grafica.Left := 128;
Grafica.Top := 0;
Grafica.Width := 481;
Grafica.Height := 333;
Grafica.BackWall.Brush.Color := clWhite;
Grafica.LeftWall.Brush.Color := clWhite;
Grafica.Chart3DPercent := 100;
Grafica.Legend.Alignment := laLeft;
Grafica.Legend.ColorWidth := 10;
Grafica.Legend.TextStyle := ltsPlain;
Grafica.AddSeries(Series1);
Grafica.Series[1].Add(12,'Hola');
End;
Inc(i); // I Variable global iniciada a 0
end;
He intentado
Grafica.AddSeries(Series[I]);
Grafica.Series[I].Add(12,'Hola');
Pero me da error "List Index Out of Bounds(0)"
la cuestion es que tengo un PageControl en el cul genero unos ttabsheet en tiempo de ejecucion sobre ellos genero un TChart y el problema surge cuando genero las Series en el TChar. la primera lo hace correctamente pero la sugunda vez lo que hace es eliminar el Series del primer TChart y pintar el primero y el segundo sobre el segundo Tchart.
aqui os pongo el codigo.
Var
Grafica: tchart;
Solapa:ttabsheet;
begin
Solapa:=ttabsheet.Create(self);
with Solapa do
begin
PageControl:=PageControl1;
Caption := 'Nombre ' + IntToStr(i);
end;
Grafica:=tchart.Create(self);
With Grafica do
Begin
Grafica.Parent:=Solapa;
Grafica.Name := Solapa.Name;
Grafica.Left := 128;
Grafica.Top := 0;
Grafica.Width := 481;
Grafica.Height := 333;
Grafica.BackWall.Brush.Color := clWhite;
Grafica.LeftWall.Brush.Color := clWhite;
Grafica.Chart3DPercent := 100;
Grafica.Legend.Alignment := laLeft;
Grafica.Legend.ColorWidth := 10;
Grafica.Legend.TextStyle := ltsPlain;
Grafica.AddSeries(Series1);
Grafica.Series[1].Add(12,'Hola');
End;
Inc(i); // I Variable global iniciada a 0
end;
He intentado
Grafica.AddSeries(Series[I]);
Grafica.Series[I].Add(12,'Hola');
Pero me da error "List Index Out of Bounds(0)"