Dual axes, line and column

author(s): Torstein Hønsi

by Vignesh Gopalakrishnan

HTML

<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/export-data.js"></script>
<script src="https://code.highcharts.com/modules/accessibility.js"></script>

<figure class="highcharts-figure">
    <div id="container"></div>
    <p class="highcharts-description">
        Chart showing a combination of a column and a line chart, using multiple
        y-axes. Using multiple axes allows for data within different ranges to
        be visualized together.
    </p>
</figure>

CSS

.highcharts-figure, .highcharts-data-table table {
    min-width: 310px; 
    max-width: 800px;
    margin: 1em auto;
}

#container {
    height: 400px;
}

.highcharts-data-table table {
	font-family: Verdana, sans-serif;
	border-collapse: collapse;
	border: 1px solid #EBEBEB;
	margin: 10px auto;
	text-align: center;
	width: 100%;
	max-width: 500px;
}
.highcharts-data-table caption {
    padding: 1em 0;
    font-size: 1.2em;
    color: #555;
}
.highcharts-data-table th {
	font-weight: 600;
    padding: 0.5em;
}
.highcharts-data-table td, .highcharts-data-table th, .highcharts-data-table caption {
    padding: 0.5em;
}
.highcharts-data-table thead tr, .highcharts-data-table tr:nth-child(even) {
    background: #f8f8f8;
}
.highcharts-data-table tr:hover {
    background: #f1f7ff;
}

JavaScript

Highcharts.chart('container', {
  "chart": {
    "enableDeviation": false,
    "positiveDeviationColor": "",
    "negativeDeviationColor": "",
    "deviationasPercentage": false,
    "type": "column",
    "alignTicks": true,
    "className": "",
    "events": {},
    "ignoreHiddenSeries": true,
    "marginBottom": null,
    "marginLeft": null,
    "marginRight": null,
    "marginTop": null,
    "spacingBottom": null,
    "spacingLeft": null,
    "spacingRight": null,
    "spacingTop": null,
    "pinchType": "x",
    "zoomType": "xy",
    "panning": true,
    "panKey": "shift",
    "plotShadow": false,
    "reflow": true,
    "shadow": false,
    "showaxes": false,
    "resetZoomButton": {
      "position": {
        "align": "right",
        "verticalAlign": "top"
      },
      "theme": {
        "fill": "#FFFFFF",
        "r": 3,
        "style": {
          "color": "#000000"
        },
        "states": {
          "hover": {
            "fill": "#C0C0C0",
            "style": {
              "color": "#000000"
            }
          }
        }
      }
    },
    "backgroundColor": "",
    "borderColor": "",
    "borderRadius": 0,
    "borderWidth": 1,
    "plotBackgroundColor": "#FFFFFF",
    "plotBackgroundImage": "",
    "plotBorderColor": "",
    "plotBorderWidth": 0
  },
  "title": {
    "align": "center",
    "floating": false,
    "margin": 35,
    "text": "Chart Title",
    "verticalAlign": null,
    "style": {
      "color": "#333333",
      "fontWeight": "normal",
      "textDecoration": "normal",
      "fontSize": "18px",
      "fontFamily": "Lucida Grande,Lucida Sans Unicode, Arial, Helvetica, sans-serif",
      "display": "block"
    }
  },
  "subtitle": {
    "align": "center",
    "floating": false,
    "text": "Chart Subtitle",
    "verticalAlign": null,
    "style": {
      "color": "#555555",
      "fontWeight": "normal",
      "textDecoration": "normal",
      "fontSize": "12px",
      "fontFamily": "Lucida Grande,Lucida Sans Unicode,...