| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- <!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) {
- echarts.registerTransform(ecStat.transform.histogram);
- var chart = echarts.init(document.getElementById('main'));
- var option = {
- dataset: [{
- source: [
- [8.3, 143],
- [8.6, 214],
- [8.8, 251],
- [10.5, 26],
- [10.7, 86],
- [10.8, 93],
- [11.0, 176],
- [11.0, 39],
- [11.1, 221],
- [11.2, 188],
- [11.3, 57],
- [11.4, 91],
- [11.4, 191],
- [11.7, 8],
- [12.0, 196],
- [12.9, 177],
- [12.9, 153],
- [13.3, 201],
- [13.7, 199],
- [13.8, 47],
- [14.0, 81],
- [14.2, 98],
- [14.5, 121],
- [16.0, 37],
- [16.3, 12],
- [17.3, 105],
- [17.5, 168],
- [17.9, 84],
- [18.0, 197],
- [18.0, 155],
- [20.6, 125]
- ]
- }, {
- transform: {
- type: 'ecStat:histogram'
- }
- }, {
- transform: {
- type: 'ecStat:histogram',
- print: true,
- config: { dimensions: [1] }
- }
- }],
- tooltip: {
- },
- grid: [{
- top: '50%',
- right: '50%'
- }, {
- bottom: '52%',
- right: '50%',
- }, {
- top: '50%',
- left: '52%'
- }],
- xAxis: [{
- scale: true,
- gridIndex: 0
- }, {
- type: 'category',
- scale: true,
- axisTick: { show: false },
- axisLabel: { show: false },
- axisLine: { show: false },
- gridIndex: 1
- }, {
- scale: true,
- gridIndex: 2
- }],
- yAxis: [{
- gridIndex: 0
- }, {
- gridIndex: 1
- }, {
- type: 'category',
- axisTick: { show: false },
- axisLabel: { show: false },
- axisLine: { show: false },
- gridIndex: 2
- }],
- series: [{
- name: 'origianl scatter',
- type: 'scatter',
- xAxisIndex: 0,
- yAxisIndex: 0,
- encode: { tooltip: [0, 1] },
- datasetIndex: 0
- }, {
- name: 'histogram',
- type: 'bar',
- xAxisIndex: 1,
- yAxisIndex: 1,
- barWidth: '99.3%',
- label: {
- show: true,
- position: 'top'
- },
- encode: { x: 0, y: 1, itemName: 4 },
- datasetIndex: 1
- }, {
- name: 'histogram',
- type: 'bar',
- xAxisIndex: 2,
- yAxisIndex: 2,
- barWidth: '99.3%',
- label: {
- show: true,
- position: 'right'
- },
- encode: { x: 1, y: 0, itemName: 4 },
- datasetIndex: 2
- }]
- };
- chart.setOption(option);
- });
- </script>
- </body>
- </html>
|