title: How to sort a grouped bar-chart d3js v4
body: <p>In this <strong><a href="https://bl.ocks.org/LemoNode/d73ef3eb17287b30a87290cce57e2d98" rel="nofollow noreferrer">block</a></strong> <strong>(FIXED)</strong> I've tried to do a sorting function in a similar fashion to <strong><a href="https://bl.ocks.org/LemoNode/73dbb9d6a144476565386f48a2df2e3b" rel="nofollow noreferrer">this</a></strong>.</p>
  
  <p>It technically sorts the bars but not in the expected way, if you check the sorting checkbox and shift years you can see what I mean.</p>
  
  <p>I thought that it had something to do with the fact that it's only sorting based on <code>data</code> and not <code>keys</code> and/or the <code>copy</code> variable but I've tried sorting in all kinds of ways based on the mentioned variables without any success.  </p>
  
  <p>Not sure what I'm missing, appreciate any help!</p>