我希望显示 primefaces 的条形图但修改了 x 轴值,我希望使用以下代码在 x 轴(动态)上显示年份,但不显示年份,而是得到诸如 1,2 之类的值, 3... 在 x 轴上 2010、2011、2012 年,...:
托管豆:
categoryModel = new CartesianChartModel();
objejb=(StockCommodityEJBStateless) new InitialContext().lookup("StockCommodityTest");
ChartSeries scrip1 = new ChartSeries();
scrip1.setLabel(scripSymbol1);
Collection coll=objejb.getScripQtyYearWise(scripID1);
for (Object o : coll) {
Object[] res = (Object[]) o;
Number sum = (Number)res[0];
Object year = res[1];
scrip1.set(year,sum);
}
ChartSeries scrip2 = new ChartSeries();
scrip2.setLabel(scripSymbol2);
Collection coll2=objejb.getScripQtyYearWise(scripID2);
for (Object o : coll2) {
Object[] res = (Object[]) o;
Number sum = (Number)res[0];
Object year = res[1].toString();
scrip2.set(year,sum);
}
categoryModel.addSeries(scrip1);
categoryModel.addSeries(scrip2);
我哪里错了?我该如何解决?