Search code examples
primefacesjqplot

PieChartModel's Title is missing when using setExtender("skinPie")


So when I use setExtender("skinPie") to apply the Barcelona skin to my chart it just simply does not show the title anymore. If I comment it out and use the default skin my title shows. Here's a code snippet:

compliance = new PieChartModel();

compliance.set("OK", complianceCount);
compliance.set("NOT OK", nonComplianceCount);

compliance.setExtender("skinPie"); //if i comment this out the title shows
compliance.setTitle("Compliance");
compliance.setLegendPosition("e");

Any help would be greatly appreciated, thanks in advance.


Solution

  • It turns out it's a silly problem, I copied the Javascript from the Barcelona Theme's live demo and they opted to have their own titles so they cleared the titles in the script, see below:

    function skinPie() {
            this.cfg.shadow = false;
            this.cfg.title = ''; //********I just removed this*******//
            this.cfg.seriesColors = ['#03A9F4', '#E91E63', '#4CAF50', '#FFC107'];
            this.cfg.grid = {
                background: '#ffffff',
                borderColor: '#ffffff',
                gridLineColor: '#F5F5F5',
                shadow: false
            };
            this.cfg.axesDefaults = {
                rendererOptions: {
                    textColor: '#666F77',
                }
            };
            this.cfg.seriesDefaults = {
                renderer: $.jqplot.PieRenderer,
                shadow: false,
                lineWidth: 1,
                markerOptions: {
                    shadow: false,
                    size: 7,
                    style: 'circle'
                }
            }
    }
    

    Be sure to clear your browser's cache before testing again as it might let you think the change didn't affect anything but it actually did.