Basic bar

author(s): Torstein Hønsi

by Pawan Jadhav

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">
        Bar chart showing horizontal columns. This chart type is often
        beneficial for smaller screens, as the user can scroll through the data
        vertically, and axis labels are easy to read.
    </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":{
      "inverted":false,
      "backgroundColor":"rgba(255,255,255,0)",
      "plotBackgroundColor":"rgba(255,255,255,0)",
      "zoomType":"xy",
      "resetZoomButton":{
         "theme":{
            "visibility":"hidden"
         }
      },
      "alignTicks":true,
      "options3d":{
         "enabled":false
      }
   },
   "title":{
      "text":".",
      "style":{
         "color":"rgba(255, 255, 255, 0)",
         "fontSize":"1px"
      }
   },
   "tooltip":{
      "enabled":true,
      "borderWidth":1,
      "borderRadius":1,
      "backgroundColor":"#ffffff",
      "style":{
         "color":"#000000",
         "fontSize":"1rem",
         "fontFamily":"Open Sans",
         "fontWeight":"normal",
         "fontStyle":"normal",
         "textDecoration":"none"
      },
      "useHTML":true,
      "shared":false,
      "crosshairs":[
         false,
         false
      ],
      "followPointer":true
   },
   "plotOptions":{
      "series":{
         "animation":{
            "duration":700
         },
         "cursor":"pointer",
         "allowPointSelect":true,
         "showInLegend":true,
         "turboThreshold":0,
         "stickyTracking":false,
         "events":{
            
         },
         "point":{
            "events":{
               
            }
         },
         "pointPadding":0.1,
         "getExtremesFromAll":true
      }
   },
   "legend":{
      "enabled":true,
      "item":{
         
      },
      "borderWidth":0,
      "layout":"horizontal",
      "eQLegendPlacement":"CHART",
      "backgroundColor":"rgba(255,255,255,0)",
      "itemStyle":{
         "color":"#000000",
         "fontSize":"1rem",
         "fontFamily":"Open Sans",
         "fontWeight":"normal",
         "fontStyle":"normal",
         "textDecoration":"none"
      },
      "align":"center",
      "verticalAlign":"bottom",
      "margin":0,
      "padding":5,
      "symbolRadius":0
   },
   "credits":{
     ...