I'm using Victory to render a data set:
class App extends React.Component {
render() {
return (
<div style={{ width: 600 }}>
<VictoryChart domainPadding={30}>
<VictoryAxis
dependentAxis={true}
style={{
grid: { stroke: "grey" }
}}
/>
<VictoryAxis />
<VictoryBar
barWidth={20}
style={{ data: { fill: "red" } }}
data={[
{ x: new Date("2019-01-01"), y: 2 },
{ x: new Date("2019-02-01"), y: 3 },
{ x: new Date("2019-03-01"), y: 5 },
{ x: new Date("2019-04-01"), y: 4 },
{ x: new Date("2019-05-01"), y: 8 },
{ x: new Date("2019-06-01"), y: 2 },
{ x: new Date("2019-07-01"), y: 3 },
{ x: new Date("2019-08-01"), y: 5 },
{ x: new Date("2019-09-01"), y: 9 },
{ x: new Date("2019-10-01"), y: 3 },
{ x: new Date("2019-11-01"), y: 5 },
{ x: new Date("2019-12-01"), y: 6 }
]}
/>
</VictoryChart>
</div>
);
}
}
How can I change the x-axis to render a tick for each month ("jan", "feb", "mar" etc.)? Further, I would like each bar to have a width of 40 px (barWidth=40), but when I do that all bars are just merged - I would like to control the margin/padding between the bars as well. How should this be solved?
An example is available in this sandbox: https://codesandbox.io/s/victory-react-native-4t49q