kiffab Posted August 20, 2012 Posted August 20, 2012 (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 August 20, 2012 by kiffab
Moderators Melba23 Posted August 20, 2012 Moderators Posted August 20, 2012 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 Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
kiffab Posted August 20, 2012 Author Posted August 20, 2012 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.
Moderators JLogan3o13 Posted August 20, 2012 Moderators Posted August 20, 2012 There is a working example in the first post of the page that Melba is directing you to. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
kiffab Posted August 20, 2012 Author Posted August 20, 2012 Sorry, I just downloaded the file. I'll have a look at this
kiffab Posted August 21, 2012 Author Posted August 21, 2012 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.
Zedna Posted August 22, 2012 Posted August 22, 2012 Very simple/nice GDI+ draw curve example is here Resources UDF ResourcesEx UDF AutoIt Forum Search
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