import { isFunction } from '@antv/util'; import { jsx } from '@antv/f-engine'; const Marker = ({ type, color }) => { if (type === 'square') { return ( ); } if (type === 'line') { return ( ); } return ( ); }; export default (props) => { const { items, itemWidth, itemFormatter, style, marker = 'circle', // 图例标记默认为 circle itemStyle, nameStyle, valueStyle, valuePrefix, onClick, layoutMode, } = props; const formatValue = (value, valuePrefix = ': ') => { return `${valuePrefix}${value}`; }; return ( {items.map((item) => { const { color, name, value, filtered, tickValue, highlighted } = item; const valueText = isFunction(itemFormatter) ? itemFormatter(value, tickValue) : value; const highlightStyle = highlighted ? { fill: color, fillOpacity: 0.2, radius: '6px' } : {}; return ( {Marker({ color: filtered ? '#bfbfbf' : color, type: item?.marker || marker })} {/* */} {valueText ? ( ) : null} ); })} ); };