我们想在我们的 cumulocity Web 应用程序中使用 dc.js,但我们发现了一个尝试这样做的问题。该应用程序可以独立运行,但是当我们想在累积中使用它时,它就不行了。
这是我们的独立代码:
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset='utf-8'>
<title>QWHealth Experiment</title>
<style type="text/css"></style>
<style>
h4 span {
font-size:14px;
font-weight:normal;
}
h2 {
float: right;
}
h2 span {
font-size:14px;
font-weight:normal;
}
</style>
<script src='https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.17/d3.min.js' type='text/javascript'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/crossfilter/1.3.11/crossfilter.min.js' type='text/javascript'></script>
<script src='http://cdnjs.cloudflare.com/ajax/libs/dc/2.0.0/dc.min.js' type='text/javascript'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js' type='text/javascript'></script>
<script src="https://npmcdn.com/tether@1.2.4/dist/js/tether.min.js"></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/js/bootstrap.min.js' type='text/javascript'></script>
<link href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/css/bootstrap.min.css' rel='stylesheet' type='text/css'>
<link href='http://cdnjs.cloudflare.com/ajax/libs/dc/2.0.0/dc.min.css' rel='stylesheet' type='text/css'>
</head>
.....
这是独立的结果:
然后我们尝试在 Cumulocity 中运行它,因为 cumulocity 已经有了 d3.js、bootstrap 等。我们只是修改了脚本加载。
<head>
<meta charset='utf-8'>
<title>QWHealth Experiment</title>
<style type="text/css"></style>
<style>
h4 span {
font-size:14px;
font-weight:normal;
}
h2 {
float: right;
}
h2 span {
font-size:14px;
font-weight:normal;
}
</style>
<script src='https://cdnjs.cloudflare.com/ajax/libs/crossfilter/1.3.11/crossfilter.min.js' type='text/javascript'></script>
<script src='http://cdnjs.cloudflare.com/ajax/libs/dc/2.0.0/dc.min.js' type='text/javascript'></script>
<link href='http://cdnjs.cloudflare.com/ajax/libs/dc/2.0.0/dc.min.css' rel='stylesheet' type='text/css'>
</head>
但是,我们看到 dc.js 加载成功,那么,我错过了什么?
提前致谢!
编辑: