update NodeMap to display DotButton and add zoom/pan

This commit is contained in:
axolotle
2021-05-23 21:47:40 +02:00
parent f014a0b654
commit 3d28a54f07
2 changed files with 117 additions and 50 deletions
+4 -6
View File
@@ -22,7 +22,7 @@ function getLinked (text) {
}
export function toSingleManyData (rawData) {
rawData.first = true
rawData.isOrigin = true
const h = hierarchy(rawData, d => getLinked(d))
h.each(node => {
if (node.parent && node.children) {
@@ -35,8 +35,7 @@ export function toSingleManyData (rawData) {
const links = h.links()
nodes.forEach(node => {
Object.assign(node.data, {
type: node.data.type.toLowerCase(),
class: 'family-' + node.data.families[0].id
type: node.data.type.toLowerCase()
})
})
return { nodes, links }
@@ -44,7 +43,7 @@ export function toSingleManyData (rawData) {
export function toManyManyData (rawData) {
rawData.first = true
rawData.isOrigin = true
const h = hierarchy(rawData, d => getLinked(d))
h.each(node => {
if (node.parent && node.children) {
@@ -79,8 +78,7 @@ export function toManyManyData (rawData) {
id: data.id,
data: {
...data,
type: data.type.toLowerCase(),
class: 'family-' + data.families[0].id
type: data.type.toLowerCase()
}
}
})