victory
victory copied to clipboard
Cannot read property 'concat' of undefined
I've got this crash when using VictoryBar:
Uncaught TypeError: Cannot read property 'concat' of undefined
at Object.getMinValue (collection.js?f8da:50)
at Object.padDomain (domain.js?e8cd:330)
at Object.getDomain (helper-methods.js?e57e:53)
at Object.getDomainFromChildren (wrapper.js?83a2:160)
at Object.getDomain (wrapper.js?83a2:54)
at getDomain (helper-methods.js?c3f1:64)
at VictoryChart.getCalculatedProps (victory-chart.js?7f95:133)
at VictoryChart.render (victory-chart.js?7f95:242)
This is my VictoryBar component:
<VictoryChart
height={height}
width={width}
padding={{ top: 20, bottom: 40, left: 70, right: 30 }}
theme={VictoryTheme}
containerComponent={<VictoryContainer responsive={true} />}
standalone={false}
colorScale={VictoryTheme.stack.colorScaleTopic}
>
<VictoryAxis
style={styles.victoryX}
domainPadding={5}
/>
<VictoryAxis dependentAxis style={styles.victoryY} />
<VictoryBar
data={data}
x="x"
y="y"
style={styles.bar}
barRatio={0.8}
/>
<VictoryChart />
I think it would be nice to not crash, maybe a warning that something is missing
Hi @sibelius! Thanks for reporting this. Can you console.log the data prop and post it here so I can try to reproduce the issue?
I had the same problem, and found out it has to do with the specific combination of having a domainPadding attribute set, and only 1 entry in the data. Removing the domainPadding in this situation solves it for me.