Plotly.js 一个可以用来做分析和可视化的 javascript 绘图库
代码:
<body>
<div id="tester" style="width:600px;height:250px;"></div>
<p id="clean" >click me</p>
<p id="create" >create - click me</p>
</body>
<script src="https://cdn.plot.ly/plotly-1.2.0.min.js"></script>
<script src="http://code.jquery.com/jquery-2.2.4.min.js"></script>
<script type="text/javascript">
$("#create").click(function(){
    TESTER = document.getElementById('tester');
    Plotly.plot(TESTER, [{
        x: [1, 2, 3, 4, 5],
        y: [1, 2, 4, 8, 16]
    }], {
        margin: {t: 0}
    });
})
$("#clean").click(function(){
    TESTER = document.getElementById('tester');
    Plotly.newPlot(TESTER, [{
        x: [1, 2, 3, 4, 5],
        y: [1, 2, 4, 8, 8]
    }], {
        margin: {t: 0}
    });
})
</script>
墨之科技,版权所有 © Copyright 2017-2027
湘ICP备14012786号 邮箱:ai@inksci.com