简体   繁体   English

在 VBscript 中绘制图形

[英]Draw graphs in VBscript

I have a HTML application, partially HTML, partially VBscript, disguised as a form.我有一个 HTML 应用程序,部分是 HTML,部分是 VBscript,伪装成一个表单。 What it does is it opens a few local files, runs a DOS box containing GAWK and presents a text file as its result.它的作用是打开一些本地文件,运行一个包含 GAWK 的 DOS 框,并显示一个文本文件作为其结果。 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.我希望通过让它创建一个位图图像来扩展它,结果是堆积条形图中的结果,例如作为 .BMP 文件。 But I'm stumped.但我很难过。 I haven't the faintest idea where to start.我不知道从哪里开始。

Is javascript an option? javascript是一种选择吗? 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.我已经使用了这个 jquery 插件http://code.google.com/p/flot/几次并且效果很好。

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.我已经有几年没有使用 VBScript 了,我想您可能需要使用某种类型的 active-x 对象来生成图像文件,但我可能错了。

Graphics are beyond the capabilities of VBScript alone.图形超出了 VBScript 单独的能力。 You can try if you find an ActiveX/COM component that can do it for you.如果您找到可以为您做的 ActiveX/COM 组件,您可以尝试。 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.作为替代路线,您可以在某处设置一个使用 URL 参数进行图像处理的 Web 服务(例如 PHP/gdlib)。 Then you would just have to link to the image in your HTA with an <img> tag like you normally would.然后,您只需像往常一样使用<img>标签链接到 HTA 中的图像。

I believe you will be able to use this library http://www.walterzorn.com/jsgraphics/jsgraphics_e.htm in VBScript too.我相信你也可以在 VBScript 中使用这个库http://www.walterzorn.com/jsgraphics/jsgraphics_e.htm 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.绘制图形后,您可以将页面打印到 PDF 打印机(如 cutePDF),以将图像保存到文件中以备后用。

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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