yxcxyc
This commit is contained in:
@@ -438,6 +438,11 @@
|
||||
}
|
||||
|
||||
function SimpleChart(props) {
|
||||
function pointTooltip(seriesLabel, point) {
|
||||
const label = seriesLabel ? `${seriesLabel} · ` : '';
|
||||
return `${label}${String(point.x)}: ${fmtNumber(point.y, 6)}`;
|
||||
}
|
||||
|
||||
const series = Array.isArray(props.series)
|
||||
? props.series
|
||||
.map((item, index) => ({
|
||||
@@ -529,7 +534,9 @@
|
||||
height: height - padding - coord[1],
|
||||
rx: 8,
|
||||
fill: 'rgba(59, 130, 246, 0.75)',
|
||||
});
|
||||
}, [
|
||||
h('title', { key: 'title' }, pointTooltip(seriesCoords[0].label, seriesCoords[0].data[index])),
|
||||
]);
|
||||
}))
|
||||
: h('g', { key: 'series' }, seriesCoords.flatMap((item, index) => {
|
||||
const nodes = [];
|
||||
@@ -557,7 +564,9 @@
|
||||
fill: '#f8fafc',
|
||||
stroke: item.color,
|
||||
strokeWidth: 2,
|
||||
}))));
|
||||
}, [
|
||||
h('title', { key: 'title' }, pointTooltip(item.label, item.data[pointIndex])),
|
||||
]))));
|
||||
return nodes;
|
||||
})),
|
||||
]),
|
||||
|
||||
Reference in New Issue
Block a user