完善图例和样式设置;调整属性框的最大长度

This commit is contained in:
JIANG
2025-11-21 11:15:03 +08:00
parent 23154b2b5f
commit 15e80f105e
3 changed files with 83 additions and 42 deletions

View File

@@ -36,38 +36,38 @@ const StyleLegend: React.FC<LegendStyleConfig> = ({
const color = colors[index]; // 默认颜色为黑色
const dimension = dimensions[index]; // 默认尺寸为16
// 处理第一个区间(小于 breaks[0]
if (index === 0) {
return (
<Box key={index} className="flex items-center gap-2 mb-1">
<Box
sx={
type === "point"
? {
width: dimension,
height: dimension,
borderRadius: "50%",
backgroundColor: color,
}
: {
width: 16,
height: dimension,
backgroundColor: color,
border: `1px solid ${color}`,
}
}
/>
<Typography variant="caption" className="text-xs">
{"<"} {breaks[0]?.toFixed(1)}
</Typography>
</Box>
);
}
// // 处理第一个区间(小于 breaks[0]
// if (index === 0) {
// return (
// <Box key={index} className="flex items-center gap-2 mb-1">
// <Box
// sx={
// type === "point"
// ? {
// width: dimension,
// height: dimension,
// borderRadius: "50%",
// backgroundColor: color,
// }
// : {
// width: 16,
// height: dimension,
// backgroundColor: color,
// border: `1px solid ${color}`,
// }
// }
// />
// <Typography variant="caption" className="text-xs">
// {"<"} {breaks[0]?.toFixed(1)}
// </Typography>
// </Box>
// );
// }
// 处理中间区间breaks[index-1] - breaks[index]
if (index < breaks.length) {
const prevValue = breaks[index - 1];
const currentValue = breaks[index];
// 处理中间区间breaks[index] - breaks[index + 1]
if (index + 1 < breaks.length) {
const prevValue = breaks[index];
const currentValue = breaks[index + 1];
return (
<Box key={index} className="flex items-center gap-2 mb-1">
<Box