Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cocoa/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
React native 胜利土生土长';s VictoryBar标签显示不正确_React Native_Victory Charts - Fatal编程技术网

React native 胜利土生土长';s VictoryBar标签显示不正确

React native 胜利土生土长';s VictoryBar标签显示不正确,react-native,victory-charts,React Native,Victory Charts,我无法使我的VictoryBar图表在React本机应用程序中正确显示标签。x轴表示天数,y轴表示数值。我想显示图表 值,但它会显示日期。我已经设置了labels属性,但它什么也不做。如图所示,当我运行console.log(d)时不会发生任何事情。此代码的结果如下所示 “本机反应”:“0.59.9” “victory native”:“^32.0.2” “反应本机svg”:“^9.5.1” 谢谢 <VictoryChart domainPadding={70}> <Vic

我无法使我的VictoryBar图表在React本机应用程序中正确显示标签。x轴表示天数,y轴表示数值。我想显示图表 值,但它会显示日期。我已经设置了labels属性,但它什么也不做。如图所示,当我运行console.log(d)时不会发生任何事情。此代码的结果如下所示

“本机反应”:“0.59.9” “victory native”:“^32.0.2” “反应本机svg”:“^9.5.1”

谢谢

<VictoryChart domainPadding={70}>
  <VictoryBar 
     data={bars} 
     x="label"  
     y="value"
     // animate={{ onLoad: { duration: 1000 } }}
     style={{ data: { width: 20, fill: (d) => d.x === 3 ? "#000000" : "#49C6B7" }}}
     labels={(d)=>{console.log(d);return d.y}}
  />
  <VictoryAxis
    //x
    tickLabelComponent={<VictoryLabel angle={45} />}
    style={{
      axis: {stroke: 'grey'},
      ticks: {stroke: 'white'},
      tickLabels: {fontSize: 12, padding: 3, marginLeft:10, stroke:"white", verticalAnchor: "middle", textAnchor:'start'}
    }}
  />
  <VictoryAxis
  //y
    tickFormat={(d)=> numeral(d).format('0.0a')}
    dependentAxis
    style={{
    axis: {stroke: "grey"},
    grid: {stroke:'grey'},
    tickLabels: {fontSize: 0, padding: 0,   stroke:'white'}
    }}
  />
</VictoryChart> 

d、 x==3?“#000000”:“#49C6B7”}}”
labels={(d)=>{console.log(d);返回d.y}
/>
数字(d).格式('0.0a')}
依赖出租车
风格={{
轴:{笔划:“灰色”},
网格:{stroke:'grey'},
tickLabels:{fontSize:0,padding:0,stroke:'white'}
}}
/>


({
_y:0,
填充:“橙色”,
标签:“再见”
})
}
}}
/>
`${datum.y}`}//


({
_y:0,
填充:“橙色”,
标签:“再见”
})
}
}}
/>
`${datum.y}`}//

好的。。。通过将数据更改为具有“x”和“y”值的对象数组来保存自己。我用“标签”和“值”代替了x和y。否则,我想不出如何实现这一点。请分享,如何在Y轴上显示K和M值,因为我无法显示超过100000个值。请帮帮我,我卡住了。谢谢你。。。通过将数据更改为具有“x”和“y”值的对象数组来保存自己。我用“标签”和“值”代替了x和y。否则,我想不出如何实现这一点。请分享,如何在Y轴上显示K和M值,因为我无法显示超过100000个值。请帮帮我,我卡住了,谢谢
labels={({ datum }) => `${datum.y}`}
import { VictoryBar,VictoryChart,VictoryAxis,VictoryTheme } from "victory-native";
<>
      <VictoryChart
  domainPadding={{ x: 20 }}
>
  <VictoryBar
    data={[
      { x: "Year 1", y: 150 },
      { x: "Year 2", y: 250 },
      { x: "Year 3", y: 100 },
      { x: "Year 4", y: 750 },
      { x: "Year 5", y: 100 }
    ]}
    style={{
      data: { fill: "black", width: 12 }
    }}
    animate={{
      onExit: {
        duration: 500,
        before: () => ({
          _y: 0,
          fill: "orange",
          label: "BYE"
        })
      }
    }}
  />
  </VictoryChart>
<VictoryChart
    responsive={false}
    animate={{
      duration: 500,
      onLoad: { duration: 200 }
    }}
    domainPadding={{ x: 0 }}
    theme={VictoryTheme.material}
  >
    <VictoryAxis />
    <VictoryBar
      barRatio={1}
      cornerRadius={0} 
      style={{ data: { fill: "#6DB65B" } }}
      alignment="middle"
      labels={({ datum }) => `${datum.y}`} // <-- important
      data={[
        { x: "Year 1", y: 150 },
        { x: "Year 2", y: 250 },
        { x: "Year 3", y: 100 },
        { x: "Year 4", y: 750 },
        { x: "Year 5", y: 100 }
      ]}
    />
  </VictoryChart>
  </>