如何添加Primefaces图表的标签?

时间:2014-03-26 02:52:05

标签: jsf primefaces

我有一个使用PrimeFaces的JSF折线图。我想为x轴和&添加标签。 y轴,例如年份和年份人口。我使用过showLabel:true但它不起作用。是代码,

   <p:lineChart id="chart" value="#{chartBean.linearModel}" xaxisAngle="-90">
       <f:convertDateTime pattern="d-M-yyyy"/>
    </p:lineChart>


function phaseChartExt() {
     this.cfg.axes = {
              xaxis: {
                  renderer: $.jqplot.DateAxisRenderer,
                  rendererOptions: { tickRenderer: $.jqplot.CanvasAxisTickRenderer },
                  tickOptions: {
                      showLabel:true,
                      showGridline: true,
                      formatString: '%H:%M',
                      angle: -90                        
                 }         
             }
             yaxis: {
                 renderer: $.jqplot.DateAxisRenderer,
                 rendererOptions: { tickRenderer: $.jqplot.CanvasAxisTickRenderer },
                 tickOptions: {
                     showLabel:true,
                     showGridline: true,
                     formatString: '%H:%M',
                     angle: -90                        
                }         
    }
         }
}

1 个答案:

答案 0 :(得分:1)

尝试使用

xaxisLabel =“Year”yaxisLabel =“人口”

 <p:lineChart id="chart" value="#{chartBean.linearModel}" xaxisAngle="-90" xaxisLabel="Year" yaxisLabel="Populations">
       <f:convertDateTime pattern="d-M-yyyy"/>
    </p:lineChart>