使用Primefaces 5.0.4: 考虑下面的情节:
series4.set(6.63,3000);
series4.set(6.72,2997.61);
series4.set(6.446636814,2877.63);
series4.set(6.334959739,2817.19);
series4.set(6.22,2757.15);
series4.set(6.10,2696.57);
series4.set(5.733552319,2515.440226);
series4.set(5.606696386,2455.409765);
series4.set(5.479072175,2395.397663);
series4.set(5.352603164,2335.233212);
series4.set(4.193900165,1789.978504);
series4.set(4.060604311,1729.807258);
series4.set(3.929124422,1669.649482);
series4.set(3.788668332,1609.300613);
series4.set(2.164222404,1007.059336);
series4.set(1.953838367,946.8072057);
series4.set("0.133522135",-143.4140801);
series4.set(0.066135582,-203.4635544);
series4.set(0.002918748,-263.8554871);
series4.set(-0.066141148,-324.5883882);
series4.set(-0.132174572,-385.96192);
series4.set(-0.921089703,-1172.898889);
series4.set(-0.981256764,-1233.287334);
series4.set(-1.043102173,-1293.57028);
series4.set(-1.106574926,-1353.732824);
series4.set(-1.171650937,-1414.056659);
series4.set(-1.870683363,-1958.84943);
series4.set(-1.994795447,-2019.349098);
series4.set(-2.120681016,-2079.613447);
series4.set(-2.263016586,-2140.611887);
series4.set(-3.903208537,-2926.144838);
series4.set(-3.988282377,-2986.30619);
series4.set(-4.007646719,-3000);
series4.set(-3.980604355,-2926.11742);
series4.set(-3.949245994,-2865.626335);
series4.set(-2.115051141,-1354.208708);
series4.set(-2.002115358,-1294.068933);
series4.set(-1.889545833,-1233.82616);
series4.set(-1.783095962,-1173.504591);
series4.set(-0.09267729,339.9711549);
series4.set(-0.022683854,400.0822902);
series4.set(0.051001135,460.082531);
series4.set(0.130141486,520.4650164);
series4.set(1.946266677,1423.95246);
series4.set(2.127407915,1483.979464);
series4.set(2.30500294,1544.046998);
lineModel1.setStacked(true);
lineModel1.addSeries(series4);
Axis xAxis=new CategoryAxis("Xdata");
lineModel1.getAxes().put(AxisType.X, xAxis);
Axis yAxis = lineModel1.getAxis(AxisType.Y);
yAxis.setLabel("YData");
现在我希望程序按照我给出的顺序连接点,这是我将它们添加到我的系列中的顺序。但我确实按排序顺序连接它们。我认为它按x值排序。 有没有办法禁用此自动排序。请建议。
在bean中我将扩展器设置为
lineModel1.setExtender("extend");
在xhtml中:
<p:lineChart id="linear" value="#{catalogChartBean.lineModel1}" title="Linear Chart" />
在js:
function extend(){
this.cfg=$.jqplot(this.cfg.id, this.cfg.data, {sortData:false});
this.cfg.redraw();
}
我不这么认为这个函数被调用了,因为我写了一个简单的window.alert和扩展器dint调用它。
答案 0 :(得分:0)
我想通了,让它发挥作用。
我使用<p:lineChart />
并且无法调用扩展器。不确定为什么?
但是我把它改为<p:chart/>
并且有效。
另外,为了禁用排序我在下面用js通过扩展器。
<script language="javascript" type="text/javascript">
function extnder() {
this.cfg.sortData = false;
}
</script>