Highcharts Inverted Axes Spline Chart

In the previous chapters, we learned how to setup highcharts library and how to create a chart with required configurations using highcharts library in our webpage. Now, we will learn how to create a spline chart with inverted axes using highcharts library with examples.

Highcharts Spline with Inverted Axes Chart Example

Following is the example of creating a spline chart with inverted axes by setting the required inverted axes properties using highcharts library.

 

<html>

<head>

    <title>Highcharts Spline with Inverted Axes Chart</title>

    <script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>

    <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 type="text/javascript">

        $(function() {

            Highcharts.chart('container', {

                chart: {

                    type: 'spline',

                    inverted: true

                },

                title: {

                    text: 'Atmosphere Temperature by Altitude'

                },

                subtitle: {

                    text: 'According to the Standard Atmosphere Model'

                },

                xAxis: {

                    reversed: false,

                    title: {

                        enabled: true,

                        text: 'Altitude'

                    },

                    labels: {

                        format: '{value} km'

                    },

                    maxPadding: 0.05,

                    showLastLabel: true

                },

                yAxis: {

                    title: {

                        text: 'Temperature'

                    },

                    labels: {

                        format: '{value}°'

                    },

                    lineWidth: 2

                },

                legend: {

                    enabled: false

                },

                tooltip: {

                    headerFormat: '<b>{series.name}</b><br/>',

                    pointFormat: '{point.x} km: {point.y}°C'

                },

                plotOptions: {

                    spline: {

                        marker: {

                            enable: false

                        }

                    }

                },

                series: [{

                    name: 'Temperature',

                    data: [[0, 15], [10, -50], [20, -56.5], [30, -46.5], [40, -22.1],

                          [50, -2.5], [60, -27.7], [70, -55.7], [80, -76.5]]

                }]

            });

        });

    </script>

</head>

<body>

    <div id="container" style="width: 100%; height: 400px;"> </div>

</body>

</html>

If you observe the above example, we created a spline chart with inverted axes using highcharts library with required properties.

 

When we execute the above highcharts example, we will get the result like as shown below.

 

Highcharts Inverted Axes Spline Chart Example Result

 

This is how we can create a spline chart with inverted axes using highcharts library with required spline chart properties. 

Topics Covered