Customize primefaces chart

自古美人都是妖i 提交于 2019-11-27 09:21:14
Aviad

When you use extender you can change everything by js.

Here is an example

<p:lineChart ... extender="chartExtender"/>

And on js file or in the page under Tag:

function chartExtender() {        
 // this = chart widget instance        
 // this.cfg = options        
 this.cfg.grid = {             
        background: 'transparent',
         gridLineColor: '#303030',
         drawBorder: false,
    };
  }

This is just an example.. This will help you to do the rest.

For more recent PF versions, check What is the alternative for the chart extender attribute in PrimeFaces 5.2 and newer Hope that helps :)

I didn't bother to customize the PrimeFaces charts. I opted to use Google charts in my JSF application. It's highly customizable and it's rendered as SVG so additionally you can use CSS to style your graphs. You can have a look at the GChart PrimeFaces extension or simply load the JavaScript customize everything (it's easy and well documented).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!