{
const data = dataOf(lib);
const height = heightOf(lib);
const chart = new G2.Chart();
chart.options({
type: "view",
coordinate: { transform: [{ type: "transpose" }] },
width,
height,
paddingLeft: 60,
paddingRight: 100,
children: [
{
type: "tree",
data: { value: data },
style: {
nodeFill: (d) => (d.height === 0 ? "#999" : "#000"),
linkStroke: "#999",
labelText: (d) => d.data.name || "-",
labelFontSize: (d) => (d.height === 0 ? 7 : 12),
labelTextAlign: (d) => (d.height === 0 ? "start" : "end"),
labelPosition: (d) => (d.height !== 0 ? "left" : "right"),
labelDx: (d) => (d.height === 0 ? 5 : -5),
labelBackground: true,
labelBackgroundFill: "#fff"
}
}
]
});
return chart.render().then((chart) => chart.getContainer());
}