使用dojo前端highcharts


<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.10.4/dojo/dojo.js" data-dojo-config="async: true"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<title>Tutorial: Hello Dojo!</title>
</head>
<body>
<h1 id="greeting">Hello</h1>
<!-- load Dojo -->
<script>
require([
'dojo/dom',
'dojo/dom-construct'
], function (dom, domConstruct) {
var greetingNode = dom.byId('greeting');
domConstruct.place('<em> Dojo!</em>', greetingNode);
});
</script>
<div id="container" style="width:100%; height:400px;"></div>
<script>
document.addEventListener('DOMContentLoaded', function () {
const chart = Highcharts.chart('container', {
chart: {
type: 'bar'
},
title: {
text: 'Fruit Consumption'
},
xAxis: {
categories: ['Apples', 'Bananas', 'Oranges']
},
yAxis: {
title: {
text: 'Fruit eaten'
}
},
series: [{
name: 'Jane',
data: [1, 0, 4]
}, {
name: 'John',
data: [5, 7, 3]
}]
});
});
</script>
</body>
</html>

有谁知道我如何将highcharts集成到dojo前端吗?我收到的这个代码的错误信息是…

Uncaught ReferenceError: Highcharts is not defined at HTMLDocument.<anonymous> dojo.html:24:27

最终我将不得不得到这个工作的ESRI web应用程序构建器是建立在dojo上,所以我希望dojo版本是相同的。谁能告诉我怎么检查这个?我知道2014年为此制作了一个适配器(https://github.com/ben8p/highcharts.com-dojo-adapter),但是我找不到关于如何使用它的文档,并且这个repo的所有者无法提供进一步的帮助,因为他们已经有一段时间没有在这个项目上工作了。

提前干杯感谢

官方不支持使用dojo和Highcharts。它似乎可以与Highcharts 5一起工作,但始终建议使用最新版本。

<script src="https://code.highcharts.com/5/highcharts.js"></script>

演示:https://jsfiddle.net/BlackLabel/wy3mu4pt/

highcharts的Dojo适配器是我们的社区包装器之一。正如我在github项目中注意到的那样,它是用Highcharts 3.0.7版本进行测试的,所以它可能与我们最新的Highcharts版本不兼容。获得特定dojo适配器问题的答案的唯一可能性是与作者联系。

最新更新