rudi Posted August 19, 2021 Share Posted August 19, 2021 (edited) Hello, searching for a solution to plot temperature values to an image I came across this UDF by @andybiochem He hasn't been online since Oct. 2011, so maybe somone else could give me some hints how to proceed. Possibly some other UDF might be a better approach? 🤔 The final goal is to plot temperature values (y-axis) by Date-Time (x-axis) and to save that output to an JPEG file.  This is my code so far, next steps would be to "label" the x-axis with DateTime instead of integers. After that to save the plot to JPEG. expandcollapse popup#include "GraphGDIPlus.au3" #include <Date.au3> Opt("GUIOnEventMode", 1) $GUI = GUICreate("",600,600) GUISetOnEvent(-3,"_Exit") GUISetState() ;----- Create Graph area ----- $Graph = _GraphGDIPlus_Create($GUI,40,30,530,520,0xFF000000,0xFF88B3DD) ;----- Set X axis range from -5 to 5 ----- _GraphGDIPlus_Set_RangeX($Graph,0,300,10,1,0) _GraphGDIPlus_Set_RangeY($Graph,10,40,30,1,0) ;----- Set Y axis range from -5 to 5 ----- _GraphGDIPlus_Set_GridX($Graph,10,0xFF6993BE) _GraphGDIPlus_Set_GridY($Graph,5,0xFF6993BE) ;----- Draw the graph ----- $ini="Celsius.ini" $Sect="TBE" WriteSampleINI() $aEntries=IniReadSection($ini,$Sect) _Draw_Graph() While 1 Sleep(100) WEnd Func _Draw_Graph() ;----- Set line color and size ----- _GraphGDIPlus_Set_PenColor($Graph,0xFF325D87) _GraphGDIPlus_Set_PenSize($Graph,2) ;----- draw lines ----- $First = True For $i = 1 to $aEntries[0][0] $x = $aEntries[$i][0] $y = $aEntries[$i][1] If $First = True Then _GraphGDIPlus_Plot_Start($Graph,$x,$y) $First = False _GraphGDIPlus_Plot_Line($Graph,$x,$y) _GraphGDIPlus_Refresh($Graph) Next EndFunc Func _GammaFunction($iZ) $nProduct = ((2^$iZ) / (1 + $iZ)) For $n = 2 to 1000 $nProduct *= ((1 + (1/$n))^$iZ) / (1 + ($iZ / $n)) Next Return (1/$iZ) * $nProduct EndFunc Func _Exit() ;----- close down GDI+ and clear graphic ----- _GraphGDIPlus_Delete($GUI,$Graph) Exit EndFunc Func WriteSampleINI() FileDelete($ini) $Sect="TBE" $StartTime="2021/08/06 12:05:00" $NextTime=$StartTime $StartTemp=19.5 $NowTemp=$StartTemp $Min = 19.5 $Max = 19.5 IniWrite($ini,$Sect & "-MinMax","Min",$Min) IniWrite($ini,$Sect& "-MinMax","Max",$Max) ; IniWrite($ini,$Sect,$StartTime,$StartTemp) for $i = 1 to 300 $Delta=Round(Random(-2,2),2) $NowTemp+= $Delta if $NowTemp < 10 or $NowTemp > 40 then $NowTemp -= $Delta*2 $NextTime=_DateAdd("n",5,$NextTime) IniWrite($ini,$Sect,$i,$NowTemp) ; IniWrite($ini,$Sect,$NextTime,$NowTemp) if $NowTemp<$Min Then $Min=$NowTemp IniWrite($ini,$Sect & "-MinMax","Min",$Min) EndIf if $NowTemp > $Max Then $Max = $NowTemp IniWrite($ini,$Sect & "-MinMax","Max",$Max) EndIf Next ; ShellExecute($ini) EndFunc the INI content finally will be of this shape: expandcollapse popup[TBE-MinMax] Min=16.2 Max=39.5 [TBE] 2021/08/06 12:05:00=19.5 2021/08/06 12:10:00=17.57 2021/08/06 12:15:00=17.78 2021/08/06 12:20:00=16.67 2021/08/06 12:25:00=16.2 2021/08/06 12:30:00=17.68 2021/08/06 12:35:00=19.5 2021/08/06 12:40:00=20.69 2021/08/06 12:45:00=18.89 2021/08/06 12:50:00=19.63 2021/08/06 12:55:00=21.29 2021/08/06 13:00:00=21.59 2021/08/06 13:05:00=20.12 2021/08/06 13:10:00=20.67 2021/08/06 13:15:00=19.97 2021/08/06 13:20:00=19.32 2021/08/06 13:25:00=20.37 2021/08/06 13:30:00=19.65 2021/08/06 13:35:00=18.71 2021/08/06 13:40:00=17.74 2021/08/06 13:45:00=16.84 2021/08/06 13:50:00=17.84 2021/08/06 13:55:00=19.04 2021/08/06 14:00:00=17.84 2021/08/06 14:05:00=19.78 2021/08/06 14:10:00=21.52 2021/08/06 14:15:00=22.47 2021/08/06 14:20:00=23.09 2021/08/06 14:25:00=22.69 2021/08/06 14:30:00=23.52 2021/08/06 14:35:00=23.59 2021/08/06 14:40:00=22.64 2021/08/06 14:45:00=22.76 2021/08/06 14:50:00=23.66 2021/08/06 14:55:00=23.32 2021/08/06 15:00:00=23.83 2021/08/06 15:05:00=23.23 2021/08/06 15:10:00=21.83 2021/08/06 15:15:00=20.29 2021/08/06 15:20:00=19.06 2021/08/06 15:25:00=19.85 2021/08/06 15:30:00=21.22 2021/08/06 15:35:00=23.17 2021/08/06 15:40:00=21.34 2021/08/06 15:45:00=22.47 2021/08/06 15:50:00=24.09 2021/08/06 15:55:00=25.69 2021/08/06 16:00:00=25.42 2021/08/06 16:05:00=25.63 2021/08/06 16:10:00=25.52 2021/08/06 16:15:00=26.69 2021/08/06 16:20:00=25 2021/08/06 16:25:00=24.21 2021/08/06 16:30:00=24.9 2021/08/06 16:35:00=25.28 2021/08/06 16:40:00=26.72 2021/08/06 16:45:00=26.56 2021/08/06 16:50:00=28.3 2021/08/06 16:55:00=28.78 2021/08/06 17:00:00=26.92 2021/08/06 17:05:00=26.9 2021/08/06 17:10:00=26.58 2021/08/06 17:15:00=27.02 2021/08/06 17:20:00=26.43 2021/08/06 17:25:00=27.27 2021/08/06 17:30:00=29.07 2021/08/06 17:35:00=29.88 2021/08/06 17:40:00=30.67 2021/08/06 17:45:00=30.6 2021/08/06 17:50:00=31.27 2021/08/06 17:55:00=30.07 2021/08/06 18:00:00=28.1 2021/08/06 18:05:00=29.37 2021/08/06 18:10:00=31.01 2021/08/06 18:15:00=29.62 2021/08/06 18:20:00=29.43 2021/08/06 18:25:00=28.69 2021/08/06 18:30:00=29.04 2021/08/06 18:35:00=27.05 2021/08/06 18:40:00=27.48 2021/08/06 18:45:00=28.12 2021/08/06 18:50:00=29.66 2021/08/06 18:55:00=31.11 2021/08/06 19:00:00=32.18 2021/08/06 19:05:00=32.35 2021/08/06 19:10:00=34.14 2021/08/06 19:15:00=33.11 2021/08/06 19:20:00=33.69 2021/08/06 19:25:00=32.59 2021/08/06 19:30:00=31.23 2021/08/06 19:35:00=29.32 2021/08/06 19:40:00=30.98 2021/08/06 19:45:00=31.79 2021/08/06 19:50:00=32.16 2021/08/06 19:55:00=31.24 2021/08/06 20:00:00=32.47 2021/08/06 20:05:00=34.25 2021/08/06 20:10:00=35.03 2021/08/06 20:15:00=34.96 2021/08/06 20:20:00=36.67 2021/08/06 20:25:00=35.8 2021/08/06 20:30:00=37.25 2021/08/06 20:35:00=36.66 2021/08/06 20:40:00=36.06 2021/08/06 20:45:00=37.3 2021/08/06 20:50:00=37.75 2021/08/06 20:55:00=37.9 2021/08/06 21:00:00=36.3 2021/08/06 21:05:00=34.46 2021/08/06 21:10:00=33.57 2021/08/06 21:15:00=34.89 2021/08/06 21:20:00=35.81 2021/08/06 21:25:00=35.52 2021/08/06 21:30:00=35.66 2021/08/06 21:35:00=35.5 2021/08/06 21:40:00=33.82 2021/08/06 21:45:00=32.92 2021/08/06 21:50:00=32.98 2021/08/06 21:55:00=34.16 2021/08/06 22:00:00=34.82 2021/08/06 22:05:00=35.13 2021/08/06 22:10:00=35.64 2021/08/06 22:15:00=37.36 2021/08/06 22:20:00=38.39 2021/08/06 22:25:00=37.78 2021/08/06 22:30:00=38.6 2021/08/06 22:35:00=38.9 2021/08/06 22:40:00=38.05 2021/08/06 22:45:00=38.58 2021/08/06 22:50:00=38.65 2021/08/06 22:55:00=36.93 2021/08/06 23:00:00=37.33 2021/08/06 23:05:00=38.25 2021/08/06 23:10:00=36.3 2021/08/06 23:15:00=35.21 2021/08/06 23:20:00=34.07 2021/08/06 23:25:00=35.2 2021/08/06 23:30:00=37.18 2021/08/06 23:35:00=35.28 2021/08/06 23:40:00=35.29 2021/08/06 23:45:00=33.55 2021/08/06 23:50:00=32.58 2021/08/06 23:55:00=34.48 2021/08/07 00:00:00=34.69 2021/08/07 00:05:00=36.59 2021/08/07 00:10:00=35.97 2021/08/07 00:15:00=34.78 2021/08/07 00:20:00=33.25 2021/08/07 00:25:00=31.46 2021/08/07 00:30:00=31.1 2021/08/07 00:35:00=32.47 2021/08/07 00:40:00=31.68 2021/08/07 00:45:00=30.59 2021/08/07 00:50:00=31.41 2021/08/07 00:55:00=30.99 2021/08/07 01:00:00=32 2021/08/07 01:05:00=33.04 2021/08/07 01:10:00=31.99 2021/08/07 01:15:00=33.38 2021/08/07 01:20:00=32.53 2021/08/07 01:25:00=32.77 2021/08/07 01:30:00=32.93 2021/08/07 01:35:00=34.66 2021/08/07 01:40:00=34.26 2021/08/07 01:45:00=34.47 2021/08/07 01:50:00=35.66 2021/08/07 01:55:00=33.85 2021/08/07 02:00:00=34.05 2021/08/07 02:05:00=33.58 2021/08/07 02:10:00=32.46 2021/08/07 02:15:00=31.19 2021/08/07 02:20:00=31.04 2021/08/07 02:25:00=31.48 2021/08/07 02:30:00=29.62 2021/08/07 02:35:00=31.22 2021/08/07 02:40:00=32.96 2021/08/07 02:45:00=31.15 2021/08/07 02:50:00=32.31 2021/08/07 02:55:00=32.8 2021/08/07 03:00:00=33.49 2021/08/07 03:05:00=35.43 2021/08/07 03:10:00=37.36 2021/08/07 03:15:00=39.22 2021/08/07 03:20:00=37.85 2021/08/07 03:25:00=39.4 2021/08/07 03:30:00=37.76 2021/08/07 03:35:00=37.74 2021/08/07 03:40:00=36.39 2021/08/07 03:45:00=35.17 2021/08/07 03:50:00=35.08 2021/08/07 03:55:00=35.45 2021/08/07 04:00:00=34.08 2021/08/07 04:05:00=34.82 2021/08/07 04:10:00=33.73 2021/08/07 04:15:00=34.76 2021/08/07 04:20:00=36.44 2021/08/07 04:25:00=38.42 2021/08/07 04:30:00=39.5 2021/08/07 04:35:00=38.11 2021/08/07 04:40:00=39.07 2021/08/07 04:45:00=39.1 2021/08/07 04:50:00=37.49 2021/08/07 04:55:00=36.08 2021/08/07 05:00:00=34.9 2021/08/07 05:05:00=35.53 2021/08/07 05:10:00=33.84 2021/08/07 05:15:00=33.17 2021/08/07 05:20:00=32.52 2021/08/07 05:25:00=31.36 2021/08/07 05:30:00=30.92 2021/08/07 05:35:00=31.46 2021/08/07 05:40:00=31.14 2021/08/07 05:45:00=30.22 2021/08/07 05:50:00=31.24 2021/08/07 05:55:00=32.8 2021/08/07 06:00:00=33.21 2021/08/07 06:05:00=32.9 2021/08/07 06:10:00=31.26 2021/08/07 06:15:00=32.64 2021/08/07 06:20:00=34.37 2021/08/07 06:25:00=36.11 2021/08/07 06:30:00=35.11 2021/08/07 06:35:00=33.6 2021/08/07 06:40:00=32.34 2021/08/07 06:45:00=33.82 2021/08/07 06:50:00=35.04 2021/08/07 06:55:00=35.18 2021/08/07 07:00:00=35.24 2021/08/07 07:05:00=36.78 2021/08/07 07:10:00=37.53 2021/08/07 07:15:00=37.86 2021/08/07 07:20:00=36 2021/08/07 07:25:00=36.62 2021/08/07 07:30:00=36.54 2021/08/07 07:35:00=36.62 2021/08/07 07:40:00=38.48 2021/08/07 07:45:00=38.75 2021/08/07 07:50:00=37.04 2021/08/07 07:55:00=36.8 2021/08/07 08:00:00=37.07 2021/08/07 08:05:00=36.86 2021/08/07 08:10:00=35.52 2021/08/07 08:15:00=35.72 2021/08/07 08:20:00=33.87 2021/08/07 08:25:00=32.91 2021/08/07 08:30:00=32.41 2021/08/07 08:35:00=32 2021/08/07 08:40:00=30.93 2021/08/07 08:45:00=32.38 2021/08/07 08:50:00=33.71 2021/08/07 08:55:00=34.74 2021/08/07 09:00:00=35.02 2021/08/07 09:05:00=36.48 2021/08/07 09:10:00=38.15 2021/08/07 09:15:00=39.04 2021/08/07 09:20:00=37.05 2021/08/07 09:25:00=38.82 2021/08/07 09:30:00=39.3 2021/08/07 09:35:00=37.51 2021/08/07 09:40:00=37.04 2021/08/07 09:45:00=36.41 2021/08/07 09:50:00=37.48 2021/08/07 09:55:00=37.6 2021/08/07 10:00:00=35.78 2021/08/07 10:05:00=36.5 2021/08/07 10:10:00=36.48 2021/08/07 10:15:00=35.52 2021/08/07 10:20:00=35.54 2021/08/07 10:25:00=37.04 2021/08/07 10:30:00=35.58 2021/08/07 10:35:00=34.99 2021/08/07 10:40:00=34.38 2021/08/07 10:45:00=34.52 2021/08/07 10:50:00=33.95 2021/08/07 10:55:00=35.12 2021/08/07 11:00:00=33.92 2021/08/07 11:05:00=34.97 2021/08/07 11:10:00=34.83 2021/08/07 11:15:00=34.73 2021/08/07 11:20:00=36.09 2021/08/07 11:25:00=34.8 2021/08/07 11:30:00=33.95 2021/08/07 11:35:00=33.44 2021/08/07 11:40:00=33.24 2021/08/07 11:45:00=32.72 2021/08/07 11:50:00=32.42 2021/08/07 11:55:00=31.86 2021/08/07 12:00:00=31.43 2021/08/07 12:05:00=29.65 2021/08/07 12:10:00=28.31 2021/08/07 12:15:00=27.58 2021/08/07 12:20:00=27.41 2021/08/07 12:25:00=27.62 2021/08/07 12:30:00=27.35 2021/08/07 12:35:00=29.25 2021/08/07 12:40:00=29.54 2021/08/07 12:45:00=29.99 2021/08/07 12:50:00=29.98 2021/08/07 12:55:00=30.85 2021/08/07 13:00:00=31.98 2021/08/07 13:05:00=33.2  Edited August 19, 2021 by rudi Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
Zedna Posted August 19, 2021 Share Posted August 19, 2021 GraphGDIPlus_SaveImage() was added later in this modification by UEZ:   Resources UDF  ResourcesEx UDF  AutoIt Forum Search Link to comment Share on other sites More sharing options...
rudi Posted August 19, 2021 Author Share Posted August 19, 2021 (edited) @Zedna  thanks for your reply, step 1 solved. Any suggestion on howto label the x-axis with date & time, or string values? Finally two images shall represent the last day and the last week as time period.  expandcollapse popup#include "GraphGDIPlus.au3" #include <Date.au3> #include <Misc.au3> Opt("GUIOnEventMode", 1) $GUI = GUICreate("", 600, 600) GUISetState() ;----- Create Graph area ----- $Graph = _GraphGDIPlus_Create($GUI, 40, 30, 530, 520, 0xFF000000, 0xFF88B3DD) ;----- Set X axis range from -5 to 5 ----- _GraphGDIPlus_Set_RangeX($Graph, 0, 300, 10, 1, 0) _GraphGDIPlus_Set_RangeY($Graph, 10, 40, 30, 1, 0) ;----- Set Y axis range from -5 to 5 ----- _GraphGDIPlus_Set_GridX($Graph, 10, 0xFF6993BE) _GraphGDIPlus_Set_GridY($Graph, 5, 0xFF6993BE) ;----- Draw the graph ----- $ini = "Celsius.ini" $Sect = "TBE" WriteSampleINI() $aEntries = IniReadSection($ini, $Sect) _Draw_Graph() While 1 If _IsPressed("1B") Then FinalAction() WEnd Func _Draw_Graph() ;----- Set line color and size ----- _GraphGDIPlus_Set_PenColor($Graph, 0xFF325D87) _GraphGDIPlus_Set_PenSize($Graph, 2) ;----- draw lines ----- $First = True For $i = 1 To $aEntries[0][0] $x = $aEntries[$i][0] $y = $aEntries[$i][1] If $First = True Then _GraphGDIPlus_Plot_Start($Graph, $x, $y) $First = False _GraphGDIPlus_Plot_Line($Graph, $x, $y) _GraphGDIPlus_Refresh($Graph) Next EndFunc ;==>_Draw_Graph Func FinalAction() ;----- close down GDI+ and clear graphic ----- Local $Dir = "C:\temp\Image-Save-Dir" DirCreate($Dir) Local $ImageFile = $Dir & "\Test.jpg" FileDelete($ImageFile) _GraphGDIPlus_SaveImage($ImageFile, $GUI) ShellExecute($ImageFile) _GraphGDIPlus_Delete($GUI, $Graph) Exit EndFunc ;==>FinalAction Func WriteSampleINI() FileDelete($ini) $Sect = "TBE" $StartTime = "2021/08/06 12:05:00" $NextTime = $StartTime $StartTemp = 19.5 $NowTemp = $StartTemp $Min = 19.5 $Max = 19.5 IniWrite($ini, $Sect & "-MinMax", "Min", $Min) IniWrite($ini, $Sect & "-MinMax", "Max", $Max) ; IniWrite($ini,$Sect,$StartTime,$StartTemp) For $i = 1 To 300 $Delta = Round(Random(-2, 2), 2) $NowTemp += $Delta If $NowTemp < 10 Or $NowTemp > 40 Then $NowTemp -= $Delta * 2 $NextTime = _DateAdd("n", 5, $NextTime) IniWrite($ini, $Sect, $i, $NowTemp) ; IniWrite($ini,$Sect,$NextTime,$NowTemp) If $NowTemp < $Min Then $Min = $NowTemp IniWrite($ini, $Sect & "-MinMax", "Min", $Min) EndIf If $NowTemp > $Max Then $Max = $NowTemp IniWrite($ini, $Sect & "-MinMax", "Max", $Max) EndIf Next ; ShellExecute($ini) EndFunc ;==>WriteSampleINI  Edited August 19, 2021 by rudi robertocm 1 Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
jugador Posted August 19, 2021 Share Posted August 19, 2021 (edited) Modified the _GraphGDIPlus_Set_RangeX to plot X-axis Label added $xLableList to upper function to pass X-axis Array expandcollapse popup#include <WinAPISysWin.au3> #include "GraphGDIPlus.au3" Opt("GUIOnEventMode", 1) $GUI = GUICreate("",600,600) GUISetOnEvent(-3,"_Exit") GUISetState() ;----- Create Graph area ----- $Graph = _GraphGDIPlus_Create($GUI,40,30,530,520,0xFF000000,0xFF88B3DD) ;----- Set X axis range from -5 to 5 ----- Local $o_xlabelist[] = ["09.05","09.10","09.15","09.20","09.25","09.30","09.35","09.40","09.45","09.50","09.55"] _GraphGDIPlus_Set_RangeX($Graph, -5, 5, UBound($o_xlabelist), 1, 0, $o_xlabelist) _GraphGDIPlus_Set_RangeY($Graph,-5,5,10,1,1) ;----- Set Y axis range from -5 to 5 ----- _GraphGDIPlus_Set_GridX($Graph,1,0xFF6993BE) _GraphGDIPlus_Set_GridY($Graph,1,0xFF6993BE) ;----- Draw the graph ----- _Draw_Graph() While 1 Sleep(100) WEnd Func _Draw_Graph() ;----- Set line color and size ----- _GraphGDIPlus_Set_PenColor($Graph,0xFF325D87) _GraphGDIPlus_Set_PenSize($Graph,2) ;----- draw lines ----- $First = True For $i = -5 to 5 Step 0.005 $y = _GammaFunction($i) If $First = True Then _GraphGDIPlus_Plot_Start($Graph,$i,$y) $First = False _GraphGDIPlus_Plot_Line($Graph,$i,$y) _GraphGDIPlus_Refresh($Graph) Next EndFunc Func _GammaFunction($iZ) $nProduct = ((2^$iZ) / (1 + $iZ)) For $n = 2 to 1000 $nProduct *= ((1 + (1/$n))^$iZ) / (1 + ($iZ / $n)) Next Return (1/$iZ) * $nProduct EndFunc Func _Exit() ;----- close down GDI+ and clear graphic ----- _GraphGDIPlus_Delete($GUI,$Graph) Exit EndFunc  expandcollapse popup; #FUNCTION# ============================================================================ ; Name...........: _GraphGDIPlus_Set_RangeX ; Description ...: Allows user to set the range of the X axis and set ticks and rounding levels ; Syntax.........: _GraphGDIPlus_Set_RangeX(ByRef $aGraphArray,$iLow,$iHigh,$iXTicks = 1,$bLabels = 1,$iRound = 0) ; Parameters ....: $aGraphArray - the array returned from _GraphGDIPlus_Create ; $iLow - the lowest value for the X axis (can be negative) ; $iHigh - the highest value for the X axis ; $iXTicks - [optional] number of ticks to show below axis, if = 0 then no ticks created ; $bLabels - [optional] 1=show labels, any other number=do not show labels ; $iRound - [optional] rounding level of label values ; ======================================================================================= Func _GraphGDIPlus_Set_RangeX(ByRef $aGraphArray, $iLow, $iHigh, $iXTicks = 1, $bLabels = 1, $iRound = 0, $xLableList = "") If IsArray($aGraphArray) = 0 Then Return Local $ahTicksX, $ahTicksLabelsX, $i ;----- load user vars to array ----- $aGraphArray[6] = $iLow $aGraphArray[7] = $iHigh ;----- prepare nested array ----- $ahTicksX = $aGraphArray[10] $ahTicksLabelsX = $aGraphArray[11] ;----- delete any existing ticks ----- For $i = 1 To (UBound($ahTicksX) - 1) GUICtrlDelete($ahTicksX[$i]) Next Dim $ahTicksX[1] ;----- create new ticks ----- For $i = 1 To $iXTicks + 1 ReDim $ahTicksX[$i + 1] $ahTicksX[$i] = GUICtrlCreateLabel("", (($i - 1) * ($aGraphArray[4] / $iXTicks)) + $aGraphArray[2], _ $aGraphArray[3] + $aGraphArray[5], 1, 5) GUICtrlSetBkColor(-1, 0x000000) GUICtrlSetState(-1, 128) Next ;----- delete any existing labels ----- For $i = 1 To (UBound($ahTicksLabelsX) - 1) GUICtrlDelete($ahTicksLabelsX[$i]) Next Dim $ahTicksLabelsX[1] ;----- create new labels ----- For $i = 1 To $iXTicks + 1 ReDim $ahTicksLabelsX[$i + 1] $ahTicksLabelsX[$i] = GUICtrlCreateLabel("", _ ($aGraphArray[2] + (($aGraphArray[4] / $iXTicks) * ($i - 1))) - (($aGraphArray[4] / $iXTicks) / 2), _ $aGraphArray[3] + $aGraphArray[5] + 10, $aGraphArray[4] / $iXTicks, 13, 1) GUICtrlSetBkColor(-1, -2) Next ;----- if labels are required, then fill ----- Local $b_Flag = False Local $b_XRow If UBound($xLableList) > 0 Then $b_XRow = UBound($xLableList) $b_Flag = True Endif If $bLabels = 1 Then For $i = 1 To (UBound($ahTicksLabelsX) - 1) If $b_Flag Then If $i <= $b_XRow Then If ($xLableList[$i - 1] <> "") Then GUICtrlSetData($ahTicksLabelsX[$i], $xLableList[$i - 1]) Endif Endif Else GUICtrlSetData($ahTicksLabelsX[$i], _ StringFormat("%." & $iRound & "f", _GraphGDIPlus_Reference_Pixel("p", (($i - 1) * ($aGraphArray[4] / $iXTicks)), _ $aGraphArray[6], $aGraphArray[7], $aGraphArray[4]))) Endif Next EndIf ;----- load created arrays back into array ----- $aGraphArray[10] = $ahTicksX $aGraphArray[11] = $ahTicksLabelsX EndFunc ;==>_GraphGDIPlus_Set_RangeX  Edited August 19, 2021 by jugador robertocm 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now