Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Overlapping columns in highchart

Is there a way to create overlapping columns?

For example in this jsFiddle, the blue and the red columns should overlap each other as shown below, with the blue being the one at the back and red in front.

Overlapping columns

To clarify, I don't want stacked columns, both the blue and red columns should start from the xAxis (y=0) and not one over the other

like image 808
Armin Avatar asked Sep 22 '12 04:09

Armin


People also ask

How do you create an overlapping bar chart?

Step 1: Select the cell containing the data. Step 2: Select the 'Insert' Tab from the top and select the bar chart. Step 3: Right-click on one bar and choose the “Change series chart type” option. Step 4: In the change chart dialog box, make sure the Combo category is selected.

What is stack in Highcharts?

Stacked charts are often used to visualize data that accumulates to a sum. This chart is showing data labels for each individual section of the stack.


2 Answers

EDIT Highcharts has introduced plotOptions.column.grouping switch in their version 2.3 to handle exactly this. Refer Garrick's Answer

I will leave below answer as it still helps understand how the groupPadding and pointWidth work.

Original Answer

You are looking for grouped and overlapping columns?

You can achieve this by setting plotOptions.column.groupPadding to 0.5

plotOptions: {
    column: {           
        groupPadding: 0.5   // Exactly overlap
        pointWidth: 20,                                     
    }
},

Here's an image to illustrate how groupPadding works Group Padding

As you see, when groupPadding is 0.5 the column width is compromised to give the desired padding, by specifying the pointWidth you can counter this behavior

like image 183
Jugal Thakkar Avatar answered Nov 07 '22 12:11

Jugal Thakkar


You can also accomplish this by setting grouping: false.

http://jsfiddle.net/garrickcheung/67BkD/19/

like image 20
Garrick Cheung Avatar answered Nov 07 '22 12:11

Garrick Cheung