123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263 |
- <html>
- <head>
- <meta charset="utf-8">
- <script src="lib/esl.js"></script>
- <script src="lib/config.js"></script>
- <script src="lib/facePrint.js"></script>
- <meta name="viewport" content="width=device-width, initial-scale=1" />
- <link rel="stylesheet" href="lib/reset.css" />
- </head>
- <body>
- <style>
- h1 {
- line-height: 60px;
- background: #360;
- text-align: center;
- font-weight: bold;
- color: #eee;
- font-size: 14px;
- margin: 0;
- }
- .chart {
- height: 350px;
- }
- </style>
- <h1>xAxis: {showMinLabel: null, showMaxLabel: null (auto)}. The last x label should not be displayed (overlap).</h1>
- <div class="chart" id="chart-1"></div>
- <h1>xAxis: {showMinLabel: null, showMaxLabel: null (auto)}. The last x label shoule be displayed (not overlap).</h1>
- <div class="chart" id="chart0"></div>
- <h1>xAxis: {showMinLabel: true, showMaxLabel: true}, yAxis: {showMaxLabel: false}. The last x label should be displayed. 100 on y should not be displayed.</h1>
- <div class="chart" id="chart1"></div>
- <script>
- require([
- 'data/rainfall.json',
- 'echarts'
- // 'echarts/chart/line',
- // 'echarts/component/legend',
- // 'echarts/component/grid',
- // 'echarts/component/tooltip',
- // 'echarts/component/title',
- // 'echarts/component/dataZoom',
- // 'echarts/scale/Time'
- ], function (rainfallData, echarts) {
- var chart = echarts.init(document.getElementById('chart-1'), null, {
- });
- chart.setOption({
- tooltip : {
- trigger: 'axis'
- },
- grid: {
- bottom: 150
- },
- dataZoom: {
- show: true,
- realtime: true,
- startValue: '2009-09-20 12:00',
- end: 100
- },
- xAxis : [
- {
- type : 'time',
- // splitNumber: 20,
- axisLabel: {
- formatter: function (value) {
- return echarts.format.formatTime('yyyy-MM-dd hh:mm:ss', value);
- }
- }
- }
- ],
- yAxis : [
- {
- name: '流量(m^3/s)'
- }
- ],
- series : [
- {
- name: '流量',
- type: 'line',
- symbol: 'none',
- itemStyle: {normal: {areaStyle: {type: 'default'}}},
- data: rainfallData.flow.map(function (val, idx) {
- return [+(new Date(rainfallData.category[idx])), val];
- })
- }
- ]
- });
- })
- </script>
- <script>
- require([
- 'data/rainfall.json',
- 'echarts'
- // 'echarts/chart/line',
- // 'echarts/component/legend',
- // 'echarts/component/grid',
- // 'echarts/component/tooltip',
- // 'echarts/component/title',
- // 'echarts/component/dataZoom',
- // 'echarts/scale/Time'
- ], function (rainfallData, echarts) {
- var chart = echarts.init(document.getElementById('chart0'), null, {
- });
- chart.setOption({
- tooltip : {
- trigger: 'axis'
- },
- grid: {
- bottom: 150
- },
- dataZoom: {
- show: true,
- realtime: true,
- startValue: '2009-09-20 12:00',
- end: 100
- },
- xAxis : [
- {
- type : 'time',
- // splitNumber: 20,
- axisLabel: {
- rotate: 45,
- formatter: function (value) {
- return echarts.format.formatTime('yyyy-MM-dd hh:mm:ss', value);
- }
- }
- }
- ],
- yAxis : [
- {
- name: '流量(m^3/s)'
- }
- ],
- series : [
- {
- name: '流量',
- type: 'line',
- symbol: 'none',
- itemStyle: {normal: {areaStyle: {type: 'default'}}},
- data: rainfallData.flow.map(function (val, idx) {
- return [+(new Date(rainfallData.category[idx])), val];
- })
- }
- ]
- });
- })
- </script>
- <script>
- require([
- 'data/rainfall.json',
- 'echarts'
- // 'echarts/chart/line',
- // 'echarts/component/legend',
- // 'echarts/component/grid',
- // 'echarts/component/tooltip',
- // 'echarts/component/title',
- // 'echarts/component/dataZoom',
- // 'echarts/scale/Time'
- ], function (rainfallData, echarts) {
- var chart = echarts.init(document.getElementById('chart1'), null, {
- });
- chart.setOption({
- tooltip : {
- trigger: 'axis'
- },
- grid: {
- bottom: 150
- },
- dataZoom: {
- show: true,
- realtime: true,
- startValue: '2009-09-20 12:00',
- end: 100
- },
- xAxis : [
- {
- type : 'time',
- // splitNumber: 20,
- axisLabel: {
- showMaxLabel: true,
- showMinLabel: true,
- formatter: function (value) {
- return echarts.format.formatTime('yyyy-MM-dd hh:mm:ss', value);
- }
- }
- }
- ],
- yAxis : [
- {
- name: '流量(m^3/s)',
- position: 'right',
- axisLabel: {
- inside: true,
- showMaxLabel: false,
- formatter: '{value}\n'
- }
- }
- ],
- series : [
- {
- name: '流量',
- type: 'line',
- symbol: 'none',
- itemStyle: {normal: {areaStyle: {type: 'default'}}},
- data: rainfallData.flow.map(function (val, idx) {
- return [+(new Date(rainfallData.category[idx])), val];
- })
- }
- ]
- });
- })
- </script>
- </body>
- </html>
|