2
votes

I am working on a highcharts graph where the height of the graph is very less, maybe around 150px. In such a case, the export drop-down gets clipped off. Fiddle: Export drop-down clipped off. Is there a way we can resize the drop-down for smaller charts

 exporting: {    enabled: true  }. 

This is the only content I have in my exporting object. Any help would be appreciated.

3

3 Answers

0
votes

Have you tried with exporting.buttons.contextButton.height, for example:

  exporting: {
    enabled: true,
    buttons: {
        contextButton: {
            height: 20,
            width: 20,
            symbolSize: 12,
            symbolX: 10,
            symbolY: 10,
            symbolStrokeWidth: 1
      }
    }
  },

or

exporting: {
    buttons: {
        contextButton: {
            symbol: 'download',
            symbolSize: 10,
        }
    }
}

using appropriate size, width, height values.

0
votes

Img

I manage to compressed the options of export button by

1> By css removing padding

.highcharts-menu-item{
  padding:0px 2px 0px 2px !important
}

2> By removing <hr> tag as one of options

var theExportOptions = Highcharts.getOptions().exporting.buttons.contextButton.menuItems;
theExportOptions.splice(0, 2);

3> Optional reduce size of button

navigation: {
    buttonOptions: {
        height: 20,
        width: 24,
        symbolSize: 12,
        symbolX: 10,
        symbolY: 10,
        symbolStrokeWidth: 2
    }
}

var theExportOptions = Highcharts.getOptions().exporting.buttons.contextButton.menuItems;
theExportOptions.splice(0, 2);
Highcharts.chart('container', {
  title: {
    text: 'Exporting dropdown clipped for smaller charts'
  },
  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]
  }],

  exporting: {
    enabled: true,

  },
  navigation: {
    buttonOptions: {
      height: 20,
      width: 24,
      symbolSize: 12,
      symbolX: 10,
      symbolY: 10,
      symbolStrokeWidth: 2
    }
  }

});
.highcharts-menu-item {
  padding: 0px 2px 0px 2px !important
}
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>


<div id="container" style="width: 500px; height: 150px; margin: 0 auto"></div>

Fiddle demo

0
votes

You can show this element by simple CSS:

#container> .highcharts-container {
  overflow: visible!important;
}

Demo: https://jsfiddle.net/BlackLabel/e7u1jdrx/26/