如何在PrimeFaces中更改Bar Charts Legend的位置?

PS *_*mar 1 charts jsf primefaces

我正在JSF中开发一个Web应用程序,我正在使用PrimeFaces条形图.我想改变传奇的位置.我验证了Primefaces:他们使用的帖子中的Charts和Legend位置,

<p:barChart id="stackedKWH"
            value="#{kwhSalesBeanManager.kwhSalesChart}"
            legendPosition="e" style="height:300px;width:800px"
            title="kWh Sales by Type"
            stacked="true"
            barMargin="10"
            min="0"
            max="125000000"/>
Run Code Online (Sandbox Code Playgroud)

但在primeface 5.1中却没有 <p:barchart/>

<p:chart type="bar" model="#{chartView.barModel}" style="height:300px"/>
Run Code Online (Sandbox Code Playgroud)

我的输出看起来像,

在此输入图像描述

预期产量:

在此输入图像描述

我怎样才能做到这一点?有人建议我正确的方法吗?

Jaq*_*har 5

你可以在bean上做到这一点:

BarChartModel model = new BarChartModel();
model.setLegendPosition("e");
model.setLegendPlacement(LegendPlacement.OUTSIDEGRID);
Run Code Online (Sandbox Code Playgroud)