Victory Native:为刻度标签分配固定宽度并在文本溢出时显示省略号

问题描述

我正在编写代码以使用 Victory Native 根据用户数据显示条形图。我正在尝试执行以下操作:

  1. 为条形图中的刻度标签指定固定宽度。
  2. 如果刻度标签的文本溢出,则应用省略号。 (类似于 CSS 中的 text-overflow:ellipsis 属性

我如何做到以上几点?显然 Victory Native 有自己的 props,它不是内置的 react native props,并且在文档中找不到执行上述操作的 props。有什么建议吗?

以下是我用于图表的代码

<VictoryChart
    theme={VictoryTheme.material}
>
    <VictoryAxis style=
        {{ 
            axis: {stroke: "none"},ticks: {stroke: "none"},grid: {stroke:"none"},tickLabels: {fontSize:15,fill:'black',fontWeight:'bold'}
        }} 
    />
    <VictoryBar
        style={{ data: { fill: "#ffdd20",strokeWidth: 6 },labels: { fontSize:15,fill:"black"} }}
        horizontal
        data={ratingstat}
        x="rating"
        y="count"
        labels={({datum})=>datum.count}
        alignment="middle"
    />
</VictoryChart>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)