Sign in to follow this  
Followers 0
kiffab

Graph data

7 posts in this topic

#1 ·  Posted (edited)

Hi Guys

I'm going to try and grab some data from a SQL database table and display visually on AutoIt GUI as a line graph. I'll refresh this every hour or so. Firstly, is this possible? If so, what's the best way to read the data in order to build X and Y axis and also plot the points? ( I know how to do the SQL bit... more interested in the graphing side)

My data will look like this:

Time | Value

9 - 10 | 1420

10 - 11 | 1100

Appreciate any pointers =)

Thanks.

Edited by kiffab

Share this post


Link to post
Share on other sites



kiffab,

I have used the GraphGDIPlus UDF very successfully to graph data. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Hi M23

Are there working examples of this? It looks like what I need but not quite sure how to use it. How would I get my data range, for example?

Thanks.

Share this post


Link to post
Share on other sites

There is a working example in the first post of the page that Melba is directing you to.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Sorry, I just downloaded the file. I'll have a look at this :)

Share this post


Link to post
Share on other sites

Ok, so far I have pulled data from SQL table in order to build the x and y axis. I am using max and min values to determine values for x as this will be a time.

$conn = ObjCreate( "ADODB.Connection" )
$DSN = "DRIVER={SQL Server};SERVER=Server1;DATABASE=DB1;UID=hello;PWD=12345;"
$conn.Open($DSN)

$RS1 = ObjCreate("ADODB.RecordSet")

$RS1.Open("SELECT min(hour) 'min' FROM DB1.dbo.events", $conn)

If $RS1.RecordCount Then
    While Not $RS1.EOF
        $minX = $RS1.Fields("min").value & "00"
        $RS1.MoveNext
    WEnd
EndIf

I then use this:

_GraphGDIPlus_Set_RangeX($Graph,$minX,$maxX,6,1,0)
_GraphGDIPlus_Set_RangeY($Graph,0,2000,5,1,0)

I was then planning to use a SQL statement to identify each point since there will only be one for each hour of the day between 9 and 5.

I'd then plot these points and join the dots.

Does that seem like a sensible way to do things or should I have less SQL interaction? i.e. query db, write to array, use content.

Thanks.

Share this post


Link to post
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
Sign in to follow this  
Followers 0