tgraph and Y series alignment

tgraph and Y series alignment

Postby damianodec » Mon Feb 12, 2018 9:30 am

hi,
I'm working with TGRAPH class and have this graph:
Image

I would like get this kind of alignment:
Image

is it possible?

thanks
FiveWin for xHarbour 17.09 - Sep. 2017 - Embarcadero C++ 7.00 for Win32
User avatar
damianodec
 
Posts: 235
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia

Re: tgraph and Y series alignment

Postby ukoenig » Mon Feb 12, 2018 1:00 pm

Did You define a BAR-SEPERATOR :?:

oGraph:nBarSep := nVal // Bar Separator

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: 3460
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: tgraph and Y series alignment

Postby damianodec » Mon Feb 12, 2018 1:09 pm

I Uwe
I would like to rotate the text like 2nd picture
FiveWin for xHarbour 17.09 - Sep. 2017 - Embarcadero C++ 7.00 for Win32
User avatar
damianodec
 
Posts: 235
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia

Re: tgraph and Y series alignment

Postby ukoenig » Mon Feb 12, 2018 2:08 pm

I think You have to define a extra font

The tested fontstring ( saved to a DBF-field )

cBFont[3] := {"AcmeFont",0,-13,.F.,.F., 900 ,0,,.F.,.F.,.F.,0,3,2,1,,2}

I save the fontstring cBFont[3] to a DBF-field like

ACTION ( aFont := CHOOSEFONT(), ;
oFont0 := BUILDFONT( aFont ) , ;
IIF( aFont[ LF_FACENAME ] <> NIL, ;
( DeleteObject(oBFont[3]), ;
cBFont[3] := FontToText(oFont0) , ;
oBFont[3] := oFont0, ;
oFGet[3]:SetFont(oBFont[3]), ; // control
oGet[5]:Refresh(), ; // control
oFGet[3]:Refresh(), ; // control
DeleteObject(oFont0), ;
oGraph:aFont[3] := oBFont[3], ;
ograph:Refresh() ), NIL ) ) ;

The function BUILDFONT( aFont )

Code: Select all  Expand view

STATIC FUNCTION BUILDFONT( aFont )

IF EMPTY( aFont[ LF_FACENAME ] )
        MsgAlert( "No Font selected !","Break" )
        RETURN NIL
ENDIF

RETURN TFont():New( aFont[ LF_FACENAME ],;
,;
aFont[ LF_HEIGHT ],;
.f.,;
!( aFont[ LF_WEIGHT ] == 400 ),;
aFont[ LF_ESCAPEMENT ],;
aFont[ LF_ORIENTATION ],;
aFont[ LF_WEIGHT ],;
aFont[ LF_ITALIC ],;
aFont[ LF_UNDERLINE ],;
aFont[ LF_STRIKEOUT ],;
aFont[ LF_CHARSET ],;
aFont[ LF_OUTPRECISION ],;
aFont[ LF_CLIPPRECISION ],;
aFont[ LF_QUALITY ],;
,;
aFont[ LF_PITCHANDFAMILY ] )
 


Fonts are defined like

oGraph:aFont[1] := aFont[1] // Title
oGraph:aFont[2] := aFont[2] // xFont
oGraph:aFont[3] := aFont[3] // yFont
oGraph:aFont[4] := aFont[4] // Legends
oGraph:aFont[5] := aFont[5] // Subtitle
oGraph:aFont[6] := aFont[6] // xTitle
oGraph:aFont[7] := aFont[7] // y Title
oGraph:aFont[8] := aFont[8] // Values


Just a quick test !

Image

regards
Uwe :D
Last edited by ukoenig on Tue Feb 13, 2018 9:34 am, edited 1 time in total.
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: 3460
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: tgraph and Y series alignment

Postby damianodec » Tue Feb 13, 2018 8:04 am

hi Uwe, thank you, I try this:
Code: Select all  Expand view
    DEFINE FONT oFont NAME "Tahoma" SIZE 0, -11
   
    DEFINE FONT oFontY NAME "Courier new" SIZE 0, -8
   
    oFont45 := oFontY:Rotate( 450 )
    mieiFont[3] := oFont45


    DEFINE DIALOG oDlg2 SIZE 1080,600 PIXEL  FONT oFont;
    STYLE nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION, WS_SYSMENU, ;
             WS_MINIMIZEBOX, WS_THICKFRAME ) ;
              TITLE "Periodo di riferimento: "+DtoC(m_get[01])+" - "+dtoc(m_get[02])

    // grafico 1
    @ 10, 1 GRAPH oGraph1;
           SIZE 180, 80 PIXEL ;
           TYPE GRAPH_TYPE_BAR;
           YVALUES  XGRID XVALUES
           
    oGraph1:aSeries = {{ m_get[21], CLR_CYAN  }}
    oGraph1:aYVals = aResiYval
    oGraph1:aData = {aResiPerc}
    oGraph1:nClrX = CLR_GREEN
    oGraph1:nClrY = CLR_RED
    oGraph1:nMinVal = 0
    oGraph1:lDegrade = .t.
    oGraph1:cTitle := m_get[21]+" %"
    oGraph1:cToolTip = {|oGph,nSerie,nPos,nVal| oGraph1:aYVals[nPos]+": "+cValToChar(Round(nVal,2))}
    oGraph1:SetFonts(mieiFont)

but nothing..

I change metod paint in tgraph.prg
Code: Select all  Expand view
METHOD Paint( nTop, nLeft, nBottom, nRight ) CLASS TGraph

 ...
   local oFont45
oFont45 := ::aFont[3]:Rotate( 450 )

  IF lyVal .AND. Len(::aYVals)>0                // Show yLabels
      nI := nLeft + nWide
      FOR nJ := 1 TO ::nMax()
*         ::Say(nBottom+ 5, nI-nDeep, ::aYVals[nJ], ::aFont[3], ::nClrY, ::nTCent)
         ::Say(nBottom+ 5, nI-nDeep, ::aYVals[nJ], oFont45, ::nClrY, ::nTCent)
         nI += nWide
      NEXT
   ENDIF

 


that works
Image

it seems that
Code: Select all  Expand view
oGraph1:SetFonts(mieiFont)
does not work

why?
FiveWin for xHarbour 17.09 - Sep. 2017 - Embarcadero C++ 7.00 for Win32
User avatar
damianodec
 
Posts: 235
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia

Re: tgraph and Y series alignment

Postby ukoenig » Tue Feb 13, 2018 9:42 am

damianodec ,

Some years ago 2014, I created a graph-designer
I can define anything I want ( visual design ) like fonts, style colors...

There was nothing wrong with the font or class TGraph.
I want to update this tool because of many new possible things during this time
and screen adjustment for modern monitors. :roll:
But in the moment I'm jumping around between different topics
that means it will still take some time for the update.

Image

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: 3460
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: tgraph and Y series alignment

Postby ukoenig » Tue Feb 13, 2018 3:20 pm

damianodec ,

I got it working using the original FWH-sample graph.prg
I noticed there is NO value to define the text-startposition ( yFont ) at the bottom

Image

Code: Select all  Expand view

nType       // Graph Type
nDegrade  // Degrade bars color 0, 1, 2

l3D         // Show 3D
lxGrid      // Show Grid
lyGrid      // Show Grid
lDotted     // Grid Dotted
lxVal         // Show xValues
lyVal          // Show yValues
nBarD       // Deep bar
lTitle          // Show Title
lLegends    // Show Legends
cTitle        // Graph Title
cPicture     // Mask values
aSeries     // Series
aData       // Data
aSTemp      // Series
aDTemp      // Data
aYVals      // yValues
aYTemp      // yValues
aFont       // Title, xFont, yFont, Legends
               // Subtitle, xTitle, yTitle, Values
nClrT           // Color titles
nClrX       // Color x labels
nClrY       // Color y labels
nClrL       // Color legends
nClrV       // Color values
nClrST      // Color subtitle
nClrXT      // Color xTitle
nClrYT      // Color yTitle
nPieX       // Pie graph pos
nPieSt      // Start pie (angle)
nPoint      // Point type
nBarSep     // Bar Separator
nXRanges   // n Ranges
nValues     // Pie values (Serie/Period)
lViewVal    // View values
nClr, hPen, hOldPen // Pen handles
nPenWidth    // Graph line pen width
lBorders        // Borders
lcTitle          // Center title
nClrGrid        // Grid color
nClrBack        // Background color
nClrBLeg        // Back legend color
cBitmap        // Background bitmap
cSubTit        // Subtitle
cTitX           // xTitle
cTitY           // yTitle
nMaxVal      // Max Value
nMinVal      // Min Value
lLine           // Yellow line
lPopUp        // PopUp menu
lSelView        // Select view option
lSelBack        // Select back option
lFull              // All Graph Area
nLanguage   // Language (1-English, 2-Spanish, 3-...)
aSTitle INIT {.T.,.T.,.T.,.T.}  // Shadow titles

nTRight     // Right align
nTLeft      // Left  align
nTCent      // Cent  align
oPrn            // Printer object by Galvez
lBordLeg INIT .T.   // Legend border  by dREHER
 


Add to the sample

Code: Select all  Expand view

...
...
ACTIVATE DIALOG oDlg CENTER ON INIT SET_FONTS( oGraph ) // FONTS on INIT !!!

SET RESOURCES TO

RETURN NIL

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

FUNCTION SET_FONTS( oGraph )

// oGraph:aFont[1] := aFont[1] // Title
// oGraph:aFont[2] := aFont[2] // xFont
// oGraph:aFont[3] := aFont[3] // yFont
// oGraph:aFont[4] := aFont[4] // Legends
// oGraph:aFont[5] := aFont[5] // Subtitle
// oGraph:aFont[6] := aFont[6] // xTitle
// oGraph:aFont[7] := aFont[7] // y Title
// oGraph:aFont[8] := aFont[8] // Values

// METHOD New(
//  1 cFaceName,
//  2 nWidth,
//  3 nHeight,
//  4 lFromUser,;
//  5 lBold,
//  6 nEscapement,
//  7 nOrientation,
//  8 nWeight,
//  9 lItalic,;
// 10 lUnderline,
// 11 lStrikeOut,
// 12 nCharSet,
// 13 nOutPrecision,;
// 14 nClipPrecision,
// 15 nQuality,
// 16 oDevice,
// 17 nPitchFamily )
//                                                   1      2    3    4    5     6    7  8  9   10   11 12 13  14  15  16  17  
oGraph:aFont[1] := TFont():New( "Arial", 0, -16, .F., .T., 0    , 0,  , .F., .F., .F., 0,  3,   2,   1,     ,34 )
oGraph:aFont[2] := TFont():New( "Arial", 0, -18, .F., .T., 0    , 0,  , .F., .F., .F., 0,  3,   2,   1,     , 2 )
oGraph:aFont[3] := TFont():New( "Arial", 0, -14, .F., .T., 900, 0,  , .F., .F., .F., 0,  3,   2,   1,     ,34 )
oGraph:aFont[4] := TFont():New( "Arial", 0, -16, .F., .T., 0    , 0,  , .F., .F., .F., 0,  3,   2,   1,     , 2 )
oGraph:aFont[5] := TFont():New( "Arial", 0, -16, .F., .F., 0    , 0,  , .F., .F., .F., 0,  3,   2,   1,     , 2 )
oGraph:aFont[6] := TFont():New( "Arial", 0, -12, .F., .F., 0    , 0,  , .F., .F., .F., 0,  3,   2,   1,     , 2 )
oGraph:aFont[7] := TFont():New( "Arial", 0, -18, .F., .T., 0    , 0,  , .F., .F., .F., 0,  3,   2,   1,     ,34 )
oGraph:aFont[8] := TFont():New( "Arial", 0, -20, .F., .T., 0    , 0,  , .F., .F., .F., 0,  3,   2,   1,     ,34 )

oGraph:Refresh()

RETURN NIL
 


regards
Uwe :D
Last edited by ukoenig on Wed Feb 14, 2018 10:23 am, edited 1 time in total.
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: 3460
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: tgraph and Y series alignment

Postby damianodec » Tue Feb 13, 2018 4:21 pm

hi Uwe
thank you, but I have 3 graph on dialog I would like TFont():New( "Arial", 0, -14, .F., .T., 900, 0, , .F., .F., .F., 0, 3, 2, 1, ,34 ) on the first graph
FiveWin for xHarbour 17.09 - Sep. 2017 - Embarcadero C++ 7.00 for Win32
User avatar
damianodec
 
Posts: 235
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia

Re: tgraph and Y series alignment

Postby nageswaragunupudi » Wed Feb 14, 2018 5:07 am

A Simple way to do:

Code: Select all  Expand view
  ACTIVATE DIALOG oDlg CENTERED ;
      ON INIT ( oVert := oGraph:aFont[ 3 ]:Rotate(), ;
                oGraph:SetFonts( { nil, nil, oVert } ), ;
                oVert:End() )
 

oGraph refers to your first Graph.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 5563
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: tgraph and Y series alignment

Postby damianodec » Wed Feb 14, 2018 9:07 am

thank you Mr. Rao and Mr Uwe
FiveWin for xHarbour 17.09 - Sep. 2017 - Embarcadero C++ 7.00 for Win32
User avatar
damianodec
 
Posts: 235
Joined: Wed Jun 06, 2007 2:58 pm
Location: Italia

Re: tgraph and Y series alignment

Postby ukoenig » Wed Feb 14, 2018 10:25 am

You cannot split the text with different fonts for
oGraph:aYVals := { "Jan", "Feb", "Mar", "Apr", "May" }
but You can paint / add extra images ( with possible action ) or text to the graph

Image

disable NOBORDER during design :!: to see the painted areas

Code: Select all  Expand view

#include "TTitle.ch"
...
...
ACTIVATE DIALOG oDlg CENTER ;
ON INIT SET_VAL( oGraph, oDlg )

SET RESOURCES TO

RETURN NIL

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

FUNCTION SET_VAL( oGraph, oDlg )
LOCAL oText1, oTitle1, oTitle2

@ 450, 68 TITLE oTitle1 SIZE  500, 100 OF oDlg TRANSPARENT NOBORDER
@ 57, 75 TITLETEXT oText1 OF oTitle1 TEXT "Test 1" FONT oFont90 COLOR 255
@ 57, 160 TITLETEXT oText1 OF oTitle1 TEXT "Test 2" FONT oFont90 COLOR 16711680
@ 57, 245 TITLETEXT oText1 OF oTitle1 TEXT "Test 3" FONT oFont90 COLOR 32768
@ 57, 330 TITLETEXT oText1 OF oTitle1 TEXT "Test 4" FONT oFont90 COLOR 16711935
@ 57, 415 TITLETEXT oText1 OF oTitle1 TEXT "Test 5" FONT oFont90 COLOR 128

@ 95, 540 TITLE oTitle2 SIZE 200, 200 OF oDlg  TRANSPARENT NOSHADOW  NOBORDER  
oTitle2:aGrdBack := {}
@ 5, 5 TITLEIMG  OF oTitle2 BITMAP "Favorite.bmp" SIZE 60, 60 ;
TRANSPARENT ANIMA ; 
ACTION YOUR_ACTION()
...
...
 


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: 3460
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 13 guests