Home » excel » plot – Excel – two graphs in one (side by side)

plot – Excel – two graphs in one (side by side)

Posted by: admin April 23, 2020 Leave a comment

Questions:

I have two graphs in Excel, but I want to merge the charts into one graph. As you can see, I have reduced the size of the chart in graph1 and I want to move the chart in the graph2 into the empty space in graph1

enter image description here

How to&Answers:

I think there are many ways to do this in basic excel like jrichall showed you but If you are willing to use an excel add-in to create this double chart, you could try FunFun.

It allow you to code javascript in excel, merging two charts in one is pretty easy in programming languages such as javascript.

Here is a working code I have written for you:

https://www.funfun.io/1/#/edit/5a3d0933b848f771fbcdec96

As you can see, I use a Json file to acquire the data used in the spreadsheet. Once the data is “stored”, I can use it with javascript and create my charts.

I use Chart.js library to create those two charts, I basically copied this code twice to get two chart (I just changed the data and the word "bar" by "line"):

var barChart = new Chart(ctx, {
    type: "bar",
    data: {
      // x axis represented by labels
      labels: [1, 2, 3, 4, 5, 6],
        datasets: dataset
    },
    options: {
      legend: {
      display: false
    },
      scales: {
        yAxes: [
          {
            ticks: {
              min: 0,
              max: 10
            }
        }
        ]
      }
    },
    animation: false
});

The documentation of Chart.js is pretty good and has a lot of examples for different type of charts.

Once you are satisfied with your chart, you can load it in excel by pasting the URL in the Funfun add-in. Here is how it looks like:

final

I used a css file to correctly align the title (.label).

Disclosure : I’m a developer of funfun

Answer:

I think a little more info would help. How is your data set up? Are you using pivot tables / pivot charts? I think I can help once I get a better idea of where your data is coming from and how you have it set up.

Edit to add example of how I work with charts:
Multi-graph chart

Second Edit:
Multi Chart 2

Answer:

Unless I missed something above, I think that we can make this a bit simpler by editing your chart as follows:

  • Select Chart Tools in the ribbon
  • Select ‘Change Chart Type` icon
  • Select Combo (last option)
  • Change one of the axes to be a Secondary axis and change type to Line instead of Bar.

Edit Chart Type

Combined result