Error em TGraph (resolved)

Error em TGraph (resolved)

Postby augustogomes » Thu Sep 07, 2017 1:50 pm

Good morning friends.
I found 2 errors in my programs when I use the TGraph class.

1 - When the values of the column x (: aSeries ) arrives to millions, there is an overflow in the picture.

2 - If you use the popup menu in the item "Values", if it is graph bar, it generates the error below.

Error description: Error BASE/1066 Argument error: conditional
Args:
[ 1] = U

Stack Calls
===========
Called from: .\source\classes\TGRAPH.PRG => TGRAPH:PAINT( 1068 )
Called from: .\source\classes\TGRAPH.PRG => (b)TGRAPH:TGRAPH( 116 )
Called from: => TGRAPH:DISPLAY( 0 )



I checked these errors in fwh1608 and fwh1701

How can I resolve this?

follows an example:

Code: Select all  Expand view

// Placing a bussiness graph in a folder

#include "FiveWin.ch"
#include "Folder.ch"
#include "TGraph.ch"

//----------------------------------------------------------------------------//

function Main()

   local oDlg, oFld, oCbx, cItem, oGraph

   SET _3DLOOK ON

   DEFINE DIALOG oDlg RESOURCE "Test"

   REDEFINE FOLDER oFld ID 110 OF oDlg ;
      PROMPT "Folder 1", "Graph","Graph2" ;
      DIALOGS "Sub1", "Sub2" ,"Sub2"

   oFld:aEnable = { .t., .t. ,.t.}

   REDEFINE COMBOBOX oCbx VAR cItem ITEMS { "Apenas", "um", "a test" } ;
      ID 100 OF oFld:aDialogs[ 1 ]


  // REDEFINE GRAPH oGraph ID 500 TYPE 1 YVALUES 3D XGRID YGRID XVALUES LEGENDS OF oFld:aDialogs[ 2 ]
   REDEFINE GRAPH oGraph ID 500 TYPE 1 YVALUES 3D XGRID YGRID POPUP XVALUES LEGENDS OF oFld:aDialogs[ 2 ]

   oGraph:aSeries = { { "Series 1", CLR_CYAN , , },;
                      { "Series 2", CLR_YELLOW, , .T. },;
                      { "Series 3", CLR_HRED, 3, .F. } }

   oGraph:aYVals = { "Jan", "Feb", "Mar", "Apr", "May" }

    * alterado valores
  // oGraph:aData = { { 14280, 20420, 12870, 25347, 7640 },;
  //                  { 8350, 10315, 15870, 5347, 12340 },;
  //                  { 12345, -8945, 10560, 15600, 17610 } }

  oGraph:aData = { { 14280, 20420, 12870, 1125347, 7640 },;
                    { 8350, 10315, 15870, 5347, 12340 },;
                    { 12345, -8945, 10560, 15600, 17610 } }

   oGraph:nClrX = CLR_GREEN
   oGraph:nClrY = CLR_RED

 
  REDEFINE GRAPH oGraph2 ID 500 TYPE 4 YVALUES  XGRID YGRID XVALUES LEGENDS OF oFld:aDialogs[ 3 ]

   oGraph2:aSeries = { { "Series 1", CLR_CYAN , , },;
                      { "Series 2", CLR_YELLOW, , .T. },;
                      { "Series 3", CLR_HRED, 3, .F. } }

   oGraph2:aYVals = { "Equipamentos", "Peças", "Bombas", "Aquecedor", "Software","Equip", "Peças3", "Bombas4", "Aquecedor55" }

   oGraph2:aData = { { 14280, 20420, 12870, 25347, 7640,500,1890,3500,17800 },;
                    { 8350, 10315, 15870, 5347, 12340,0,0,0,0 },;
                    { 12345, -8945, 10560, 15600, 17610,2,2,2,2 } }

   oGraph2:nClrX = CLR_GREEN
   oGraph2:nClrY = CLR_RED

   REDEFINE BUTTON ID 120 OF oDlg ;
      ACTION oDlg:End()

   ACTIVATE DIALOG oDlg CENTERED ;
      VALID MsgYesNo( "Want to end ?" )

return nil

//----------------------------------------------------------------------------//
 


[img]
https://photos.google.com/photo/AF1QipN ... OcbovY1Jlu
https://photos.google.com/photo/AF1QipP ... 6nd_yDuruc
[/img]
Last edited by augustogomes on Thu Sep 07, 2017 3:00 pm, edited 1 time in total.
Augusto Gomes /Suprisystem Informática - Fivewin 16.08 - xharbour 123 - BCC70 - DBFNTX e PostGreSql
User avatar
augustogomes
 
Posts: 23
Joined: Mon Jun 06, 2016 8:38 pm
Location: Ribeirão Preto - SP - Brasil

Re: Error em TGraph

Postby cnavarro » Thu Sep 07, 2017 2:22 pm

Defintion of series have more of 4 parameters


METHOD AddSerie( aDat, cLegend, nColor, nType, l3D, lViewVal, lDrawPoint, lDrawLine, cSRLegend ) CLASS TGraph


and you defintion is


oGraph:aSeries = { { "Series 1", CLR_CYAN , , },; // only 4 parameters
{ "Series 2", CLR_YELLOW, , .T. },;
{ "Series 3", CLR_HRED, 3, .F. } }


Your error is with DATA lViewVal, 6º parameter into definition of AddSeries, not defined in you definition of series

2) Definition of cPicture

Add your code

oGraph:cPicture := "99,999,999.99"

and try
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6501
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Error em TGraph (resolved)

Postby augustogomes » Thu Sep 07, 2017 3:01 pm

Thank you very much !

It worked!

thanks
Augusto Gomes /Suprisystem Informática - Fivewin 16.08 - xharbour 123 - BCC70 - DBFNTX e PostGreSql
User avatar
augustogomes
 
Posts: 23
Joined: Mon Jun 06, 2016 8:38 pm
Location: Ribeirão Preto - SP - Brasil


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 20 guests