弹药水平规图

时间:2018-09-07 07:44:42

标签: javascript amcharts

我正在尝试制作动态编号为的图表。的值,如图。

enter image description here

序列图中,必须定义图形,因此必须循环数据并创建图形。

然后,有一个可以像这样自定义但垂直的漏斗图。如何使此漏斗图水平?

JSFIDDLE

var chart = AmCharts.makeChart("chartdiv", {
  "type": "funnel",
  "theme": "light",
  "dataProvider": [{
    "title": "Website visits",
    "value": 300
  }, {
    "title": "Downloads",
    "value": 123
  }, {
    "title": "Requested prices",
    "value": 98
  }, {
    "title": "Contacted",
    "value": 72
  }, {
    "title": "Purchased",
    "value": 35
  }, {
    "title": "Asked for support",
    "value": 25
  }, {
    "title": "Purchased more",
    "value": 18
  }],
  "titleField": "title",
  "marginRight": 0,
  "marginLeft": 0,
  "labelPosition": "center",
  "funnelAlpha": 0,
  "valueField": "value",
  "startX": 0,
  "neckWidth": "40%",
  "startAlpha": 0,
  "outlineThickness": 1,
  "neckHeight": "100%",
  "balloonText": "[[title]]:<b>[[value]]</b>",
  "export": {
    "enabled": false
  }
});
#chartdiv {
  width: 100px;
  height: 200px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://www.amcharts.com/lib/3/amcharts.js"></script>
<script src="https://www.amcharts.com/lib/3/funnel.js"></script>
<script src="https://www.amcharts.com/lib/3/plugins/export/export.min.js"></script>
<link rel="stylesheet" href="https://www.amcharts.com/lib/3/plugins/export/export.css" type="text/css" media="all" />
<script src="https://www.amcharts.com/lib/3/themes/light.js"></script>
<div id="chartdiv"></div>

0 个答案:

没有答案