提交 31c7787d 编写于 作者: 1 100pah

fix: [geo svg] make test case better.

上级 43e99ef7
此差异已折叠。
<!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/esl.js"></script>
<script src="lib/config.js"></script>
<script src="lib/jquery.min.js"></script>
<script src="lib/facePrint.js"></script>
<script src="lib/testHelper.js"></script>
<!-- <script src="ut/lib/canteen.js"></script> -->
<link rel="stylesheet" href="lib/reset.css" />
</head>
<body>
<style>
.test-chart-block {
background-color: #777;
}
</style>
<div id="main_simple_geo_json_default_layout"></div>
<div id="main_simple_geo_svg_default_layout"></div>
<div id="main_simple_geo_json_layoutCenter_layoutSize_layout"></div>
<div id="main_simple_geo_svg_layoutCenter_layoutSize_layout"></div>
<div id="main_simple_geo_json_ltrb_layout"></div>
<div id="main_simple_geo_svg_ltrb_layout"></div>
<script>
var _echarts;
require(['echarts'], function (echarts) {
_ecahrts = echarts;
const testGeoJSON1 = {
'type': 'FeatureCollection',
'features': [
{
'type': 'Feature',
'geometry': {
'type': 'Polygon',
'coordinates': [
[[2000, 2000], [5000, 2000], [5000, 5000], [2000, 5000]]
]
},
'properties': {
'name': 'Afghanistan',
'childNum': 1
}
}
]
};
echarts.registerMap('testGeoJSON1', testGeoJSON1);
const svg = [
'<?xml version="1.0" encoding="utf-8"?>',
'<svg xmlns="http://www.w3.org/2000/svg" xmlns:ooo="http://xml.openoffice.org/svg/export" xmlns:xlink="http://www.w3.org/1999/xlink" width="100" height="100" version="1.2" fill-rule="evenodd" xml:space="preserve">',
'<path d="M 0,0 L 0,100 100,100 100,0 Z" fill="none" stroke="rgb(56,93,138)" stroke-width="2" stroke-linecap="square" stroke-linejoin="miter"/>',
'</svg>'
].join('')
echarts.registerMap('testGeoSVG1', { svg: svg });
runAllCases();
});
var _cases = [];
function _case(theCase) {
_cases.push(theCase);
if (_echarts) {
runAllCases();
}
}
function runAllCases() {
for (var i = 0; i < _cases.length; i++) {
_cases[i](_ecahrts);
}
_cases.length = 0;
}
</script>
<script>
_case(function (echarts) {
option = {
backgroundColor: '#fff',
tooltip: {
},
geo: {
map: 'testGeoJSON1',
roam: true,
selectedMode: 'single',
// height: '100%',
// center
// layoutCenter: ['30%', 40],
// layoutSize: 40,
// boundingCoords
zoom: 1,
aspectScale: 1
}
};
var chart = testHelper.create(echarts, 'main_simple_geo_json_default_layout', {
title: [
'geoJSON default layout:',
'Should be a square.',
'80% of canvas height.',
'At the center of the canvas.'
],
option: option,
height: 200
});
});
</script>
<script>
_case(function (echarts) {
option = {
backgroundColor: '#fff',
tooltip: {
},
geo: {
map: 'testGeoSVG1',
roam: true,
selectedMode: 'single',
// height: '100%',
// center
// layoutCenter: ['30%', 40],
// layoutSize: 40,
// boundingCoords
// zoom: 1,
// aspectScale: 1
}
};
var chart = testHelper.create(echarts, 'main_simple_geo_svg_default_layout', {
title: [
'geoSVG default layout:',
'Should be a square.',
'80% of canvas height.',
'At the center of the canvas.'
],
option: option,
height: 200
});
});
</script>
<script>
_case(function (echarts) {
option = {
backgroundColor: '#fff',
tooltip: {
},
geo: {
map: 'testGeoJSON1',
roam: true,
selectedMode: 'single',
layoutCenter: ['50%', 40],
layoutSize: 80,
zoom: 1,
aspectScale: 1
}
};
var chart = testHelper.create(echarts, 'main_simple_geo_json_layoutCenter_layoutSize_layout', {
title: [
'geoJSON layoutCenter/layoutSize layout:',
'Should be a square.',
'100% of canvas height.',
'At the center of the canvas.'
],
option: option,
height: 80
});
});
</script>
<script>
_case(function (echarts) {
option = {
backgroundColor: '#fff',
tooltip: {
},
geo: {
map: 'testGeoSVG1',
roam: true,
selectedMode: 'single',
layoutCenter: ['50%', 40],
layoutSize: 80,
zoom: 1,
aspectScale: 1
}
};
var chart = testHelper.create(echarts, 'main_simple_geo_svg_layoutCenter_layoutSize_layout', {
title: [
'geoJSON layoutCenter/layoutSize layout:',
'Should be a square.',
'100% of canvas height.',
'At the center of the canvas.'
],
option: option,
height: 80
});
});
</script>
<script>
_case(function (echarts) {
option = {
backgroundColor: '#fff',
tooltip: {
},
geo: {
map: 'testGeoJSON1',
roam: true,
selectedMode: 'single',
left: 10,
right: 10,
top: 10,
bottom: 10,
width: null,
height: null,
zoom: 1,
aspectScale: 1
}
};
var chart = testHelper.create(echarts, 'main_simple_geo_json_ltrb_layout', {
title: [
'geoJSON top/right/bottom/left layout:',
'Should be a rect. Canvas width 400.',
'left/right/top/bottom all are **10**'
],
option: option,
width: 400,
height: 80
});
});
</script>
<script>
_case(function (echarts) {
option = {
backgroundColor: '#fff',
tooltip: {
},
geo: {
map: 'testGeoSVG1',
roam: true,
selectedMode: 'single',
left: 10,
right: 10,
top: 10,
bottom: 10,
width: null,
height: null,
zoom: 1,
aspectScale: 1
}
};
var chart = testHelper.create(echarts, 'main_simple_geo_svg_ltrb_layout', {
title: [
'geoJSON top/right/bottom/left layout:',
'Should be a rect. Canvas width 400.',
'left/right/top/bottom all are **10**'
],
option: option,
width: 400,
height: 80
});
});
</script>
</body>
</html>
......@@ -37,11 +37,11 @@ under the License.
<div id="main_geo_svg_organ"></div>
<!-- <div id="main_geo_svg_organ"></div>
<div id="main_geo_svg_regions"></div>
<div id="main_geo_svg_line_path"></div>
<div id="main_geo_svg_heatmap"></div>
<div id="main_geo_svg_building"></div>
<div id="main_geo_svg_building"></div> -->
<div id="main_geo_svg_traffic"></div>
......@@ -618,7 +618,6 @@ under the License.
series: [{
name: 'Route',
type: 'lines',
map: 'MacOdrum-LV5-floorplan-web',
coordinateSystem: 'geo',
geoIndex: 0,
emphasis: {
......@@ -629,8 +628,10 @@ under the License.
polyline: true,
lineStyle: {
color: '#c46e54',
width: 2
width: 5,
opacity: 1
},
zlevel: 1,
effect: {
show: true,
period: 8,
......@@ -732,7 +733,6 @@ under the License.
series: [{
name: 'Route',
type: 'lines',
map: 'MacOdrum-LV5-floorplan-web',
coordinateSystem: 'geo',
geoIndex: 0,
emphasis: {
......@@ -758,7 +758,8 @@ under the License.
data: [{
effect: {
color: '#a10000',
constantSpeed: 100
constantSpeed: 100,
delay: 0,
},
coords: [
[50.875133928571415, 242.66287667410717],
......@@ -804,7 +805,8 @@ under the License.
}, {
effect: {
color: '#00067d',
constantSpeed: 80
constantSpeed: 80,
delay: 0,
},
coords: [
[779.4595368303574, 287.98744419642856],
......@@ -840,7 +842,8 @@ under the License.
}, {
effect: {
color: '#997405',
constantSpeed: 60
constantSpeed: 60,
delay: 0,
},
coords: [
[2.5920703124999704, 450.66908482142856],
......
......@@ -37,8 +37,6 @@ under the License.
<div id="main_simple_geo_json"></div>
<div id="main_simple_geo_svg"></div>
<div id="main_simple_geo_svg_coord"></div>
<div id="main_simple_geo_svg_viewBox_svgWH"></div>
<div id="main_geo_json_focus_blur"></div>
......@@ -89,117 +87,6 @@ under the License.
<script>
require(['echarts'/*, 'map/js/china' */], function (echarts) {
const testGeoJson1 = {
'type': 'FeatureCollection',
'features': [
{
'type': 'Feature',
'geometry': {
'type': 'Polygon',
'coordinates': [
[[2000, 2000], [5000, 2000], [5000, 5000], [2000, 5000]]
]
},
'properties': {
'name': 'Afghanistan',
'childNum': 1
}
}
]
};
echarts.registerMap('testGeoJson1', testGeoJson1);
option = {
tooltip: {
},
geo: {
map: 'testGeoJson1',
roam: true,
selectedMode: 'single',
// height: '100%',
// center
// layoutCenter: ['30%', 40],
// layoutSize: 40,
// boundingCoords
zoom: 1,
aspectScale: 1
}
};
var chart = testHelper.create(echarts, 'main_simple_geo_json', {
title: [
'simple geo geoJSON location:',
'Should be a square and 80% of canvas height.',
'At the center of the canvas.'
],
option: option,
info: {},
infoKey: 'event',
height: 200
});
listenAndPrintEvent(chart);
});
</script>
<script>
require(['echarts'/*, 'map/js/china' */], function (echarts) {
const svg = [
'<?xml version="1.0" encoding="utf-8"?>',
'<svg xmlns="http://www.w3.org/2000/svg" xmlns:ooo="http://xml.openoffice.org/svg/export" xmlns:xlink="http://www.w3.org/1999/xlink" width="100" height="100" version="1.2" fill-rule="evenodd" xml:space="preserve">',
'<path d="M 0,0 L 0,100 100,100 100,0 Z" fill="none" stroke="rgb(56,93,138)" stroke-width="2" stroke-linecap="square" stroke-linejoin="miter"/>',
'</svg>'
].join('')
echarts.registerMap('testGeoSVG', { svg: svg });
option = {
tooltip: {
},
geo: {
map: 'testGeoSVG',
roam: true,
selectedMode: 'single',
// height: '100%',
// center
// layoutCenter: ['30%', 40],
// layoutSize: 40,
// boundingCoords
// zoom: 1,
// aspectScale: 1
}
};
var chart = testHelper.create(echarts, 'main_simple_geo_svg', {
title: [
'Should be a square and 80% of canvas height.',
'At the center of the canvas.'
],
option: option,
info: {},
infoKey: 'event',
height: 200
});
listenAndPrintEvent(chart);
});
</script>
......@@ -641,11 +528,11 @@ under the License.
require(['echarts'/*, 'map/js/china' */], function (echarts) {
var option;
$.ajax({
url: '../../vis-data/map/svg/seats/seatmap-example.svg',
url: 'data/svg/flight-seats.svg',
dataType: 'text'
}).done(function (svg) {
echarts.registerMap('seatmap', {
echarts.registerMap('flight-seats', {
svg: svg
});
......@@ -653,15 +540,18 @@ under the License.
tooltip: {
},
geo: {
map: 'seatmap',
map: 'flight-seats',
roam: true,
selectedMode: 'multiple',
tooltip: {
show: true
},
// height: 100,
// zoom: 1.5
emphasis: {
itemStyle: {
color: null,
borderColor: '#780705',
borderWidth: 3
},
label: {
textBorderColor: '#fff',
textBorderWidth: 2
......@@ -677,14 +567,7 @@ under the License.
textBorderWidth: 2
}
}
},
// series: {
// type: 'scatter',
// coordinateSystem: 'geo',
// // ?????????????????????????
// geoIndex: 0,
// data: [[11, 22], [33, 44]]
// }
}
};
var chart = testHelper.create(echarts, 'main_pure_geo_svg', {
......@@ -697,8 +580,6 @@ under the License.
info: {},
infoKey: 'event',
height: 300
// buttons: [{text: 'btn-txt', onclick: function () {}}],
// recordCanvas: true,
});
listenAndPrintEvent(chart);
......@@ -717,7 +598,7 @@ under the License.
require(['echarts'/*, 'map/js/china' */], function (echarts) {
var option;
$.ajax({
url: '../../vis-data/map/svg/seats/seatmap-example.svg',
url: 'data/svg/seatmap-example.svg',
dataType: 'text'
}).done(function (svg) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册