MJR
MJR

Reputation: 35

How to set highchart boxplot size

I am making a box plot in highchart, that can show between 1 and 6 objects. Unfortunately, high chart scales the size width the number of objects, so while my chart looks good when there are 6 objects it looks really bad when there are only 1 or 2 because the box plot ends up being too big and stretched horizontally. Is there a way to fix the size so that the boxes look the same regardless of the number of objects?

Upvotes: 0

Views: 421

Answers (1)

magdalena
magdalena

Reputation: 3695

Use maxPointWidth or pointWidth option to control the box plot width.

Highcharts.chart('container', {
  series: [{
    type: 'boxplot',
    maxPointWidth: 50,
    data: [
      [760, 801, 848, 895, 965]
    ]
  }]
});

Demo:

https://jsfiddle.net/BlackLabel/w86xv14d/

API Reference:

https://api.highcharts.com/highcharts/series.boxplot.maxPointWidth https://api.highcharts.com/highcharts/series.boxplot.pointWidth

Upvotes: 1

Related Questions