In real projects, we need to customize the icons according to the business situation. Graphin recommends that users directly Fork @antv/graphin-icons project To complete your own custom icon. Proceed as follows
UniCode in the figure above to iconfont.css, and copy the iconfont.json file in the downloaded and decompressed file to your projectimport React from 'react';import Graphin from '@antv/graphin';// Import resource filesimport './iconfont.css';import fonts from './iconfont.json';// Generate iconLoader functionconst iconLoader = () => {return {fontFamily: 'iconfont',glyphs: fonts.glyphs,};};// Register to Graphinconst { fontFamily, glyphs } = iconLoader();const icons = Graphin.registerFontFamily(iconLoader);// Use iconsconst data = {nodes: glyphs.map(glyph => {return {id: `node-${glyph.name}`,style: {icon: {type: 'font', // Specify the icon to be Font typefontFamily, // Specify FontFamilyvalue: icons[glyph.name], // Specify the value of the icon},},};}),edges: [],};export default () => {return <Graphin data={data} />;};