Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Delphi XE5 and TeeChart X WebBroker result blank graphic.



Permlink Replies: 0
Caio Oliveira

Posts: 1
Registered: 1/24/01
Delphi XE5 and TeeChart X WebBroker result blank graphic.
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 26, 2014 1:20 PM
Someone have problem with TeeChart and *WebBroker in Delphi XE5*? The code work fine in Delphi 7; after convert to XE5 (units names, etc) dont show erros but the graphic always back blank.

The source code is:
procedure TWebModule1.WebModule1grafvenAction(Sender: TObject;
  Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
var JPEG : TJpegImage;
    //MemStr : TMemoryStream;
    Chart : TDBChart;
    Vseries1 : TLineSeries;
    Image : Timage;
    nWidth, nHeigh : integer;
    data1, data2: TDateTime;
begin
 
   nWidth := 800; nHeigh := 600;
   Try
   Case StrToInt(copy( request.queryfields.values['tamanhografico'],1,3)) of
   640: begin nWidth := 640; nHeigh := 480; end;
   800: begin nWidth := 800; nHeigh := 600; end;
   102: begin nWidth := 1024; nHeigh := 800; end;
   end;
   except
   end;
 
   data1 := StrToDate(request.queryfields.values['data1']);
   data2 := StrToDate(request.queryfields.values['data2']);
 
   // Select
   With IBQuery1 do
   begin
   sql.clear;
 
   Sql.Add(
      'select extract(year from a.nf_data), extract(month from a.nf_data), '+
      'cast(extract(year from a.nf_data) as char(4))||''/''||cast(extract(month from a.nf_data) as char(2)) as nf_data '+
      ', sum(a.nf_vtotal) as total '+
      'from cepnt001 a '+
      'left join tab_cfop t on (t.cfop = a.nf_cfis) '+
      'where (a.id_emp = :idEmp) and (a.nf_data between :data1 and :data2) '+
      'and ((t.operacao = 00) or (a.nf_serie starting with ''P'')) and (coalesce(nf_flag,''N'') = ''N'') '+
      'group by 1,2,3 order by 1,2'
      );
 
   ParamByName('idEmp').AsInteger := IBQueryUsr.FieldByName('id_cepemp01').AsInteger;
   ParamByName('data1').AsDateTime := StrToDate(request.queryfields.values['data1']);
   ParamByName('data2').AsDateTime := StrToDate(request.queryfields.values['data2']);
   open;
   end;
 
   Chart := TDBChart.create(nil);
   Try
 
   vSeries1 := TLineSeries.create (Chart);
 
   Chart.width := nWidth;
   Chart.Height:= nHeigh;
   Chart.Gradient.StartColor := clYellow;
   Chart.Gradient.EndColor := clWhite;
   Chart.Gradient.Visible := True;
   Chart.Legend.visible := False;
   Chart.Legend.TextStyle := ltsRightvalue;
 
   vSeries1.Title := 'TOTAL';
   vSeries1.ParentChart := Chart;
   vSeries1.DataSource := IBQuery1;
 
   vSeries1.YValues.ValueSource  := 'TOTAL';
 
   vSeries1.GetVertAxis.Labels := TRUE;
   vSeries1.GetVertAxis.LabelsMultiLine := TRUE;
   vSeries1.GetHorizAxis.Labels := TRUE;
   vSeries1.GetHorizAxis.LabelsOnAxis := FALSE;
   vSeries1.GetHorizAxis.LabelsAngle := 90;
   vSeries1.Marks.Visible := False;
   vSeries1.marks.Style := smsPercent;
   vSeries1.Dark3D := False;
 
 
   if (data2 - data1 <= 31)  then
   begin
      vSeries1.XValues.ValueSource := 'NF_DATA';
      vSeries1.xValues.DateTime := True;
   end
   else begin
      vSeries1.XLabelsSource := 'NF_DATA';
      vSeries1.xValues.DateTime := True;
   end;
 
   Chart.AddSeries(vSeries1);
 
   if request.QueryFields.values['efeito3D'] = 'ON' then
   Chart.View3D := True
   else
   Chart.View3D := False;
 
   Image := TImage.create (nil);
   Try
   Image.width := Chart.Width;
   Image.Height:= Chart.Height;
 
   // Titulo do Grafico
   Chart.Title.Text.Clear;
   Chart.Title.Text.Add( 'GRÁFICO DE VENDAS' );
   Chart.Title.Text.Add( 'Periodo de: '+
   FormatDateTime( 'dd/mm/yyyy', StrToDate(request.queryfields.values['data1']) )+
   ' até '+FormatDateTime( 'dd/mm/yyyy', StrToDate(request.QueryFields.values['data2'])) );
 
   // Desenha o Grafico
   Chart.Draw (Image.Canvas, Image.BoundsRect);
 
   Try
   Jpeg := TJpegimage.create;
   Try
     Jpeg.Assign (Image.picture.Bitmap);
     // salva grafico
     Jpeg.SaveToFile('c:\inetpub\wwwroot\graficos\'+
     IBqueryUsr.FieldByName('id_cepusr01').AsString+'gvendas'+
     IBQueryUsr.FieldByName('id_cepemp01').AsString+'.jpg');
     // devolve URL do gráfico
     response.SendRedirect(scriptname+'/devgraf?nomearq='+
     IBqueryUsr.FieldByName('id_cepusr01').AsString+'gvendas'+
     IBQueryUsr.FieldByName('id_cepemp01').AsString+'.jpg'+
     '&titulo=Gráfico de Vendas'+
     '&data1='+request.queryfields.values['data1']+
     '&data2='+request.QueryFields.values['data2']+
     '&actlist='+scriptname+'/listven');
   Finally
     Jpeg.Free;
   End;
   Finally
     Chart.free;
     vSeries1.free;
   End;
   Finally
     Image.free;
   End;
   Finally
     IBQuery1.close;
   End;
 
end;
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02