在 VBscript 中绘制图表
我有一个 HTML 应用程序,部分是 HTML,部分是 VBscript,伪装成表单。 它的作用是打开一些本地文件,运行包含 GAWK 的 DOS 框并显示一个文本文件作为其结果。 我希望通过让它创建一个位图图像来扩展它,并在堆叠条形图中显示结果,例如作为 .BMP 文件。 但我很困惑。 我完全不知道从哪里开始。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
JavaScript 是一个选项吗? 这比创建图像文件容易得多。
我使用过这个jquery插件 http://code.google.com/p/flot/ 几次,效果很好。
我已经有几年没有使用 VBScript 了,我认为您可能需要使用某种 active-x 对象来生成图像文件,但我可能是错的。
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.
图形超出了 VBScript 本身的能力。 如果您找到可以为您完成此操作的 ActiveX/COM 组件,您可以尝试一下。 看看谷歌,我的猜测是,它们中的大多数都是相当昂贵的商业产品的简化试用版。 也许这里的其他人知道一个免费的。
作为替代方法,您可以在某个位置设置一个 Web 服务,使用 URL 参数进行图像处理(例如 PHP/gdlib)。 然后,您只需像平常一样使用
标签链接到 HTA 中的图像即可。
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.我相信您将能够使用这个库 http://www.walterzorn.com/jsgraphics/ VBScript 中的 jsgraphics_e.htm 也是如此。 它可用于绘制各种形状的线条、矩形、圆形等。
绘制图形后,您可以将页面打印到 PDF 打印机(如cutePDF),将图像保存到文件中以供以后使用。
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
The Microsoft Scripting Guys came out with an article which discussed his quite a while ago, but it involves using the Excel ActiveX control or the OWC control the article is really detailed in how to do it, look here: http://www.microsoft.com/technet/scriptcenter/topics/activex/chart.mspx
那么,到 2022 年,答案可能是使用 svg 命令从头开始构建一个 html 文件,然后在默认浏览器中打开它。
Well, in 2022 an answer could be to build from scratch an html file with svg commands then open it in the default browser.