polarLine.html 3.7 KB
Newer Older
L
lang 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
<html>
    <head>
        <meta charset="utf-8">
        <script src="esl.js"></script>
        <script src="config.js"></script>
    </head>
    <body>
        <style>
            html, body, #main {
                width: 100%;
                height: 100%;
            }
        </style>
        <div id="main"></div>
        <script>

            require([
                'echarts',
L
lang 已提交
19
                'echarts/chart/line',
L
lang 已提交
20
                'echarts/component/legend',
L
lang 已提交
21
                'echarts/component/polar',
L
lang 已提交
22 23 24
                'echarts/component/tooltip',
                'echarts/component/markPoint',
                'echarts/component/markLine'
L
lang 已提交
25 26 27 28 29 30
            ], function (echarts) {

                var chart = echarts.init(document.getElementById('main'), null, {
                    renderer: 'canvas'
                });

L
lang 已提交
31
                var xAxisData = [];
L
lang 已提交
32 33 34 35
                var data1 = [];
                var data2 = [];
                var data3 = [];

L
lang 已提交
36
                for (var i = 0; i < 10; i++) {
L
lang 已提交
37
                    xAxisData.push('类目' + i);
L
lang 已提交
38 39 40
                    data1.push((Math.random() * 2 + 1).toFixed(3));
                    data3.push((Math.random() + 0.5).toFixed(3));
                    data2.push((Math.random() + 0.5).toFixed(3));
L
lang 已提交
41 42 43 44
                }

                chart.setOption({
                    legend: {
L
lang 已提交
45
                        data: ['line', 'line2', 'line3']
L
lang 已提交
46
                    },
L
lang 已提交
47 48 49 50 51 52
                    tooltip: {
                        trigger: 'axis',
                        axisPointer: {
                            type: 'shadow'
                        }
                    },
L
lang 已提交
53
                    polar: {},
L
lang 已提交
54
                    angleAxis: {
L
lang 已提交
55
                        // data: ['类目1', '类目2', '类目3', '类目4', '类目5',]
L
lang 已提交
56
                        data: xAxisData
L
lang 已提交
57 58 59 60 61
                    },
                    radiusAxis: {
                    },
                    series: [{
                        coordinateSystem: 'polar',
L
lang 已提交
62
                        name: 'line',
L
lang 已提交
63
                        stack: 'all',
L
lang 已提交
64
                        type: 'line',
L
lang 已提交
65
                        symbolSize: 10,
L
lang 已提交
66 67 68 69 70 71 72 73 74 75
                        itemStyle: {
                            normal: {
                                areaStyle: {}
                            }
                        },
                        markPoint: {
                            data: [{
                                type: 'max'
                            }]
                        },
L
lang 已提交
76 77 78
                        data: data1
                    }, {
                        coordinateSystem: 'polar',
L
lang 已提交
79
                        name: 'line2',
L
lang 已提交
80
                        stack: 'all',
L
lang 已提交
81
                        type: 'line',
L
lang 已提交
82
                        symbolSize: 10,
L
lang 已提交
83 84 85 86 87 88 89 90 91 92 93 94
                        itemStyle: {
                            normal: {
                                areaStyle: {}
                            }
                        },
                        markLine: {
                            data: [[{
                                type: 'max'
                            }, {
                                type: 'min'
                            }]]
                        },
L
lang 已提交
95 96 97
                        data: data2
                    }, {
                        coordinateSystem: 'polar',
L
lang 已提交
98
                        name: 'line3',
L
lang 已提交
99
                        stack: 'all',
L
lang 已提交
100
                        type: 'line',
L
lang 已提交
101
                        symbolSize: 10,
L
lang 已提交
102 103 104 105 106
                        itemStyle: {
                            normal: {
                                areaStyle: {}
                            }
                        },
L
lang 已提交
107 108 109 110 111 112 113 114
                        data: data3
                    }]
                });
            })

        </script>
    </body>
</html>