highstock的两个Y轴柱状、曲线混合图

<!doctype html>
<html lang="en">
<head>
  <script type="text/javascript" src="jquery-1.8.3.min.js"></script>
  <script type="text/javascript" src="highstock.js"></script>
  <script>
   $(function () {
        // Create the chart
        $('#container').highcharts('StockChart', {
			chart: {
				zoomType: 'xy'
			},
			 title: {
                text: 'AAPL Stock Price'
            },
			xAxis: [{
				categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
			}],
			yAxis: [{ // Primary yAxis
				labels: {
					format: '{value}°C',
					style: {
						color: '#89A54E'
					}
				},
				title: {
					text: 'Temperature',
					style: {
						color: '#89A54E'
					}
				},
				opposite: false
			}, { // Secondary yAxis
				title: {
                text: 'Rainfall',
					style: {
						color: '#4572A7'
					}
				},
				labels: {
                format: '{value} mm',
                style: {
                    color: '#4572A7'
                }
				},
				opposite: true
		   }],
			tooltip: {
				shared: true
			},
			legend: {
				enabled: true,
				align: 'center',
				backgroundColor: '#FCFFC5',
				borderColor: 'black',
				borderWidth: 2,
				shadow: true
			},
		    rangeSelector: {
				height: 10,
				buttons: [{
                    type: 'hour',
                    count: 1,
                    text: '1h'
                }, {
                    type: 'day',
                    count: 1,
                    text: '1d'
                }, {
                    type: 'month',
                    count: 1,
                    text: '1m'
                }, {
                    type: 'year',
                    count: 1,
                    text: '1y'
                }, {
                    type: 'all',
                    text: 'All'
                }],
				buttonTheme: { // styles for the buttons
					fill: 'none',
					stroke: 'none',
					'stroke-width': 0,
					r: 8,
					style: {
						color: '#039',
						fontWeight: 'bold'
					},
					states: {
						hover: {
						},
						select: {
							fill: '#039',
							style: {
								color: 'white'
							}
						}
						// disabled: { ... }
					}
				},
				inputBoxBorderColor: 'gray',
				inputBoxWidth: 120,
				inputBoxHeight: 18,
				inputStyle: {
					color: '#039',
					fontWeight: 'bold'
				},
				labelStyle: {
					color: 'silver',
					fontWeight: 'bold'
				},
				 //inputEnabled: false, // it supports only days
					//selected : 4 // all
				selected: 1
			},
		scrollbar: {
			enabled: true,
			height: 10,
            barBackgroundColor: 'gray',
            barBorderRadius: 7,
            barBorderWidth: 0,
            buttonBackgroundColor: 'gray',
            buttonBorderWidth: 0,
            buttonArrowColor: 'yellow',
            buttonBorderRadius: 7,
            rifleColor: 'yellow',
            trackBackgroundColor: 'white',
            trackBorderWidth: 1,
            trackBorderColor: 'silver',
            trackBorderRadius: 7
        },
		navigator: {
			//enabled : false
            height: 10
			},
        series: [{
            name: 'Rainfall',
            color: '#4572A7',
            type: 'column',
            yAxis: 1,
            data: [49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
            tooltip: {
                valueSuffix: ' mm'
            }
        }, {
            name: 'Rainfall2',
            color: '#7772A7',
            type: 'column',
            yAxis: 1,
            data: [49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
            tooltip: {
                valueSuffix: ' mm'
            }

        }, {
            name: 'Rainfall3',
            color: '#4572A7',
            type: 'column',
            yAxis: 1,
            data: [49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
            tooltip: {
                valueSuffix: ' mm'
            }

        },{
            name: 'Rainfall4',
            color: '#4572A7',
            type: 'column',
            yAxis: 1,
            data: [49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
            tooltip: {
                valueSuffix: ' mm'
            }

        },{
            name: 'Rainfall5',
            color: '#4572A7',
            type: 'column',
            yAxis: 1,
            data: [49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
            tooltip: {
                valueSuffix: ' mm'
            }

        },{
            name: 'Rainfall6',
            color: '#4572A7',
            type: 'column',
            yAxis: 1,
            data: [49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
            tooltip: {
                valueSuffix: ' mm'
            }

        }, {
			name: 'Temperature',
            color: '#89A54E',
            type: 'line',
            data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9 ,9.6],
            tooltip: {
                valueSuffix: '°C'
            }
        }, {
			name: 'Temperature2',
            color: '#66114E',
            type: 'line',
            data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9,9.6],
            tooltip: {
                valueSuffix: '°C'
			}
		}, {
			name: 'Temperature3',
            color: '#89A54E',
            type: 'line',
            data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9,9.6],
            tooltip: {
                valueSuffix: '°C'
            }
        }, {
			name: 'Temperature4',
            color: '#666666',
            type: 'line',
            data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9,9.6],
            tooltip: {
                valueSuffix: '°C'
            }
        }, {
			name: 'Temperature5',
            color: '#777777',
            type: 'line',
            data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9,9.6],
            tooltip: {
                valueSuffix: '°C'
            }
        }, {
			name: 'Temperature6',
            color: '#888888',
            type: 'line',
            data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9,9.6],
            tooltip: {
                valueSuffix: '°C'
            }
		}],
		credits: {
            enabled: false
        }          
        });
    });
  </script>
</head>
<body>
  <div id="container" style="min-width:700px;height:400px"></div>
</body>
</html>

  

转载于:https://www.cnblogs.com/yueyanxuelang/p/5370144.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值