简体   繁体   中英

Draw graphs in VBscript

I have a HTML application, partially HTML, partially VBscript, disguised as a form. What it does is it opens a few local files, runs a DOS box containing GAWK and presents a text file as its result. I wish to expand upon it by letting it create a bitmap image with the results in a stacked bar graph, for instance as a .BMP file. But I'm stumped. I haven't the faintest idea where to start.

Is javascript an option? That would be a lot easier than creating an image file.

I have used this jquery plugin http://code.google.com/p/flot/ a few times and works well.

I have not used VBScript for a few years now, think you would probably need to use an active-x object of some kind to generate an image file, but I could be wrong there.

Graphics are beyond the capabilities of VBScript alone. You can try if you find an ActiveX/COM component that can do it for you. Looking into Google, my guess is that most of them come as dumbed-down trial versions of quite expensive commercial products. Maybe someone else here knows one that is for free.

As an alternative route, you could set up a web service somewhere that does the image processing (for example PHP/gdlib) using URL parameters. Then you would just have to link to the image in your HTA with an <img> tag like you normally would.

I believe you will be able to use this library http://www.walterzorn.com/jsgraphics/jsgraphics_e.htm in VBScript too. It can be used to draw all kinds of shapes lines, rectangles, circles etc

Once you have drawn the graph you can print the page to a PDF printer (like cutePDF) to get the image onto a file for later use.

Microsoft Scripting Guys 发表了一篇文章,讨论了他很久以前,但它涉及使用 Excel ActiveX 控件或 OWC 控件,该文章非常详细地介绍了如何操作,请看这里:http: //www.microsoft .com/technet/scriptcenter/topics/activex/chart.mspx

好吧,在 2022 年,答案可能是从头开始构建一个带有 svg 命令的 html 文件,然后在默认浏览器中打开它。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM