2014-09-04 62 views
0

我正在嘗試將融合圖表加載到xPage中。繼教程http://docs.fusioncharts.com/tutorial-getting-started-your-first-charts-building-your-first-chart.html嘗試在xPages中實現Fusion圖表;圖表不加載

該圖表未加載並顯示圖表加載。在頁面的底部,我在js控制檯中收到了一些錯誤消息。

這是我用於該頁面的代碼。 (URL從實際的URL改變)

<xp:this.resources> 


    <xp:script src="https://URL/Field/fplan.nsf/fusioncharts/js/fusioncharts.js" 
     clientSide="true"> 
    </xp:script> 
<xp:script 
     src="https://URL/Field/fplan.nsf/fusioncharts/js/themes/fusioncharts.theme.fint.js" 
     clientSide="true"> 
    </xp:script> 
</xp:this.resources> 
<xp:scriptBlock type="text/javascript"> 
    <xp:this.value><![CDATA[ 
    FusionCharts.ready(function(){ 
var revenueChart = new FusionCharts({ 
    "type": "column2d", 
    "renderAt": "chartContainer", 
    "width": "500", 
    "height": "300", 
    "dataFormat": "json", 
    "dataSource": { 
     "chart": { 
     "caption": "Monthly revenue for last year", 
     "subCaption": "Harry's SuperMart", 
     "xAxisName": "Month", 
     "yAxisName": "Revenues (In USD)", 
     "theme": "fint" 
    }, 
    "data": [ 
     { 
      "label": "Jan", 
      "value": "420000" 
     }, 
     { 
      "label": "Feb", 
      "value": "810000" 
     }, 
     { 
      "label": "Mar", 
      "value": "720000" 
     }, 
     { 
      "label": "Apr", 
      "value": "550000" 
     }, 
     { 
      "label": "May", 
      "value": "910000" 
     }, 
     { 
      "label": "Jun", 
      "value": "510000" 
     }, 
     { 
      "label": "Jul", 
      "value": "680000" 
     }, 
     { 
      "label": "Aug", 
      "value": "620000" 
     }, 
     { 
      "label": "Sep", 
      "value": "610000" 
     }, 
     { 
      "label": "Oct", 
      "value": "490000" 
     }, 
     { 
      "label": "Nov", 
      "value": "900000" 
     }, 
     { 
      "label": "Dec", 
      "value": "730000" 
     } 
     ] 
    } 

}); 
    revenueChart.render(); 
})]]></xp:this.value> 
</xp:scriptBlock> 

<div id="chartContainer">FusionCharts XT will load here!</div> 

Uncaught TypeError: Cannot set property 'desc' of undefined fusioncharts.js:436(anonymous function) fusioncharts.js:436v.core fusioncharts.js:20v.registrars.module fusioncharts.js:19v.extend.register fusioncharts.js:22(anonymous function) fusioncharts.js:236 Uncaught TypeError: Cannot read property 'fn' of undefined fusioncharts.js:437(anonymous function) fusioncharts.js:437v.core fusioncharts.js:20v.registrars.module fusioncharts.js:19v.extend.register fusioncharts.js:22(anonymous function) fusioncharts.js:437 Uncaught TypeError: undefined is not a function fusioncharts.js:129(anonymous function) fusioncharts.js:129c fusioncharts.js:32H fusioncharts.js:32b.triggerEvent fusioncharts.js:36d.raiseEvent fusioncharts.js:36d.extend.render fusioncharts.js:70(anonymous function) chart.xsp:88(anonymous function)

如果我放棄一個HTML文件到NSF作爲web內容的文件夾,我能夠加載圖表文件,這樣至少我知道fusionchart文件的聲音。

任何幫助如何實現這將不勝感激。

+1

不FusionCharts的使用AMD?在XPage中,AMD加載不適用於Dojo。 – 2014-09-05 04:43:41

+0

從我的理解來看,Fusioncharts不兼容AMD。他們最近從純粹的瑞士法郎變成了純粹的法官。 Sean Cull在過去使用它們發佈了一篇博客文章。沒有意識到AMD用xpages加載。很高興知道謝謝。 – 2014-09-05 14:10:09

+0

我決定去用jQuery.Gantt,它在xpages中很棒。 – 2014-09-05 23:15:23

回答

1

我想我會首先將圖表初始化代碼移動到客戶端腳本庫中,並將其添加爲資源以查看是否有所作爲。

+0

將圖表初始化添加到客戶端庫中看起來沒有任何改變。 – 2014-09-05 16:03:43

1

嘗試按以下方式加載腳本:

<xp:this.resources> 
<xp:headTag tagName="script"> 
<xp:this.attributes> 
<xp:parameter name="type" value="text/javascript" /> 
<xp:parameter name="src" value= 
"https://URL/Field/fplan.nsf/fusioncharts/js/fusioncharts.js" /> 
</xp:this.attributes> 
</xp:headTag> 
<xp:headTag tagName="script"> 
<xp:this.attributes> 
<xp:parameter name="type" value="text/javascript" /> 
<xp:parameter name="src" value= 
"https://URL/Field/fplan.nsf/fusioncharts/js/themes/fusioncharts.theme.fint.js" /> 
</xp:this.attributes> 
</xp:headTag> 
</xp:this.resources> 
+0

是否爲你工作?我決定切換到我能夠實現的開源甘特圖組件。感謝您的答覆! – 2014-10-10 16:06:52