| <!DOCTYPE html> |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one |
| or more contributor license agreements. See the NOTICE file |
| distributed with this work for additional information |
| regarding copyright ownership. The ASF licenses this file |
| to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance |
| with the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, |
| software distributed under the License is distributed on an |
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| KIND, either express or implied. See the License for the |
| specific language governing permissions and limitations |
| under the License. |
| --> |
| |
| |
| <html> |
| <head> |
| <meta charset="utf-8"> |
| <meta name="viewport" content="width=device-width, initial-scale=1" /> |
| <script src="lib/simpleRequire.js"></script> |
| <script src="lib/config.js"></script> |
| <script src="lib/testHelper.js"></script> |
| <link rel="stylesheet" href="lib/reset.css" /> |
| </head> |
| <body> |
| <style> |
| #plot-wrapper { |
| display: flex; |
| flex-direction: column; |
| } |
| </style> |
| |
| <div id="plot-wrapper" /> |
| |
| |
| <script> |
| require(['echarts'], function (echarts) { |
| const option = { |
| xAxis: { |
| name: 'x-Axis Name', |
| nameMoveOverlap: true, |
| nameGap: 10 |
| }, |
| yAxis: { |
| name: 'y-Axis Name', |
| nameMoveOverlap: true, |
| nameGap: 10 |
| }, |
| grid: [{ |
| left: 10, |
| top: 10, |
| right: 10, |
| bottom: 10, |
| // containLabel: true, |
| }], |
| series: [{ |
| name: 'series 1', |
| data: [[1, 500], [2, 1000], [3, 1500], [4, 200], [5, 400], [6, 600], |
| [7, 400], [8, 200], [9, 1000], [10, 1500], [11, 1200], [12, 1100]], |
| type: 'line' |
| }] |
| }; |
| |
| const plotWrapper = document.getElementById('plot-wrapper'); |
| const possibleNameLocations = ['start', 'middle', 'end']; |
| const differentHandledNameRotations = [0, 45, 90, 135]; |
| const inverseAxisPossibilities = [true, false]; |
| |
| inverseAxisPossibilities.forEach(inverse => { |
| possibleNameLocations.forEach(nameLocation => { |
| differentHandledNameRotations.forEach(nameRotation => { |
| const plotId = `plot-${inverse}-${nameLocation}-${nameRotation}`; |
| const plotDiv = document.createElement("div"); |
| plotDiv.setAttribute('id', plotId); |
| plotWrapper.appendChild(plotDiv); |
| |
| option.xAxis.nameRotate = nameRotation; |
| option.yAxis.nameRotate = nameRotation; |
| option.xAxis.nameLocation = nameLocation; |
| option.yAxis.nameLocation = nameLocation; |
| option.xAxis.inverse = inverse; |
| option.yAxis.inverse = inverse; |
| |
| testHelper.create(echarts, plotId, { |
| title: [ |
| 'Axis labels and axis names should not intersect and axis names should be completely shown', |
| `Axis options: inverse - ${inverse}, nameRotate - ${nameRotation}, nameLocation - ${nameLocation}` |
| ], |
| option |
| }); |
| }); |
| }); |
| }); |
| }); |
| </script> |
| |
| |
| <script> |
| require(['echarts'], function (echarts) { |
| const option = { |
| xAxis: [{ |
| name: 'x-Axis Name', |
| nameMoveOverlap: true, |
| nameGap: 10, |
| nameRotate: 90, |
| data: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] |
| }], |
| yAxis: [{ |
| name: 'First y-Axis Name', |
| nameMoveOverlap: true, |
| nameGap: 10, |
| nameRotate: 135 |
| }, { |
| name: 'Second y-Axis Name', |
| nameMoveOverlap: true, |
| nameLocation: 'end', |
| nameGap: 10, |
| nameRotate: 0 |
| }], |
| grid: [{ |
| left: 10, |
| top: 10, |
| right: 10, |
| bottom: 10, |
| // containLabel: true, |
| }], |
| series: [{ |
| name: 'series 1', |
| data: [40, 20, 50, 50, 60, 70, 60, 50, 50, 30, 10, 10], |
| type: 'line' |
| }, |
| { |
| name: 'series 2', |
| data: [500, 1000, 1500, 200, 400, 600, 400, 200, 1000, 1500, 1200, 1100], |
| type: 'line', |
| yAxisIndex: 1 |
| }] |
| }; |
| |
| const plotWrapper = document.getElementById('plot-wrapper'); |
| |
| const plotId = 'plot-2-y-axis'; |
| const plotDiv = document.createElement("div"); |
| plotDiv.setAttribute('id', plotId); |
| plotWrapper.appendChild(plotDiv); |
| |
| testHelper.create(echarts, plotId, { |
| title: [ |
| 'Axis labels and axis names should not intersect and axis names should be completely shown', |
| '2 y-Axes and 2 x-Axes' |
| ], |
| option |
| }); |
| }); |
| </script> |
| </body> |
| </html> |