私はPrimeFaces棒グラフモデルで作業していましたが、今は自分の神経に慣れています。設定チャートの値がどのようになっているのか分かりません。例えばabcとxyzのために閉じられたものですが、それはxyzのために開いているものと閉じたものを表示していますが、ABCは無視されます。私はp:グラフバーのChartSeriesが同期していない
barModel.addSeries(open); barModel.addSeries(close);
に
barModel.addSeries(close); barModel.addSeries(open);
の位置を変更する場合、それはオープン一つを示し、1は、ABC、XYZないため閉鎖しました。
は、ここでは、
public BarChartModel getBarModel() {
barModel=new BarChartModel();
ChartSeries open = new ChartSeries();
open.setLabel("OPEN");
ChartSeries close = new ChartSeries();
close.setLabel("Close");
open.set("abc", 1);
close.set("xyz", 1);
barModel.addSeries(close);
barModel.addSeries(open);
barModel.setMouseoverHighlight(false);
barModel.setShowPointLabels(false);
barModel.setTitle("Incident_application");
barModel.setLegendPosition("ne");
barModel.setShowDatatip(false);
barModel.setShowPointLabels(true);
barModel.setExtender("chartExtender");
barModel.setSeriesColors("A2CC39,1B75BA");
Axis xAxis = barModel.getAxis(AxisType.X);
xAxis.setLabel("Applications");
barModel.setAnimate(true);
Axis yAxis = barModel.getAxis(AxisType.Y);
yAxis.setLabel("No. of Incident");
yAxis.setMin(0);
yAxis.setMax(20);
yAxis.setTickInterval("10");
return barModel;
}
を最初に私のgetBarModel()だとここXHTMLの下に追加されている予想と実績の
<h:outputScript library="primefaces" name="jquery/jquery.js" target="head" />
<h:outputScript library="primefaces" name="jquery/jquery-plugins.js" target="head" />
<style type="text/css">
table.jqplot-table-legend {
border: none;
font-size: x-large;
}
div.jqplot-table-legend-swatch
{
width: 2vw;
height: 2vh;
}
div.jqplot-gridData{
display:none;
}
div.jqplot-xaxis-tick{
font-weight:bold !important;
}
.jqplot-axis.jqplot-xaxis{
font-weight:bold;
}
.jqplot-point-label {
font-size: 300%;
color: black;
font-weight: bold;
}
.jqplot-target{
color:black !important;
}
</style>
<script>
function chartExtender() {
this.cfg.grid = {
background: 'transparent',
gridLineColor: '#303030',
drawBorder: false,
};
}
</script>
<h:form id="barChart">
<p:chart id="bar" type="bar" model="#{incidentBarChartController.barModel}" />
<p:poll interval="10" global="false" update="barChart"/>
</h:form>
</h:body>
スナップショットです。
編集
open.set("abc", 1);
open.set("xyz",0);
close.set("xyz", 1);
close.set("abc", 0);
を追加した後、私はまだ変な結果、すなわち オープン1と1がxyzと0オープンのため休業を取得し、0がxyzのため閉鎖。
各セット/シリーズに各キーの値を与える必要があります。また、 'open.set(" xyz "、0); close.set(" abc "、0);'(おそらく 'null'が動作する)を追加してください。または、これはエクステンダを介してjqplotレベルで設定する必要があります – Kukeltje
これは動的データのために複雑すぎることになります。 – Learner
なぜですか?キーはある意味で「順序付けられていますか?または、注文に関係するものはありますか? 1つのセット内のキーを正しい順序で組み合わせることが唯一の「課題」です。その後、そのセットをループして追加し、他のセットに欠けているものを追加することは難しくありません。 PFまたはjqPlotで解決できません。彼らは2つのセットのどれが正しい順序を含んでいるかを知ることができない。セット1が "a $#"で始まり、セット2が "a#$"で始まるとします。 "String"に従っていますが、 "xyz"は "abc"の前に来なければなりませんか? – Kukeltje