1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| <!DOCTYPE html> <html>
<head> <title>SVG</title> <meta http-equiv="content-type" content="text/html; charset=utf-8">
<script type="module"> import { Graph, BgUtil } from "../../src/index.js";
let graph = new Graph({ "target": "graphWrapper" });
BgUtil.generateGrid(Object.assign({ "interval": 10, "graph": graph }, graph.getSize()));
let currentLayer = graph.addLayer({ "name": "数据层" }); currentLayer.getSource().loadData([ { "type": "Polygon", "coords": [[1, 1], [161, 1], [81, 81]], "style": { "fillStyle": 1, "fillColor": "#caff67" } }, { "type": "Polygon", "coords": [[1, 2], [81, 82], [1, 162]], "style": { "fillStyle": 1, "fillColor": "#67becf" } }, { "type": "Polygon", "coords": [[162, 1], [162, 81], [122, 121], [122, 41]], "style": { "fillStyle": 1, "fillColor": "#ef3d61" } }, { "type": "Polygon", "coords": [[121, 42], [121, 122], [81, 82]], "style": { "fillStyle": 1, "fillColor": "#f9f51a" } }, { "type": "Polygon", "coords": [[82, 82], [122, 122], [82, 162], [42, 122]], "style": { "fillStyle": 1, "fillColor": "#a54c09" } }, { "type": "Polygon", "coords": [[42, 122], [82, 162], [2, 162]], "style": { "fillStyle": 1, "fillColor": "#fa8ccc" } }, { "type": "Polygon", "coords": [[162, 82], [162, 162], [82, 162]], "style": { "fillStyle": 1, "fillColor": "#f6ca29" } } ]); </script> </head>
<body style="margin:0px;" oncontextmenu="return false;"> <div id="graphWrapper" style="position:absolute; width:100%; height:100%; border:solid 0px #CCC;"></div> </body>
</html>
|