Responsive Dendrogram #1919
Unanswered
RuslanBuzadj
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Help!!)) How can I create a responsive Dendrogram so that when I decrease or increase the size of the svg text and the rectangle around the text will decrease proportionally, I tried to do this with scale but it didn't work out so well.
import { Group } from '@visx/group'
import { Cluster, hierarchy } from '@visx/hierarchy'
import { HierarchyPointNode } from '@visx/hierarchy/lib/types'
import { MarkerArrow } from '@visx/marker'
import { ScaleSVG, useParentSize } from '@visx/responsive'
import { LinkHorizontalStep } from '@visx/shape'
import { useLayoutEffect, useMemo, useRef, useState } from 'react'
interface NodeShape {
name: string
children?: NodeShape[]
_width?: number
}
const clusterData: NodeShape = {
name: '192.129.1.1',
children: [
{
name: '192.129.1.1',
children: [
{ name: '192.129.1.1' },
{ name: '192.129.1.1' },
{
name: 'C',
children: [
{
name: '192.129.1.1',
},
],
},
],
},
{
name: 'some 192.129.1.1',
children: [
{ name: '192.129.1.1' },
{ name: '192.129.1.1' },
{ name: '192.129.1.1' },
],
},
{
name: '192.129.1.1',
children: [
{
name: '192.129.1.1',
},
],
},
],
}
function Node({
node,
onWidthMeasured,
}: {
node: HierarchyPointNode
onWidthMeasured: (name: string, width: number) => void
}) {
}
const defaultMargin = { top: 10, left: 8, right: 0, bottom: 10 }
export type TreeProps = {
margin?: { top: number; right: number; bottom: number; left: number }
}
const DiscoveredMapChart = ({ margin = defaultMargin }: TreeProps) => {
const { parentRef, width, height } = useParentSize({ debounceTime: 150 })
}
export default DiscoveredMapChart
Beta Was this translation helpful? Give feedback.
All reactions