DRAW GRAPH

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
AUGE_OHR
Posts: 1314
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany
Has thanked: 246 times
Been thanked: 377 times

DRAW GRAPH

Post by AUGE_OHR »

hi,

i have made a Diagram from DBF Data and have some Question to optimize

a.) can i "color" Data Value ?
b.) can i "color" Background with different (!) Color ?

Data are from 100-200 so much Space on Button ... how to "fill" better :idea:
BPM.jpg
BPM.jpg (121.21 KiB) Viewed 286 times
---

Code: Select all


PROCEDURE ProcDrawGraph()
LOCAL aSerieValues, aValue, aYNames
LOCAL aColors, aDayColor
LOCAL nImageWidth  := 800 - 20
LOCAL nImageHeight := 600 - 50
LOCAL hBitmap      := 0
LOCAL dDate

   aValue:= {}
   aYNames := {}
   aColors := {}
   dDate := CTOD("  .  .  ")

   GO BOTTOM
   SKIP -100
   DO WHILE !EOF()
      AADD(aValue, BLPRESS->DATAPPM)
      IF dDate = BLPRESS->PDATE
         AADD(aYNames, "" )
      ELSE
         AADD(aYNames, SUBSTR(DTOC(BLPRESS->PDATE),1,2) )
         dDate := BLPRESS->PDATE
      ENDIF

*      aDayColor := IF( BLPRESS->DATAPPM >= nRangeMax, { 255, 0, 0 }, ;
*                   IF( BLPRESS->DATAPPM >= nRange3, { 255, 64, 0 }, ;
*                   IF( BLPRESS->DATAPPM >= nRange2, { 255, 128, 0 }, ;
*                   IF( BLPRESS->DATAPPM >= nRange1, { 255, 192, 0 }, ;
*                   IF( BLPRESS->DATAPPM >= nRangeMin, { 255, 255, 0 }, {0,255,0} ) ) ) ) )
*
*      AADD(aColors, aDayColor)

      SKIP
   ENDDO

   aSerieValues := {}
   AADD(aSerieValues,ACLONE(aValue))

   aDayColor := {56,56,56}
   AADD(aColors, aDayColor)


   DRAW GRAPH                                        ;
      IN WINDOW Form_2                               ;
      AT 10,10                                       ;
      TO nImageHeight,nImageWidth                    ;
      TITLE "BPM"                                    ;
      TYPE LINES                                     ;
      SERIES aSerieValues                            ;
      YVALUES aYNames                                ;
      DEPTH 1                   ;
      BARWIDTH 10                ;
      HVALUES 20                                      ;
      SERIENAMES { "Jimmy" }                         ;
      COLORS aColors                   ;
      SHOWGRID                                       ;
      SHOWXVALUES                                    ;
      SHOWYVALUES                                    ;
      SHOWLEGENDS                                    ;
      NOBORDER

      Form_2.Image_1.HBITMAP := hBitmap   // Assign hBitmap to the IMAGE control

RETURN

have fun
Jimmy

User avatar
andyglezl
Posts: 1329
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Has thanked: 46 times
Been thanked: 151 times
Contact:

Post by andyglezl »

Ya viste en \HMG\3.4.4\SAMPLES\Controls\Graph\GRAPH_Bitmap
*-------------------------------------------------------------------------------
You already saw in \HMG\3.4.4\SAMPLES\Controls\Graph\GRAPH_Bitmap


imagen_2021-02-22_234128.png
imagen_2021-02-22_234128.png (47.26 KiB) Viewed 270 times
Andrés González López
Desde Guadalajara, Jalisco. México.

User avatar
AUGE_OHR
Posts: 1314
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany
Has thanked: 246 times
Been thanked: 377 times

Post by AUGE_OHR »

hi,

thx for Answer.

i saw that Sample but it is different to my Question.

ad a.) Color depend on "line" not "Value"
ad b.) Background Color is only at Y-Value 0,0

while it have a negative Value it does "fill" hole Image
Question : how can i start with Y-Value 100 (up to 200) :idea:
have fun
Jimmy

Post Reply