highcharts / highcharts-vue

Other
686 stars 150 forks source link

Highcharts : remove custom legend tooltip from export #143

Closed GeethuJojo closed 4 years ago

GeethuJojo commented 4 years ago

Here id the code

legend: {
    width: 500,
    itemWidth: 250,
    layout: 'horizontal',
    backgroundColor: '#FFFFFF',
    align: 'left',  
    alignColumns:false,                     
    verticalAlign: 'top',
    margin:10,
    itemMarginLeft :2,
    x: 0,
    y:0,
    itemDistance: 2,
    symbolHeight : 10,
    symbolWidth : 10,
    itemStyle : {
        "fontFamily": "'Raleway', sans-serif !important",
        "fontSize"  : "12px !important",
    },
    title : {
        text : null
    },
    useHTML: true,
    labelFormatter: function() {
        var total = 0;
        for(var i=this.yData.length; i--;) { total += this.yData[i]; };
        if ((this.options.custom == "undefined") || (this.options.custom == undefined)) {
            return  '<span class="legend-tooltip">'+total.toLocaleString('en') + " " + this.name.toLowerCase();
        }
        else{
            var color= this.options.custom.type == '+' ? '#8ed64b' : '#ff0112';
            //return  '<span class="legend-tooltip">'+total.toLocaleString('en') + " " + this.name.toLowerCase()  + ' ' + '<span style="color: '+color+'" title="Change from previous period" >'+this.options.custom.change+"</span>";                                          
            return '<span class="legend-tooltip">'+total.toLocaleString('en') + ' ' + this.name.toLowerCase()  + ' ' + '<span class="tooltip-item" style="color: '+color+'">'+this.options.custom.change+'<span class="tooltip-expand-box">Change from previous period</span></span></span>';
        }   
    },
    itemMarginBottom :10

},

And this is the chart

plotted image

Exported chart

exportded image

Issue is tooltip style is broken. no need of tooltip in the image [hover]

how to exclude tooltip in export.

This is not applicable ti labelFormatter ref

Denyllon commented 4 years ago

Hi @GeethuJojo

First of all apologize for the delay in reply, but we've lost tracking of this ticket for some reason. I took a look on your attachments, and I think the problem is not related with the highcharts-vue package, but with Highcharts itself, and the way of how they are actually working. I assume the problem is caused by the fact, that when custom HTML elements are added into the chart, then the exporting.allowHTML parameter should be set to true. Please try to set it and re-open the ticket when the issue will be still noticeable.

API Reference: https://api.highcharts.com/highcharts/exporting.allowHTML

Kind regards!