简体   繁体   English

如何使用 JS 中的数据动态创建条形图

[英]How can I create a bar graph dynamically using data in JS

Can someone please suggest how I can create a bar graph, dynamically in Javascript.有人可以建议我如何在 Javascript 中动态创建条形图。 Below is the design that I am trying to achieve.下面是我想要实现的设计。 I did come across Google Charts , but couldn't figure out ways to acheive the below deisgn style.我确实遇到过Google Charts ,但无法找到实现以下设计风格的方法。

在此处输入图像描述

D3.js is a long-standing and very popular solution for all kinds of dynamic charts and graphs. D3.js是一种长期流行的各种动态图表和图形的解决方案。

Check out the gallery and search for the word bar to find examples that might fit your use case.查看图库并搜索单词栏以查找可能适合您的用例的示例。

You might also just google "d3js" and words relevant to your problem.您也可以只搜索“d3js”和与您的问题相关的词。 In your case, this is really a type of "gauge", and when I search "d3js" and "gauge", a few examples come up that may be closer to your data type, though maybe not exactly in that style.在您的情况下,这实际上是一种“仪表”,当我搜索“d3js”和“仪表”时,会出现一些可能更接近您的数据类型的示例,尽管可能不完全是那种风格。

D3.js is very configurable though. D3.js 是非常可配置的。 If you don't find something out-of-the-box, you should have the tools to make it work.如果你没有找到开箱即用的东西,你应该有工具让它工作。

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

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