![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
@antv/chart-node-g6
Advanced tools
自定义 G6 图表节点的工具包。
在一些复杂的场景中,需要的节点类型也比较复杂,如在节点中展示某类数据的分布、趋势等,就像下面的节点:
为了方便用户在使用 G6 自定义节点时支持统计图表,我们基于 G2 封装了 @antv/chart-node-g6 工具包,该工具包支持将 G6.registerNode / G6.registerEdge / G6.registerCombo 方法中的第二个参数 group 作为容器。除过不支持交互外,其他使用方式基本和 G2 的用法完全一致。
定义上面节点的代码如下所示。
import G6 from '@antv/g6'
import Chart from '@antv/chart-node-g6'
G6.registerNode('node-with-interval', {
draw(cfg, group) {
const keyShape = group.addShape('rect', {
attrs: {
x: 0,
y: 0,
width: 400,
height: 200,
fill: cfg.style.fill
}
})
group.addShape('rect', {
attrs: {
x: 0,
y: 0,
width: 400,
height: 40,
fill: '#69c0ff'
}
})
group.addShape('text', {
attrs: {
text: '浏览申请完成率',
x: 10,
y:25,
fontSize: 14,
fill: '#fff'
}
})
group.addShape('text', {
attrs: {
text: '2020-06-07 ~ 2020-06-14 | 均值',
x: 20,
y: 70,
fontSize: 13,
fill: '#8c8c8c'
}
})
group.addShape('text', {
attrs: {
text: '8.8%',
x: 20,
y: 110,
fontSize: 30,
fill: '#000'
}
})
// 统计图表部分
const view = new Chart({
group,
region: {
start: {
x: 0.01,
y: 0.2
},
end: {
x: 0.8,
y: 0.35
}
},
})
view.data(cfg.trendData);
view
.interval()
.position("genre*sold")
.color("genre");
view.legend("genre", false);
view.scale({
genre: {
alias: "游戏种类" // 列定义,定义该属性显示的别名
},
sold: {
alias: "销售量"
}
});
view.axis('sold', false)
view.render();
keyShape.set('intervalView', view)
return keyShape
},
update(cfg, item) {
const keyShape = item.getKeyShape()
const view = keyShape.get('intervalView')
view.changeData(cfg.trendData)
}
}, 'single-node')
FAQs
The Chart Toolkit of G6 Graph Node
The npm package @antv/chart-node-g6 receives a total of 156 weekly downloads. As such, @antv/chart-node-g6 popularity was classified as not popular.
We found that @antv/chart-node-g6 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 34 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.