Highcharts Demo

author(s): Torstein Hønsi

by anikettiwari

HTML

<script src="https://code.highcharts.com/highcharts.js"></script>

<div>Above the chart</div>
<div id="container" style="height: 400px;"></div>
<div>Below the chart</div>

CSS

.highcharts-yaxis-title {
   text-overflow: ellipsis;
 }

JavaScript

$(function() {


  $('#container').highcharts({
   chart: {
        renderTo: 'container'
    },

    xAxis: {
        categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
    },
    
    legend: {
        width: 100,
        layout: 'vertical',
        align: 'right',
        verticalAlign: 'top',
        y: 100,
        labelFormatter: function() {
            var name = this.name;
            if (name.length > 15) {
                name = name.substring(0, 12) +'..';
            }
            return name;
        }
    },

    series: [{
        data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
        name: 'This is a really long series name'
    }, {
        data: [106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4, 29.9, 71.5],
        name: 'This too is a long series name'
    }, {
        data: [144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4, 29.9, 71.5, 106.4, 129.2],
        name: 'Short name'
    }]

});