D3库可以与Electron(Atom shell)一起使用吗? [英] Can D3 library be used with the Electron (Atom shell)?

查看:190
本文介绍了D3库可以与Electron(Atom shell)一起使用吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Electron的网站说,用电子制作的应用程序可以访问节点模块。他们可以访问D3库吗?

Electron's website says that the applications made with electron can have access to node modules. Can they have access to the D3 library? If so, how can it be set up?

推荐答案

D3可以作为 Node.js模块,可以导入到要用于呈现可视化应用程序的JavaScript代码中。

D3 is available as a Node.js module that can be imported into the JavaScript code you want to use to render your visualisation application.

有关如何将D3集成到Electron应用程序的示例,请查看我的 D3 Space Filler Explorer 在GitHub上的应用程序。这个应用程序可视化多个D3饼图和D3树形图的磁盘空间使用。

As an example of how to integrate D3 into an Electron application, have a look at my D3 Space Filler Explorer application on GitHub. This application visualises disk space use with multiple D3 pie charts and a D3 treemap.

我觉得有用的一种模式是将SVG元素注入到D3可视化中,在D3示例中通常的方法,它在可视化中创建SVG元素。请参阅/app/js/pie-chart.js和/app/js/treemap-chart.js文件中的此依赖项注入示例。

One pattern I found useful was to inject the SVG element into the D3 visualisation, which differs from the usual approach in D3 examples which creates the SVG element in the visualisation. See examples of this dependency injection in the /app/js/pie-chart.js and /app/js/treemap-chart.js files.

这篇关于D3库可以与Electron(Atom shell)一起使用吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆