rudi Posted July 25, 2023 Share Posted July 25, 2023 Hello, for some informational html page I would like to plot a line graph from inside an autoit script. I've used before the GraphGDIplus UDF, to display a line graph in an Autoit GUI (different task). The Graph shall be saved to a JPG file only, no displaying is required (script is running as a service). I'd just like to ask, if someone is aware of other approaches to do so, maybe some new, now buildin functionality of Autoit? TIA, Rudi. Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
junkew Posted July 26, 2023 Share Posted July 26, 2023 Create an svg file https://www.w3schools.com/graphics/svg_line.asp argumentum and Zedna 2 FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
KaFu Posted July 28, 2023 Share Posted July 28, 2023 (edited) When using GraphGDIplus UDF you can save the GUI directly after drawing the graph with _Draw_Graph() by adding something like this: #include <ScreenCapture.au3> _ScreenCapture_CaptureWnd(@ScriptDir & "\_graph.png", $GUI) I recommend to use png instead of jpg, because GDI might distort colors for jpg output. Edit: I saw that the GUI must be visible for this to work. But looking at the UDF I saw that it's possible to access the backbuffer directly, even if the GUI is not visible the graph is there. $Graph = _GraphGDIPlus_Create($GUI, 40, 30, 530, 520, 0xFF000000, 0xFF88B3DD) ... ... _Draw_Graph() ; directly after draw call _GDIPlus_ImageSaveToFile($Graph[16], @ScriptDir & "\_graph.png") Edited July 28, 2023 by KaFu Zedna 1 OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
ioa747 Posted July 30, 2023 Share Posted July 30, 2023 (edited) I don't know if it works for you. I mention this as an idea #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include <Excel.au3> Global $oExcel = _Excel_Open() Global $oWorkbook = _Excel_BookNew($oExcel) Global $aData[][] = [ _ ["Month", "Bears", "Dolphins", "Whales"], _ ["jan", 8, 150, 80], _ ["feb", 54, 77, 54], _ ["mar", 93, 32, 10], _ ["apr", 116, 11, 76], _ ["may", 137, 6, 93], _ ["jun", 184, 1, 72]] _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $aData, "A1") Global $oChart = $oWorkbook.Activesheet.ChartObjects.Add(300, 10, 600, 400) Global $iRow = UBound($aData) Global $iCol = UBound($aData, 2) Global $sRng = "A1:" & _Excel_ColumnToLetter($iCol) & $iRow $oChart.Chart.SetSourceData($oWorkbook.Activesheet.Range($sRng)) $oChart.Chart.ChartType = 65 ;65 xlLineMarkers - Line with Markers. ;https://learn.microsoft.com/en-us/office/vba/api/excel.xlcharttype ;~ $oChart.Chart.Export(@ScriptDir & "\export_chart.gif", "GIF") $oChart.Chart.Export(@ScriptDir & "\export_chart.jpg", "JPG") Edited July 30, 2023 by ioa747 UpDate Zedna 1 I know that I know nothing Link to comment Share on other sites More sharing options...
rudi Posted August 8, 2023 Author Share Posted August 8, 2023 Thanks for the input to all of you! Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
water Posted August 8, 2023 Share Posted August 8, 2023 BTW: There is an ExcelChart UDF available. 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 More sharing options...
rudi Posted August 8, 2023 Author Share Posted August 8, 2023 Thanks for pointing out this UDF to do Excel charts. I will give it a try, but basically I would prefer to create the required JPG file without additional software packages to be applied first. Like Microsoft Office (Excel) Earth is flat, pigs can fly, and Nuclear Power is SAFE! 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