rakeeee
rakeeee

Reputation: 1073

Highcharts exportchart PDF not showing all categories

I am in process of verifying the categories on exported PDF as compared to displayed chart in my setup. But, always i see some category names are missing in exported chart.

How can i make xAxis categories to empty, i mean exported PDF does not contains categories as Jan, Feb etc... in the exported PDF. I have a fiddle here http://jsfiddle.net/p9nt0he9/

 $(function () {
$('#container').highcharts({
    title: {
        text: 'Exports a pdf with name: my-pdf'
    },
    credits: {
        enabled: false
    },

    xAxis: {
        categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
    },

    series: [{
        data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
    }],

    navigation: {
        buttonOptions: {
            enabled: false
        }
    }
});

// the button handler
$('#button').click(function () {
    var chart = $('#container').highcharts();
    chart.exportChart({
        type: 'application/pdf',
        filename: 'my-pdf',
        xAxis: [],
    });
});

});

Can any one help me?

Upvotes: 1

Views: 994

Answers (1)

Sebastian Bochan
Sebastian Bochan

Reputation: 37578

You can use exporting/chartOptions and there in xAxis/labels return empty string in formatter.

exporting:{
        chartOptions:{
            xAxis:[{
                labels:{
                    formatter:function(){
                        return '';
                    }
                }
            }]
        }
    },

Example: http://jsfiddle.net/p9nt0he9/1/

Docs: http://api.highcharts.com/highcharts#exporting.chartOptions

Upvotes: 1

Related Questions