We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Legend doesn't appear in a Line chart with multiple Line children. Also tooltip doesn't render correct text.
Abstracted component:
import dynamic from 'next/dynamic'; import { chartColors } from 'config/colors'; const Line = dynamic( () => import('@ant-design/plots').then(({ Line }) => Line), { ssr: false } ); function MultiLineChart(props) { const { xField, yFields, data, height, axis } = props; const config = { data, xField, legend: true, children: yFields.map((yField, index) => ({ type: 'line', yField, style: { stroke: chartColors[index] ?? chartColors[0], lineWidth: 2, }, })) }; return <Line {...config} />; }
Usage:
function App() { const data = [ { date: 'April', x: 55, y: 17 }, { date: 'May', x: 43, y: 26 }, { date: 'June', x: 70, y: 53 }, { date: 'July', x: 96, y: 68 }, ]; return <MultiLineChart data={data} xField="date" yFields={["x", "y"]} />; }
Result:
I expect this kind of legend to appear:
The text was updated successfully, but these errors were encountered:
No branches or pull requests
🧐 问题描述 [详细地描述问题,让大家都能理解]
Legend doesn't appear in a Line chart with multiple Line children. Also tooltip doesn't render correct text.
💻 示例代码 [如果有必要,展示代码,线上示例,或仓库]
Abstracted component:
Usage:
🚑 其他信息 [如截图等其他信息可以贴在这里]
Result:
I expect this kind of legend to appear:
The text was updated successfully, but these errors were encountered: