title: How do I add a secondary Y axis to my vega-lite chart?
body: <p>This question shows a way to add multiple time series to a vega-lite chart:</p>
  
  <p><a href="https://stackoverflow.com/questions/45160007/how-to-plot-several-variables-on-an-axis-with-vega-lite">How to plot several variables on an axis with Vega-Lite?</a></p>
  
  <p>Is there a way to put the second series on the secondary Y axis? I'm talking about putting another Y axis on the right hand side so that the time series can have different scales but still be compared.</p>
  
  <p>The following image demonstrates the kind of chart that I'm after:</p>
  
  <p><a href="https://i.stack.imgur.com/nm6F0.png" rel="noreferrer"><img src="https://i.stack.imgur.com/nm6F0.png" alt="The kind of chart I want to create"></a></p>
  
  <p>Here is an example chart, please show me how to move the second time series to a new Y axis on the right of the chart:</p>
  
  <p><a href="https://vega.github.io/editor/#/gist/vega-lite/ashleydavis/3dbd3b83f2a67da8fe20ef444fd4958e" rel="noreferrer">https://vega.github.io/editor/#/gist/vega-lite/ashleydavis/3dbd3b83f2a67da8fe20ef444fd4958e</a></p>
  
  <p><strong>Update</strong>:</p>
  
  <p>I have partially solved my problem, but not 100%.</p>
  
  <p>By adding "axis" and "orient" fields to my vega-lite chart I've been been able to move the second series to the right hand side as you can see here:</p>
  
  <p><a href="https://vega.github.io/editor/#/gist/vega-lite/ashleydavis/5aea58ee98c2eec9913b309836181a5b" rel="noreferrer">https://vega.github.io/editor/#/gist/vega-lite/ashleydavis/5aea58ee98c2eec9913b309836181a5b</a></p>
  
  <p>The problem I'm having now is that the when I try to create a chart like this with two different time series with values on completely different scales I get something that isn't useful.</p>
  
  <p><a href="https://i.stack.imgur.com/C5UrP.png" rel="noreferrer"><img src="https://i.stack.imgur.com/C5UrP.png" alt="enter image description here"></a></p>
  
  <p>You can see from this chart that both sides of the chart use the same scale and this makes it impossible to compare the data because the first series (which is on a smaller scale) ends up being completely squashed.</p>
  
  <p>You can see the chart from the screenshot here:</p>
  
  <p><a href="https://vega.github.io/editor/#/gist/vega-lite/ashleydavis/af1958d3f22bd876959ebcc97105dd14" rel="noreferrer">https://vega.github.io/editor/#/gist/vega-lite/ashleydavis/af1958d3f22bd876959ebcc97105dd14</a></p>
  
  <p>So the question now is how do I make these axis' independent so the data is overlaid and easily comparable?</p>
  
  <p>(Not that it makes sense to compare the data in this example, but generally I need to be able to do this).</p>