react-native-chart-kit
react-native-chart-kit copied to clipboard
How to center ContributionGraph?
Hi. I tried using style prop to center the graph but didn't work.
const graphStyle ={
justifyContent: 'center',
alignItems: 'center',
flex:1,
};
Then, I found out paddingLeft value was hardcoded. Can I add a pull request to change this value customizable via props? Or do let me know if I made any mistake in the above code.
src/contribution-graph/index.js line 8: const paddingLeft = 32;
inside the renderSquare function
<Rect
key={index}
width={squareSize}
height={squareSize}
x={x + paddingLeft}
...
/>
inside the renderMonth function
<Text
key={weekIndex}
x={x + paddingLeft}
y={y + 8}
{....getPropsForLabels()}
>
{this.props.getMonthLabel
? this.props.getMonthLabel(endOfWeek.getMonth())
: MONTH_LABELS[endOfWeek.getMonth()]}
</Text>
and also, I think it would be nice to make padding between month label and graph customizable.
+1 Found the same issue, it'd be an easy way great to make the graph center
The same issue

@ji-1 How did you set the colors of the text (Jan, Feb, Mar, ...?)
Even I want the ContributionGraph to be centered, instead of the bottom
@ji-1 any solution for this?