如何在 React Native svg 图表中添加自定义时间线

发布于 2025-01-15 14:04:44 字数 80 浏览 1 评论 0原文

我正在使用 React Native svg 图表在折线图上显示一些数据。数据与需要在 x 轴上标记的某个时间相关联,任何人都可以告诉我该怎么做。

I am using react native svg charts to display some data on line chart .the data is associated with some time which need to be labelled on x axis can anybody tell me how can I do it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

最偏执的依靠 2025-01-22 14:04:44

当我们查看 LineChart 时,它会像这样绘制线条。

  • 它接受 50 个点和 10 个点,并在它们之间画一条线

  • 它接受 10 作为点和 40 点,并在之间绘制一条线

    类 LineChartExample 扩展了 React.PureComponent {
    使成为() {
    常量数据 = [50, 10, 40, 95, -4, -24, 85, 91, 35, 53, -53, 24, 50, -20, -80]

    <前><代码>返回(
    <折线图
    样式={{高度:200}}
    数据={数据}
    svg={{ 笔画: 'rgb(134, 65, 244)' }}
    contentInset={{ 顶部:20,底部:20 }}
    >
    <网格>>

    }
    }

When we look at LineChart, it draws the lines like this.

  • It accepts 50 as points and 10 points and draws a line between

  • It accepts 10 as points and 40 points and draws a line between

    class LineChartExample extends React.PureComponent {
    render() {
    const data = [50, 10, 40, 95, -4, -24, 85, 91, 35, 53, -53, 24, 50, -20, -80]

     return (
         <LineChart
             style={{ height: 200 }}
             data={data}
             svg={{ stroke: 'rgb(134, 65, 244)' }}
             contentInset={{ top: 20, bottom: 20 }}
         >
             <Grid />
         </LineChart>
     )
    

    }
    }

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文