2017-03-01 49 views
0

我们希望在我们的cumulocity web应用程序中使用dc.js,但我们发现尝试这样做的问题。该应用程序独立运行良好,但是当我们想要在累积中使用它时,它不会。将dc.js添加到cumulocity web应用程序

这里是我们的独立代码:

<!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/[email protected]/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> 
..... 

下面是独立的结果是:

enter image description here

然后我们尝试在Cumulocity运行和cumulocity早已d3.js,引导等等。我们只是修改脚本加载。

<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> 

,这是使用CLI命令结果:c8y服务器 enter image description here

然而,我们看到,dc.js加载成功,所以,我缺少什么?

在此先感谢!

编辑:

link to the index-cumulocity.html

link to the index.html which is the standalone app

+0

您的应用程序在任何地方都可以使用吗? – Stilltorik

回答

0

它看起来像dc变量的第一个访问是由它的满载前。也许你需要检查加载文件的顺序(在你的截图中,我看不到你如何加载自己的代码)。

+0

帕维尔,请参阅我的编辑!我添加了代码,以便查看如何以及在何处使用dc调用。 – Jorge

+0

如何在QuarkIoE应用程序中包含index-cumulocity.html?您是否知道您可以将独立应用程序上传为* .zip文件(http://cumulocity.com/guides/users-guide/administration/#creating-an-application)。然后它将从Cumulocity平台提供,但可以使用您自己的所有文件。如果您想让自己的应用成为自定义的Cumulocity应用的一部分,您需要开发一个插件(http://cumulocity.com/guides/web/introduction/)。 –

+0

Pawel,它是一个基于插件的应用程序。你可以给你的邮件吗?我可以向您发送包含所有文件的文件夹。 – Jorge