Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Gráficos
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 08-01-2007
maravert maravert is offline
Miembro
 
Registrado: jul 2004
Ubicación: Xalapa, México
Posts: 158
Poder: 20
maravert Va por buen camino
Liberar Grafico

Que tal, trabajo con Delphi 7 y el Tchart, me grafica perfectamente, solo que al realizar una consulta de un segundo cliente en relacion a sus ventas por mes, me suma con las del anterior y asi sucesivamente, es decir no me libera el grafico para ver solo la del siguiente cliente.

Se supone que con la instrucciòn

Código Delphi [-]
Series1.Clear;

Se liberaria, pero no pasa nada.

Aquì esta mi codigo, espero añguin me diga que estoy haciendo mal.

Código Delphi [-]
unit Unit73;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, DB, DBTables, Buttons, ExtCtrls, TeeProcs, TeEngine,
  Chart, Series, ComCtrls;
type
  TForm73 = class(TForm)
    Chart1: TChart;
    Edit1: TEdit;
    Button1: TButton;
    BitBtn1: TBitBtn;
    Table1: TTable;
    Table2: TTable;
    Label1: TLabel;
    Label3: TLabel;
    Series1: TBarSeries;
    DateTimePicker1: TDateTimePicker;
    DateTimePicker2: TDateTimePicker;
    Label2: TLabel;
    Label4: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure BitBtn1Click(Sender: TObject);
    procedure Edit1KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
 private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  Form73: TForm73;
    aMeses:array[1..12] of
string=('Ene' ,'Feb','Mar','Abr','May','Jun','Jul','Ago','Sep','Oct',
'Nov','Dic');
ventas: Array[1..12] of real;
  Serie1:TLineSeries;
    Serie2:TFastLineSeries;
    Serie3:TBarSeries;
    Serie4:TAreaSeries;
    Serie5:TPieSeries;
    Fecha1, Fecha2 : Tdate;
x:byte;
implementation
uses Unit80, Unit74, Unit78;
{$R *.dfm}
procedure TForm73.Button1Click(Sender: TObject);
var
  FechaS, Mes : string;
  X : INTEGER;
  ventasT : Real;
begin
fecha1 := Datetimepicker1.DateTime;
fecha2 := Datetimepicker2.DateTime;
tABLE2.OPEN;
Table2.first;
While Not Table2.eof do
      begin
         If table2.fieldbyname ('Clave').asstring = edit1.text then
              Label3.caption := tABLE2.Fieldbyname  ('Nombre').asstring;
       Table2.next;
      end;
 Table2.close;

          Table1.open;
          Table1.first;
          ventasT:= 0;
          While Not Table1.eof do
                Begin
                   if Trim (Table1.fieldbyname ('iD_cLIENTE').Asstring) = Trim (edit1.text) then
                    Begin
                       if Table1.fieldbyname ('Fecha').AsDateTime >= Fecha1 then
                       Begin
                           if Table1.fieldbyname ('Fecha').asdateTime <= Fecha2 then
                                Begin
                                   FechaS := DateTostr (Table1.fieldbyname ('Fecha').asdateTime);
                                   Mes := Copy (FechaS,4,2);
                                 ventasT := ventasT +  Table1.fieldbyname ('Subtotal').asfloat;
                                If mes = '01' Then  ventas [1] := ventas [1]  + Table1.fieldbyname ('Subtotal').asfloat;
                                If mes = '02' Then  ventas [2] := ventas [2]  + Table1.fieldbyname ('Subtotal').asfloat;
                                If mes = '03' Then  ventas [3] := ventas [3]  + Table1.fieldbyname ('Subtotal').asfloat;
                                If mes = '04' Then  ventas [4] := ventas [4]  + Table1.fieldbyname ('Subtotal').asfloat;
                                If mes = '05' Then  ventas [5] := ventas [5]  + Table1.fieldbyname ('Subtotal').asfloat;
                                If mes = '06' Then  ventas [6] := ventas [6]  + Table1.fieldbyname ('Subtotal').asfloat;
                                If mes = '07' Then  ventas [7] := ventas [7]  + Table1.fieldbyname ('Subtotal').asfloat;
                                If mes = '08' Then  ventas [8] := ventas [8]  + Table1.fieldbyname ('Subtotal').asfloat;
                                If mes = '09' Then  ventas [9] := ventas [9]  + Table1.fieldbyname ('Subtotal').asfloat;
                                If mes = '10' Then  ventas [10] := ventas [10]  + Table1.fieldbyname ('Subtotal').asfloat;
                                If mes = '11' Then  ventas [11] := ventas [11]  + Table1.fieldbyname ('Subtotal').asfloat;
                                If mes = '12' Then  ventas [12] := ventas [12]  + Table1.fieldbyname ('Subtotal').asfloat;
                    end;
                end;
             end;
          Table1.next;
          end;
 Chart1.SeriesList.Clear;
  Series1.clear;
  Serie3:=TBarSeries.Create(Self);
            With Serie3 do
        Begin
          ParentChart:=Chart1;
            for x:=1  to 12 do
            Add(Ventas[x],aMeses[x]);
         end;
        Label6.Caption := FormatFloat('###,###,###,##0.00',ventasT);
end;
procedure TForm73.BitBtn1Click(Sender: TObject);
begin
fORM73.cLOSE;
end;
 
procedure TForm73.Edit1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
 case Key of
    VK_F2: begin
           Form78.show;
          end;
    END;
end;
end.
Responder Con Cita
  #2  
Antiguo 08-01-2007
Avatar de Casimiro Notevi
Casimiro Notevi Casimiro Notevi is offline
Moderador
 
Registrado: sep 2004
Ubicación: En algún lugar.
Posts: 32.043
Poder: 10
Casimiro Notevi Tiene un aura espectacularCasimiro Notevi Tiene un aura espectacular
Así a simple vista, me parece que no "limpias" el array "ventas"
Responder Con Cita
  #3  
Antiguo 08-01-2007
maravert maravert is offline
Miembro
 
Registrado: jul 2004
Ubicación: Xalapa, México
Posts: 158
Poder: 20
maravert Va por buen camino
Talking

Gracias, eso era, en verdad estaba miope.

te lo agradesco mucho
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Grafico de Gantt ClaudiaCosta Gráficos 14 11-08-2006 12:43:57
Grafico en mdiForm Io Gráficos 1 18-07-2006 23:16:40
TChart grafico mosorio Varios 3 26-08-2005 01:50:27
Cuadricular un Grafico Jessica666 Gráficos 1 14-05-2004 20:13:12
Gráfico en TDBGrid mutant09 Varios 1 23-04-2004 17:06:21


La franja horaria es GMT +2. Ahora son las 10:43:08.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi