A problem GRAPH-refresh from folder and DBF-values

A problem GRAPH-refresh from folder and DBF-values

Postby ukoenig » Mon Sep 28, 2015 3:36 pm

Hello,

I wanted to refresh the bars with new values, defined inside a DBF-file

I don't get it working using folders at RUNTIME.
Closing and reopening the statistic, it works.
In case it doesn't work, I can change it using xBrowse.

The array is new defined from a DBF
but oGraph:Refresh() doesn't work in folder-page 3.

oGraph:aData = { { aJS1[1], aJS1[2], aJS1[3], aJS1[4], ;
aJS1[5], aJS1[6], aJS1[7], aJS1[8], ;
aJS1[9], aJS1[10], aJS1[11], aJS1[12] } }

new oGraph:aData are redefined from a DBF with 12 records
1 record = 1 month

DBSELECTAREA("UMSATZ2")
("UMSATZ2")->(DBGOTOP())
I := 1
DO WHILE !EOF()
aJS1[I] := ("UMSATZ2")->RE_SUMME
("UMSATZ2")->(DBSKIP(+1))
I++
ENDDO
("UMSATZ2")->(DBGOTOP())

Also tested from a folder-page change :
setting new bar-values from the DBF with no difference

IIF( nPage = 3, ( SET_GRAPH(), oGraph:Update() ), NIL ), ;

The month-values of a year are defined in folder-page 1

Image

I can add the total-values to the year-statistic in folder-page 2

Image

Folder-page 3 must show bars of the values defined in folder-page 2
but the bars are not repainted in page 3 showing the new values
maybe not possible to change the graph at RUNTIME ?

Image

using xBrowse and Dialog, the repainting works fine

Image

best regards
Uwe :?:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: A problem GRAPH-refresh from folder and DBF-values

Postby ukoenig » Tue Sep 29, 2015 12:26 pm

I created a sample to test from dialog and folderpages.
No result, to update & repaint the bars with new values

trying to update from inside the dialog and
update the graph in page 4 with new values defined in page 1

Image

Image

// The defined dialog-data-array to be changed
aJS1[1] := 108
aJS1[2] := 150
aJS1[3] := 120
aJS1[4] := 80
aJS1[5] := 10
aJS1[6] := 50
aJS1[7] := 70
aJS1[8] := 190
aJS1[9] := 60
aJS1[10] := 80
aJS1[11] := 90
aJS1[12] := 30

REDEFINE GRAPH oGraph1 ID 120 TYPE 1 OF oDlg // UPDATE NO difference !!!

oGraph1:aSeries = { { "Test", 16771797 , , } }
oGraph1:nBarSep := 10
oGraph1:lBorders := .T.
oGraph1:lxGrid := .T.
oGraph1:lyGrid := .T.
oGraph1:l3D := .T.
oGraph1:lxVal := .T.
oGraph1:lyVal := .T.
oGraph1:lBordLeg := .T.
oGraph1:lLegends := .T.
oGraph1:lTitle := .T.
oGraph1:nClrX := 8421376 // Green
oGraph1:nClrY := 255
oGraph1:aYVals := { "1", "2", "3", "4", "5", "6", "7", ;
"8", "9", "10", "11", "12" }
oGraph1:lViewVal := .T.
oGraph1:aFont[2] := oFont
oGraph1:aFont[3] := oFont
oGraph1:aFont[8] := oFont

// The data-array
oGraph1:aData = { { aJS1[1], aJS1[2], aJS1[3], aJS1[4], ;
aJS1[5], aJS1[6], aJS1[7], aJS1[8], ;
aJS1[9], aJS1[10], aJS1[11], aJS1[12] } }

doesn't work !!!

// array with new values from button-action
REDEFINE BUTTON ID 130 OF oDlg ;
ACTION ( oGraph1:aData = { { aJS1[1] := 10, aJS1[2] := 10, aJS1[3] := 10, aJS1[4] := 10, ;
aJS1[5] := 10, aJS1[6] := 10, aJS1[7] := 10, aJS1[8] := 10, ;
aJS1[9] := 10, aJS1[10] := 10, aJS1[11] := 10, aJS1[12] := 10 } }, ;
oGraph1:Refresh() )


another test doesn't work !!!

//REDEFINE BUTTON ID 130 OF oDlg ;
//ACTION ( aJS1[1] := 10, aJS1[2] := 10, aJS1[3] := 10, aJS1[4] := 10, ;
// aJS1[5] := 10, aJS1[6] := 10, aJS1[7] := 10, aJS1[8] := 10, ;
// aJS1[9] := 10, aJS1[10] := 10, aJS1[11] := 10, aJS1[12] := 10, ;
// oGraph1:Refresh() )


any idea ?
otherwise I have to find another solution.

best regards
Uwe :?:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: A problem GRAPH-refresh from folder and DBF-values

Postby cnavarro » Tue Sep 29, 2015 1:21 pm

Uwe

Although not a proper technique, try to call the Display method, instead of the Refresh
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: A problem GRAPH-refresh from folder and DBF-values

Postby ukoenig » Tue Sep 29, 2015 2:07 pm

Cristobal,

thank You very much.

I think I have to use

oGraph1:AddSerie( aJS1,"Serie", 16771797 )
// AddSerie( aDat, cLegend, nColor, nType, l3D )


changing the array, the refresh is working fine

Image

Changing the values :

REDEFINE BUTTON ID 150 OF oDlg ;
ACTION ( aJS1[1] := 108, aJS1[2] := 150, aJS1[3] := 120, aJS1[4] := 80, ;
aJS1[5] := 10, aJS1[6] := 50, aJS1[7] := 70, aJS1[8] := 190, ;
aJS1[9] := 60, aJS1[10] := 80, aJS1[11] := 90, aJS1[12] := 30, ;
oGraph1:Refresh() )


REDEFINE BUTTON ID 130 OF oDlg ;
ACTION ( aJS1[1] := 100, aJS1[2] := 200, aJS1[3] := 400, aJS1[4] := 500, ;
aJS1[5] := 700, aJS1[6] := 300, aJS1[7] := 600, aJS1[8] := 800, ;
aJS1[9] := 900, aJS1[10] := 50, aJS1[11] := 400, aJS1[12] := 200, ;
oGraph1:Refresh() )


best regards
Uwe :D
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: A problem GRAPH-refresh from folder and DBF-values

Postby cnavarro » Tue Sep 29, 2015 3:37 pm

Ah !, Ok, Uwe
Sometimes we take the hard way

Regards
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: A problem GRAPH-refresh from folder and DBF-values

Postby ukoenig » Fri Oct 02, 2015 1:40 pm

Here is the calculation to show the
TOOLTIPS of comparing any defined 3 years / 12 month each ( a little bit complicated )
each month is splitted in 10 groups ( kind of the different invoices ) to be counted to get the < month-total >

Image

Code: Select all  Expand view

REDEFINE GRAPH oGraph ID 310 TYPE 1 OF oDlg1 UPDATE
...
...
oGraph:aYVals = { "Jan", "Feb", "Mär", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez" }

oGraph:AddSerie( aJS1,"year 1", aVal[91] ) // a array to define any year
oGraph:AddSerie( aJS2,"year 2", aVal[92] )
oGraph:AddSerie( aJS3,"year 3", aVal[93] )

oGraph:cToolTip =  { | nAt, nSerie | nSerie := IF( nAt % ;
                 Len( oGraph:aSeries ) == 0, Len( oGraph:aSeries ), ;
                 Int( nAt % Len( oGraph:aSeries ) ) ), ;
                 cBarData := G_TOOLTIP(nAt, nSerie), ;
                 "year : " + cBarData[1] + CRLF + ; 
                 "total : " + cBarData[2] }            
...
...
// --------------

FUNCTION G_TOOLTIP( nAt, nSerie )
LOCAL ctotal := "", nBar := 1, I := 1, cyear := ""

IF nSerie = 1           // 3 years / serie
    cyear := cyearsel[1] // year-array ( selected year )
ELSEIF nSerie = 2
    cyear := cyearsel[2]
ELSEIF nSerie = 3
    cyear := cyearsel[3]
ENDIF

nBar := INT( nAt / LEN( oGraph:aSeries ) ) + 1 + ;
           IF( nAt % LEN( oGraph:aSeries ) == 0, -1, 0 )  

I := 1
FOR I := 1 TO 12        // 12 month
    IF nBar = I
        IF nSerie = 1
            cTotal := ALLTRIM( STR( aJS1[I] ) ) // array of the year total-value
        ELSEIF  nSerie = 2
            cTotal := ALLTRIM( STR( aJS2[I] ) )
        ELSEIF  nSerie = 3
            cTotal := ALLTRIM( STR( aJS3[I] ) )
        ENDIF
    ENDIF
NEXT

RETURN { cyear, cTotal }

 


best regards
Uwe :D
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany


Return to FiveWin for Harbour/xHarbour

Who is online

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