Get axis by id

Description

The following code shows how to get axis by id.

Example


<!DOCTYPE html>
<html>
<head>
<script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script>
<script type='text/javascript'>
$(function () {<!--  w ww.jav  a  2s  .com-->
    $('#container').highcharts({
        xAxis: {
            categories: ['Jan', 'Feb', 'Mar'],
            id: 'x-axis'
        },

        subtitle: {
            floating: true,
            align: 'left',
            x: 100,
            y: 70

        },

        series: [{
            data: [300, 200, 600]
        }]
    });
    $('#button').click(function () {
        var chart = $('#container').highcharts();
        chart.setTitle(null, {
            text: 'The axis object: ' + chart.get('x-axis')
        });
    });
});
</script>
</head>
<body>
<script src="http://code.highcharts.com/highcharts.js"></script>

<div id="container" style="height: 400px"></div>
<button id="button" class="autocompare">Get axis by id</button>
</body>
</html>

Click to view the demo





















Home »
  highcharts »
    Axis »




Axis
Axis Data
Axis Label
Axis Plot
Axis Tick
Axis Title