How do I customize Ad Hoc Chart colors in Jasper 5.0.1

0

I am looking to customize a few things about how the ad-hoc editor renders charts.  Two particular items are to:

1.) customize the color palette used for the bars/columns.

2.) remove the rendering of a legend

How do I do this?  The concept of Chart themes do not appear to have any impact upon ad hoc charts (and I can see this mentioned in the admin guide: "Chart themes do not apply to Ad Hoc chart views").  And my attempts to make use of the defaultTheme property in applicationContext-adhoc.xml don't seem to impact anything.  From looking in the code, I am wondering if the themes defined in the ad hoc directory (i.e. ocean, olive, forest, etc...) are no longer used in 5.0.1 anyway.

Can anyone shed some light here?

Thanks!

ccrabb's picture
3
Joined: Oct 29 2012 - 1:04pm
Last seen: 5 years 2 months ago

1 Answer:

0

1) You can modify default color palette used for Ad Hoc View based charts in scripts/adhoc/highchart.datamapper.js file:

    //
    // the highcharts default color palette
    //
    colors: [
                          '#4572A7',
                          '#AA4643',
                          '#89A54E',
                          '#80699B',
                          '#3D96AE',
                          '#DB843D',
                          '#92A8CD',
                          '#A47D7C',
                          '#B5CA92'
                        ],
 
You can modify these colors, add new and/or remove existing ones.
 
2) You can disable legend by adding 
        legend: {
            enabled: false
        },
option to default options used in scripts/adhoc/highcharts.api.js file:
 
var highchartsOptions = {
            chart: {
                renderTo: 'chartContainer',
                zoomType: 'xy',
                jrstype: chartState.chartType,
                type: HighchartsDataMapper.cast[chartState.chartType]
            },
       legend: {
            enabled: false
        },
 
            credits: {
                enabled: false
            },
 
            tooltip: {
                valueDecimals: 2
            },
 
            title: {
                // Skip internal Highcharts title.
                text: null
            }
        };

Have in mind that changes will be applied to all Ad Hoc View based charts.

yplakosh's picture
Joined: Jun 23 2009 - 9:54am
Last seen: 1 month 1 week ago
Feedback
randomness