Issue Description
I created an Ad Hoc View with Dual Level Pie Char. By default, a list of predefined colors are used for slices.
How can I change the color of slices?
Resolution
NOTE: provided solution tested with TIBCO JasperReports® Server v.6.4.0. It requires Javascript files customizations. Make sure to back the files.
Ad Hoc engine uses a list of colors defined in a JavaScript file:
webappsjasperserver-proscriptsadhocintelligentChartpalettedefaultPalette.js
colors: [ '#0d233a', '#2f7ed8', '#910000', '#8bbc21', '#492970', '#ff7f27', '#ffc90e', '#1aadce', '#c42525', '#158349', '#77a1e5', '#c40062', '#dbaa00', '#4572a7', '#aa4643', '#89a54e', '#80699b', '#74462e', '#c03c03', '#b58c00' ],
These colors are used for the inner slices.
For outer slices, there is a calculation to define a brighter color based on the parent color:
webappsjasperserver-proscriptsadhocintelligentCharthighchartsDataMapper.js
brightness = 0.2 - (outerPiecesCounter / rowAxisLeafNode.parent.children.length) / 5; ... color: Highcharts.Color(rowAxisLeafNode.parent.color || colors[0]).brighten(brightness).get()
Ad Hoc supports advanced 'colors' property to extend the default palette:
http://community.jaspersoft.com/wiki/advanced-chart-formatting
If you need just to extend the default palette with your custom colors, you can add colors property with a list of required colors, preferably in hex format.
If you don't want to use the default palette but only your custom colors, you can either
- modify colors [] array in defasultPalette.js
or
- modify highchartsDataMapper.js script by commenting line ~135
HDM.colors = $.extend(_.clone(defaultPalette.colors), advancedColors);
and adding custom code
HDM.colors = advancedColors;
In this way, Ad Hoc will use only palette specified in colors property.
If you use optimized version of scripts, you need either to add _opt=false parameter to the URL or re-compile optimized scripts after the changes as described in the doc:
Ref. Case 01481214
Recommended Comments
There are no comments to display.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now