[Javascript] 繪圖: Highcharts, Highstock, Highmaps

Highcharts, Highstock, Highmaps
https://www.highcharts.com

Highcharts 是個 JavaScript 圖表函式庫,我們可以使用它來進行各式繪圖與使用者互動。而它包含Highcharts, Highstock, Highmaps三大類,可支援股票數據繪圖與空間資訊繪圖。

Highcharts demo
https://www.highcharts.com/demo

Highstock demo
https://www.highcharts.com/stock/demo

Highmaps demo
https://www.highcharts.com/maps/demo

以下為vue版

Highcharts-vue(weizhenye)
https://github.com/weizhenye/vue-highcharts


以下為單html檔測試範例(Area圖)︰
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <title>HighChrats Vue Demo</title>

    <!--使用vue-->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.min.js"></script>

    <!--使用highcharts-->
    <script src="https://cdn.hcharts.cn/highcharts/highcharts.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/vue-highcharts@0.0.10/dist/vue-highcharts.min.js"></script>

</head>
<body>

    <highcharts id="app" v-bind:options="options"></highcharts>

    <script type="text/javascript">

        //使用Vue.use加載VueHighcharts
        Vue.use(VueHighcharts);

        new Vue({
            el: '#app',
            data: {
                options: {
                    chart: {
                        type: 'area'
                    },
                    title: {
                        text: 'Historic and Estimated Worldwide Population Growth by Region'
                    },
                    subtitle: {
                        text: 'Source: Wikipedia.org'
                    },
                    xAxis: {
                        categories: ['1750', '1800', '1850', '1900', '1950', '1999', '2050'],
                        tickmarkPlacement: 'on',
                        title: {
                            enabled: false
                        }
                    },
                    yAxis: {
                        title: {
                            text: 'Billions'
                        },
                        labels: {
                            formatter: function () {
                                return this.value / 1000;
                            }
                        }
                    },
                    tooltip: {
                        split: true,
                        valueSuffix: ' millions'
                    },
                    plotOptions: {
                        area: {
                            stacking: 'normal',
                            lineColor: '#666666',
                            lineWidth: 1,
                            marker: {
                                lineWidth: 1,
                                lineColor: '#666666'
                            }
                        }
                    },
                    series: [{
                        name: 'Asia',
                        data: [502, 635, 809, 947, 1402, 3634, 5268]
                    }, {
                        name: 'Africa',
                        data: [106, 107, 111, 133, 221, 767, 1766]
                    }, {
                        name: 'Europe',
                        data: [163, 203, 276, 408, 547, 729, 628]
                    }, {
                        name: 'America',
                        data: [18, 31, 54, 156, 339, 818, 1201]
                    }, {
                        name: 'Oceania',
                        data: [2, 2, 2, 6, 13, 30, 46]
                    }]
                },
            },
        });

    </script>

</body>
</html>


載入後畫面為︰


#Highcharts, Highstock, Highmaps, Javascript, vue, canvas, svg, plot, chart

留言