|
1 | 1 | <template> |
2 | | - <div> |
3 | | - <h2>Force-based label placement II</h2> |
4 | | - <svg id="viz"></svg> |
| 2 | + <div class="force-base-iii"> |
| 3 | + <h2>Force-based label placement III</h2> |
| 4 | + <svg id="viz" class="container-border"></svg> |
5 | 5 | </div> |
6 | 6 | </template> |
7 | 7 |
|
8 | 8 | <script> |
9 | 9 | import * as d3 from 'd3' |
10 | | -// import jsonData from '../assets/json/simple_force_layout.json' |
| 10 | +import jsonData from '../assets/json/simple_force_layout.json' |
11 | 11 | // import jsonData from '../assets/json/simple_force_layout_2.json' // 金融数据 |
12 | | -import jsonData from '../assets/json/simple_force_layout_3.json' |
| 12 | +// import jsonData from '../assets/json/simple_force_layout_3.json' // 新基建数据 |
13 | 13 | export default { |
14 | 14 | name: 'ForceBasedLabelPlacement', |
15 | 15 | data () { |
@@ -80,13 +80,13 @@ export default { |
80 | 80 |
|
81 | 81 | this.restart() |
82 | 82 |
|
83 | | - // setTimeout(() => { |
84 | | - // let addData = [{ 'id': 'Four', 'group': 4 }, { 'id': 'Five', 'group': 5 }] |
85 | | - // let addLinks = [{ 'source': 'Four', 'target': 'Five', 'value': 3 }, { 'source': 'Five', 'target': 'Feuilly', 'value': 4 }] |
86 | | - // this.graph.nodes = [...this.graph.nodes, ...addData] |
87 | | - // this.graph.links = [...this.graph.links, ...addLinks] |
88 | | - // this.restart() |
89 | | - // }, 1000) |
| 83 | + setTimeout(() => { |
| 84 | + let addData = [{ 'id': 'Four', 'group': 4 }, { 'id': 'Five', 'group': 5 }] |
| 85 | + let addLinks = [{ 'source': 'Four', 'target': 'Five', 'value': 3 }, { 'source': 'Five', 'target': 'Feuilly', 'value': 4 }] |
| 86 | + this.graph.nodes = [...this.graph.nodes, ...addData] |
| 87 | + this.graph.links = [...this.graph.links, ...addLinks] |
| 88 | + this.restart() |
| 89 | + }, 1000) |
90 | 90 | }, |
91 | 91 | methods: { |
92 | 92 | restart () { |
@@ -161,8 +161,14 @@ export default { |
161 | 161 | } |
162 | 162 | } |
163 | 163 | </script> |
164 | | -<style scoped> |
165 | | -svg { |
166 | | - border: 1px solid #ccc; |
| 164 | +<style> |
| 165 | +.force-base-iii .links line { |
| 166 | + stroke: #999; |
| 167 | + stroke-opacity: 0.6; |
| 168 | +} |
| 169 | +
|
| 170 | +.force-base-iii .nodes circle { |
| 171 | + stroke: black; |
| 172 | + stroke-width: 0px; |
167 | 173 | } |
168 | 174 | </style> |
0 commit comments