简体   繁体   中英

PrimeFaces pie chart width always 100%

PrimeFaces pie chart width always 100%. The style is ignored.

<p:pieChart model="#{bean.pieModel}"
            style="width:200px;height:200px" >

Version 11.0.0

I think is to blame here. The style is rendered by the component, but it seems that chart.js changes it. You might want to wrap it in a container and and set with and height to the container. So:

<div style="width:200px;height:200px">
  <p:pieChart model="#{bean.pieModel}"/>
</div>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM