| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset='utf-8'>
- <meta name="viewport" content="width=device-width, initial-scale=1" />
- <script src="../lib/esl.js"></script>
- <script src="../lib/config.js"></script>
- <script src="../lib/jquery.min.js"></script>
- </head>
- <body>
- <style>
- html, body, #main {
- width: 100%;
- height: 100%;
- margin: 0;
- padding: 0;
- }
- </style>
- <div id="main"></div>
- <script>
- require([
- 'echarts',
- 'ecStat'
- ], function (echarts, ecStat) {
- var chart = echarts.init(document.getElementById('main'));
- var data = [
- [96.24, 11.35],
- [33.09, 85.11],
- [57.60, 36.61],
- [36.77, 27.26],
- [20.10, 6.72],
- [45.53, 36.37],
- [110.07, 80.13],
- [72.05, 20.88],
- [39.82, 37.15],
- [48.05, 70.50],
- [0.85, 2.57],
- [51.66, 63.70],
- [61.07, 127.13],
- [64.54, 33.59],
- [35.50, 25.01],
- [226.55, 664.02],
- [188.60, 175.31],
- [81.31, 108.68]
- ];
- var myRegression = ecStat.regression('polynomial', data, 3);
- chart.setOption({
- tooltip: {
- trigger: 'axis',
- axisPointer: {
- type: 'cross'
- }
- },
- title: {
- text: '18 家公司的净利润和主营业务收入(百万元)',
- left: 'center',
- top: 16
- },
- xAxis: {
- type: 'value',
- splitLine: {
- lineStyle: {
- type: 'dashed'
- }
- },
- splitNumber: 20
- },
- yAxis: {
- type: 'value',
- min: -40,
- splitLine: {
- lineStyle: {
- type: 'dashed'
- }
- }
- },
- series: [{
- name: 'scatter',
- type: 'scatter',
- label: {
- emphasis: {
- show: true
- }
- },
- data: data
- },{
- name: 'line',
- type: 'line',
- smooth: true,
- showSymbol: false,
- data: myRegression.points,
- markPoint: {
- itemStyle: {
- normal: {
- color: 'transparent'
- }
- },
- label: {
- normal: {
- show: true,
- position: 'left',
- formatter: myRegression.expression,
- textStyle: {
- color: '#333',
- fontSize: 14
- }
- }
- },
- data: [{
- coord: myRegression.points[myRegression.points.length - 1]
- }]
- }
- }]
- });
- });
- </script>
- </body>
- </html>
|