1 回答
TA贡献1802条经验 获得超10个赞
结帐我的snipet,希望它可以帮助你。祝你今天过得愉快!
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script>
var myChart;
$(document).ready(function() {
init();
});
function init() {
myChart = Highcharts.chart('graph-container', {
title: {
text: 'Dummy Title'
},
xAxis: {
categories: ['Dummy1', 'Dummy2']
},
series: []
});
}
function onclickButton() {
myChart.addSeries({
name: 'John',
data: [
['A', Math.floor(Math.random() * 10)],
['B', Math.floor(Math.random() * 10)]
]
});
}
</script>
</head>
<body>
<div id="graph-container" style="width:100%; height:400px;"></div>
<input type="button" value="Click me" onclick="onclickButton()">
</body>
</html>
添加回答
举报