|
@@ -26,8 +26,9 @@ for (let index = 0; index < rawPathDataIndex2.length; index++) {
|
|
|
rawPathData2.data.push(element)
|
|
|
}
|
|
|
|
|
|
-// 原始数据处理成二维数组
|
|
|
-let wholeInputPointArray = rawWholeData.data.map((eachString) => {
|
|
|
+// 原始字符串数组处理成二维数组
|
|
|
+let wholeInputPointArray = rawWholeData.data.map((eachString, index) => {
|
|
|
+ console.assert(eachString.split(' ').length === 12, `index ${index}处数据点 数字个数不是12!`)
|
|
|
return eachString.split(' ')
|
|
|
})
|
|
|
let pathInputPointArray = rawPathData.data.map((eachString) => {
|
|
@@ -142,7 +143,7 @@ export default {
|
|
|
d3.select(this).attr('fill', 'black')
|
|
|
that.infoText = ''
|
|
|
})
|
|
|
-
|
|
|
+
|
|
|
d3.select('svg').selectAll('circle').data(pathDataForRender).enter().append('circle')
|
|
|
.attr('cx', (d) => d[0])
|
|
|
.attr('cy', (d) => d[1])
|
|
@@ -153,10 +154,12 @@ export default {
|
|
|
return d
|
|
|
})
|
|
|
|
|
|
+ // todo: 不用数字,改用不同颜色的图形。
|
|
|
d3.select('svg').selectAll('text').data(pathDataForRender2).enter().append('text')
|
|
|
.text('1')
|
|
|
.attr('x', (d) => d[0])
|
|
|
.attr('y', (d) => d[1] + 0.36 * pxPerUnitLength / 2)
|
|
|
+ .attr('fill', 'green')
|
|
|
.attr('text-anchor', 'middle')
|
|
|
.attr('pointer-events', 'none')
|
|
|
}
|