| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- <!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 = [
- [0, 0],
- [1, 2],
- [2, 3],
- [3, 4],
- [4, 5],
- [5, 8],
- [6, 7],
- [7, 7],
- [8, 10],
- [9, 14],
- [10, 10],
- [11, 11],
- ['12', '12'],
- [13, 15]
- ];
- var myRegression = ecStat.regression('linearThroughOrigin', data);
- chart.setOption({
- legend: {
- data: ['scatter', 'line']
- },
- tooltip: {
- trigger: 'axis',
- axisPointer: {
- type: 'cross'
- }
- },
- xAxis: {
- type: 'value',
- splitLine: {
- show: false
- },
- splitNumber: 20
- },
- yAxis: {
- type: 'value',
- splitLine: {
- show: false
- }
- },
- series: [{
- name: 'scatter',
- type: 'scatter',
- label: {
- emphasis: {
- show: true
- }
- },
- data: data
- },{
- name: 'line',
- type: 'line',
- showSymbol: false,
- data: myRegression.points
- }]
- });
- });
- </script>
- </body>
- </html>
|