我想在我的UI5应用程序中添加一个Gauge图表。我成功地能够用“系列”类型实现图表。所以我能够从manifest.json文件加载libs。但是当我试图实施仪表图时。我得到下面提到的错误。
amcharts.js? eval:174 Uncaught TypeError:d.AmAngularGauge不是构造函数
我正在使用此代码:
var gaugeChart = AmCharts.makeChart( "chartdiv", {
"type": "gauge",
"theme": "light",
"axes": [ {
"axisThickness": 1,
"axisAlpha": 0.2,
"tickAlpha": 0.2,
"valueInterval": 20,
"bands": [ {
"color": "#84b761",
"endValue": 90,
"startValue": 0
}, {
"color": "#fdd400",
"endValue": 130,
"startValue": 90
}, {
"color": "#cc4748",
"endValue": 220,
"innerRadius": "95%",
"startValue": 130
} ],
"bottomText": "0 km/h",
"bottomTextYOffset": -20,
"endValue": 220
} ],
"arrows": [ {} ],
"export": {
"enabled": true
}
} );
在我的视图中,我在VBox中渲染地图。
此致,MS
您没有在代码中实现系列图表,而是在实施仪表图表。该错误告诉您没有包含gauge.js文件。 amcharts.js是不够的,因为它是基本库,而serial.js不包含仪表图表类。确保您的仪表图表中包含以下内容:
<script type="text/javascript" src="https://www.amcharts.com/lib/3/amcharts.js"></script>
<script type="text/javascript" src="https://www.amcharts.com/lib/3/gauge.js"></script>
<!-- if you need other charts like pie, radar, and series include those js files -->
<!-- plugins such as export and dataloader also come after the chart includes -->
通过查看AmCharts的demos page,您可以看到每种类型需要包含哪些图表库。