Jump to content

How to make graphic line ??


 Share

Recommended Posts

Hi guys,

I've reading helpfile to make graphic, but i how can i convert from some values that i have to become graphic?

Let say i have 5 number: 500 , 503, 509, 502, 506

Thats just number (not coordinate in monitor)

How to convert that values to become graphic (line) like excel do??

 

Thx btw

Link to comment
Share on other sites

If you need it in Excel you could use my ExcelChart UDF.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

hi @water

nope, i dont need in excel.

i want to draw it in my GUI. but i confuse how to convert from "Coordinate" to be "Value".

i just want to make a tiny one in my GUI.

my code so far:

#include <GUIConstantsEx.au3>


GUICreate("My Draw")
GUICtrlCreateGraphic(20, 220, 80, 80)

local $val1 = 919, $val2 = 923, $Val3 = 921, $val4 = 918, $val5 = 922
$1_Val = $Val1 - $val2
$2_Val = $Val1 - $val3
$3_Val = $Val1 - $val4
$4_Val = $Val1 - $val5
GUICtrlSetGraphic(-1, $GUI_GR_DOT, 0, 0)
GUICtrlSetGraphic(-1, $GUI_GR_LINE, 30, ($1_Val*5))
GUICtrlSetGraphic(-1, $GUI_GR_LINE, 60, ($2_Val*5))
GUICtrlSetGraphic(-1, $GUI_GR_LINE, 90, ($3_Val*5))
GUICtrlSetGraphic(-1, $GUI_GR_LINE, 120, ($4_Val*5))
GUISetState(@SW_SHOW)

While 1

    $nMsg = GUIGetMsg()
    Select
        Case $nMsg = $GUI_EVENT_CLOSE
            Exit
         EndSelect
WEnd

 

Link to comment
Share on other sites

Maybe something like this?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

You need always 2 coordinates for a pixel coordinate -> x and y.

What you do with the numbers makes no sense to  me.

 

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to comment
Share on other sites

Did you mean this?

lGl9tzs.png

Saludos

 

yes... like that..

in excel we do in "number" to make Grafic like above.

but in autoit is in "coordinate (X,Y)" so its difficult when i have some array number above 2000.

i just want to simulate the curve of graphic (visual only)

Link to comment
Share on other sites

Evenm in Excel you need two coordinates (x and y). In the above example 1, 2, 3, 4 are the values for the x-axis, 30, 60, 90, 120 the values for the y-axis.

Your data from the OP would be 1, 2, 3, 4, 5 for the x-axis and 500, 503, 509, 502, 506 for the y-axis.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Creating graphic is one thing. But where do you want to use it? In an AutoIt GUI, in Excel, do you need to store it as JPEG, PNG ...?
The solution to be used depends on this questions.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Then the UDF mentioned in post #4 or this one should do the trick.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Here is an example of a plot in a graphic control (ctrl), on a graphical user interface (GUI).

#include <GUIConstantsEx.au3>
#include <Array.au3>
#include <StaticConstants.au3>

Local $aNumbers[5] = [500, 503, 509, 502, 506]
Local $iW = 600, $iH = 400
Local $Max = _ArrayMax($aNumbers), $Min = _ArrayMin($aNumbers)
;ConsoleWrite($Max & "  " & $Min & @LF)

Local $iXAxisSpacing = ($iW - 60) / (UBound($aNumbers) - 1) ; Graphic ctrl will be positioned 40 pixels from LH border of GUI & 20 pixels from RH border of GUI (40+20=60).
Local $iYAxisSpacing = ($iH - 74) / ($Max - $Min) ; Graphic ctrl will be positioned 30 pixels from top border of GUI & 44 pixels from bottom border of GUI (30+44=74).

Local $hGui = GUICreate("The Graph", $iW, $iH)

; X-axis labels
For $i = 0 To UBound($aNumbers) - 1
    GUICtrlCreateLabel($i + 1, ($i * $iXAxisSpacing) + 40 - 3, $iYAxisSpacing * ($Max - $Min + 1))
Next
; Y-axis labels
For $i = 0 To $Max - $Min
    GUICtrlCreateLabel($Max - $i, 4, $iYAxisSpacing * $i + 30 - 5)
Next

; Graph's Name
GUICtrlCreateLabel("Graph's Name - Numbers vs. Equal Intervals", $iW / 2 - 200, $iH - 25, 400, 23, $SS_CENTER)
GUICtrlSetFont(-1, 12, 800)

; Create Graphic Control
$idCtrlGraphic = GUICtrlCreateGraphic(40, 30, $iW - 60, $iH - 74)

; Graph area outline
GUICtrlSetGraphic(-1, $GUI_GR_RECT, 0, 0, (UBound($aNumbers) - 1) * $iXAxisSpacing, $iYAxisSpacing * ($Max - $Min))

GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0xCCCCCC) ; Set light-gray line colour
; X-axis lines
For $i = 0 To UBound($aNumbers) - 1
    GUICtrlSetGraphic($idCtrlGraphic, $GUI_GR_MOVE, ($i * $iXAxisSpacing), $iYAxisSpacing * ($Max - $Min) + 3)
    GUICtrlSetGraphic(-1, $GUI_GR_LINE, ($i * $iXAxisSpacing), 0)
Next
; Y-axis lines
For $i = 1 To $Max - $Min - 1
    GUICtrlSetGraphic($idCtrlGraphic, $GUI_GR_MOVE, 0, $iYAxisSpacing * $i)
    GUICtrlSetGraphic(-1, $GUI_GR_LINE, (UBound($aNumbers) - 1) * $iXAxisSpacing, $iYAxisSpacing * $i)
Next

; Plot Graph
GUICtrlSetGraphic(-1, $GUI_GR_COLOR, 0x0000FF) ; Set 0x0000FF(blue) line colour
GUICtrlSetGraphic($idCtrlGraphic, $GUI_GR_MOVE, 0, ($Max - $aNumbers[0]) * $iYAxisSpacing)
For $i = 0 To UBound($aNumbers) - 1
    GUICtrlSetGraphic($idCtrlGraphic, $GUI_GR_LINE, ($i) * $iXAxisSpacing, ($Max - $aNumbers[$i]) * $iYAxisSpacing)
    GUICtrlSetGraphic($idCtrlGraphic, $GUI_GR_DOT, ($i) * $iXAxisSpacing, ($Max - $aNumbers[$i]) * $iYAxisSpacing)
Next

GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Select
        Case $nMsg = $GUI_EVENT_CLOSE
            Exit
    EndSelect
WEnd

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...