Jump to content
Changes to the Jaspersoft community edition download ×

How do I customize Ad Hoc Chart colors in Jasper 5.0.1


ccrabb

Recommended Posts

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!

Link to comment
Share on other sites

  • 1 year later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...