How to show 2 text inputs with new lines on labels? Example: Weekly, Jan 1 - Jan 7 #505
Replies: 1 comment
-
Hi @smokiebacon |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How can one do a new line on the label data? I want to show weekly bars, so for example, 1 bar says Jan 1 on top, Jan 7 on bottom. The next bar will say Jan 8, then Jan 15 on bottom.
So far I have this (used chatGPT to generate part of this)
const aggregateDataByDate = (events) => {
const aggregatedData = {}
}
const aggregatedData = aggregateDataByDate(events)
function getBiggestYAxis() {
const maxYAxisChartNumber = aggregatedData.map((item) => item.value)
return Math.max(...maxYAxisChartNumber)
}
const totalDuration = events.reduce((sum, event) => {
return sum + event.duration
}, 0)
console.log(Dimensions.get("screen").width, events.length)
return (
<>
Duration {totalDuration.toFixed(2)}
{new Date().getFullYear()}
<View style={{ marginTop: 10 }}>
<BarChart
height={90}
maxValue={getBiggestYAxis()}
data={aggregateDataByDate(events)}
spacing={40}
barWidth={40}
bar
labelWidth={30}
frontColor={"pink"}
noOfSections={3}
yAxisTextStyle={{ color: "white" }}
width={Dimensions.get("screen").width - 70}
/>
</>
Beta Was this translation helpful? Give feedback.
All reactions