p:图表legendPosition

时间:2015-12-31 10:09:29

标签: jsf primefaces charts

我在折线图中遇到传奇问题。只有两个系列曾经出现过多个传说。enter image description here

我在托管bean中使用了以下代码

transactionModel=initLinearModel();
       transactionModel.setTitle("Daily Transaction Graph for Fiscal Year"+selectedYar);
       transactionModel.setLegendPosition("ne");
       transactionModel.setZoom(true);
       transactionModel.setAnimate(true);    
       transactionModel.setSeriesColors("00ffff,000aaa");
       transactionModel.getAxes().put(AxisType.X, new CategoryAxis(selectedType));
       Axis yAxis=transactionModel.getAxis(AxisType.Y);
       yAxis.setLabel("Transaction");

1 个答案:

答案 0 :(得分:-1)

我错误地将addSeries()插入循环中:

allTransaction = loginBeanLocal.getData(selectedYar); transactionModel = initLinearModel();         transactionModel.setTitle("会计年度的每日交易图" + selectedYar);         transactionModel.setLegendPosition(" NE&#34);         transactionModel.setZoom(真);         transactionModel.setAnimate(真);

    transactionModel.setSeriesColors("00ffff,000aaa");
    transactionModel.setMouseoverHighlight(true);
    transactionModel.getAxes().put(AxisType.X, new CategoryAxis(selectedType));
    Axis yAxis = transactionModel.getAxis(AxisType.Y);
    yAxis.setLabel("Transaction");

for (Object[] obj : allTransaction) {


            series1.set(obj[0], (BigInteger) obj[1]);
            series2.set(obj[0], ((Double) obj[3]) / 1000);

           model.addSeries(series1);
          model.addSeries(series2);

        }

addseries应该保持在循环之外。