Jump to content

Legend items spacing/padding


Recommended Posts

Hello, I have a chart and I want to add spacing on the legend items.  I tried to check and modify this using CSS since I am familiar with it but with no luck. Do you have other ideas guys? Can you help me?

Link to comment
Share on other sites

Hello @Kuroshi,

I also tried to use CSS but I believe we the only way to adjust it is by using JavaScript code. I used this and it worked.
 

<script type="text/javascript">
document.addEventListener('DataPageReady', chartUpdateHandler)

function chartUpdateHandler(event) {
 var cleaner = function(interv) {
  clearInterval(interv);
 }

 let interv = setInterval(() => {
  if (!!Highcharts.charts[0]) {
   console.log(Highcharts.charts[0]);
   Highcharts.charts[0].update({
legend: {
        layout: 'vertical',
        itemMarginTop: 5,
        itemMarginBottom: 5,
        padding: 5
        }
   });   
   cleaner(interv);
  }
 }, 200);
}
</script>

I hope this helps.

 

Regards,

Barbie

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...