我正在使用 QJplot 在 XPages 中绘制图表。之前它工作正常,直到我复制了整个过程,即提取数据的按钮、绘制数据的按钮等。现在由于某种原因,我不断收到一条错误消息,提示“更新某些页面时发生错误。$ 不是一个功能。” 当我在浏览器中进行预览并查看错误控制台时,它会突出显示“$(document).ready(function(){”
在工作版本中,下面的代码是相同的,唯一的区别是值是从不同的视图中提取的。
`<xp:scriptBlock id="scriptBlock" rendered="true">
<xp:this.value>
<![CDATA[$(document).ready(function(){
var line1 = #{javascript:return compositeData.Temp};
var line2 = #{javascript:return compositeData.MaxTemp};
var line3 = #{javascript:return compositeData.MinTemp};
var ticks1 = #{javascript:return compositeData.Time};
var plot1 = $.jqplot('chart3', [line1,line2,line3], {
title: '#{javascript: return compositeData.title}',
animate:#{javascript:return compositeData.animated},
seriesDefaults: {
renderer: $.jqplot.LineRenderer,
rendererOptions:{lineMargin: 25},
pointLabels:{show:true, stackedValue: true}
},
series:[
{label:'#{javascript:return compositeData.legendTemp}'},
{label:'#{javascript:return compositeData.legendMaxTemp}'},
{label:'#{javascript:return compositeData.legendMinTemp}'},
],
legend: {
show: #{javascript:return compositeData.legendShow},
placement: '#{javascript:return compositeData.legendPlacement}'
},
axes: {
xaxis:{
label: "Time (min)",
pad: 0,
renderer:$.jqplot.CategoryAxisRenderer,
ticks: ticks1
},
yaxis:{
label: "Temperature (Deg. C)"
}
}
});
});
]]>
</xp:this.value>
</xp:scriptBlock>`
从视图中提取值的代码也在工作。不起作用的按钮是应该绘制图形的按钮。
<xp:button
value="Replot Chart" id="refresh_code_plot">
<xp:eventHandler
event="onclick" submit="true" refreshMode="partial"
refreshId="code_plot">
</xp:eventHandler>
</xp:button>
code_plot 是包含 scriptBlock 的自定义控件。它通过此代码链接到 XPage
<xc:code_plot
id="code_plot" legendMaxTemp="Upper Threshold"
legendMinTemp="Lower Threshold" legendTemp="Data"
title="Logger Data (Temperature)" cssStyle="width:900px;">
<xc:this.animated><![CDATA[#{javascript:getComponent("animated").getValue();}]]></xc:this.animated>
<xc:this.Temp><![CDATA[#{javascript:getComponent("extracted_Temp").getValue();}]]></xc:this.Temp>
<xc:this.MaxTemp><![CDATA[#{javascript:getComponent("extracted_MaxTemp").getValue();}]]></xc:this.MaxTemp>
<xc:this.MinTemp><![CDATA[#{javascript:getComponent("extracted_MinTemp").getValue();}]]></xc:this.MinTemp>
<xc:this.legendShow><![CDATA[#{javascript:"true";}]]></xc:this.legendShow>
<xc:this.stackedSeries><![CDATA[#{javascript:getComponent("stackSeries").getValue();}]]></xc:this.stackedSeries>
<xc:this.ticks><![CDATA[#{javascript:getComponent("extracted_Time").getValue();}]]></xc:this.ticks>
<xc:this.Time><![CDATA[#{javascript:getComponent("extracted_Time").getValue();}]]></xc:this.Time>
<xc:this.legendPlacement><![CDATA[#{javascript:getComponent("extracted_Time").getValue()}]]></xc:this.legendPlacement>
</xc:code_plot>
这有什么明显的错误吗?