双Y轴

$(document).ready(function() {

        chart = new Highcharts.Chart({

            chart: {

                renderTo: 'container'

            },

            xAxis: [{

                categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',

                    'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']

            }],

            yAxis: [{ // 第一个Y轴

                labels: {//刻度

                    formatter: function() {

                        return this.value +'°C';

                    },

                    style: {

                        color: '#89A54E'

                    }

                },

                title: {//y轴名称

                    text: 'Temperature',

                    style: {

                        color: '#89A54E'

                    }

                }

            }, { // 第二个Y轴

                title: {

                    text: 'Rainfall',

                    style: {

                        color: '#4572A7'

                    }

                },

                labels: {

                    formatter: function() {

                        return this.value +' mm';

                    },

                    style: {

                        color: '#4572A7'

                    }

                },

                opposite: true //表示是否跟第一个在反方向位置

            }],

        

            series: [{

                type: 'column',

                yAxis:1,//用来指定数据对应的y轴,不写表示默认选择第一个y轴

                data: [49.9, 71.5, 176.4, 129.2, 144.0, 196.0, 115.6, 118.5, 216.4, 114.1, 195.6, 54.4]

            }, {

                type: 'line',//这里也可以是column

                data: [5.0, 9.9,5.5, 7.5, 11.2, 21.5, 25.2, 26.5, 12.3, 18.3, 19.9, 9.6]

            }]

        });

    });

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值