How to make a scrollable list of charts?
See original GitHub issueI wanted to have a list of multiple charts, one chart per card and multiple such cards laid out in a vertical list fashion. but when I do this, with a list of say 30 charts, the list doesn’t scroll (getting clipped abruptly at card #3 for instance).
Here’s a code fragment that I had tried:
//Simply prints a list made up of a repeated charts
@Composable
public fun ChartsContainer() {
Column(
modifier = Modifier
.fillMaxWidth()
.fillMaxHeight(0.8f)
.verticalScroll(rememberScrollState()),
) {
Spacer(modifier = Modifier.height(20.dp))
repeat(30) {
ChartCard(count = it)
}
}
}
@Composable
public fun ChartCard(count: Int = 0) {
val listFloatEntry1: List<FloatEntry> =
listOf(
FloatEntry(x = 0f, y = 500f),
FloatEntry(x = 10f, y = 300f),
FloatEntry(x = 20f, y = 100f),
)
val chartEntryModelProducer1: ChartEntryModelProducer = ChartEntryModelProducer()
chartEntryModelProducer1.setEntries(listFloatEntry1)
Card(modifier = Modifier.padding(3.dp)) {
Text("Chart number: $count")
Chart(
chart = columnChart(),
chartModelProducer = chartEntryModelProducer1,
startAxis = startAxis(title = "Foo", titleComponent = textComponent {}),
bottomAxis = bottomAxis(
title = "Baz",
titleComponent = textComponent {},
tickPosition = HorizontalAxis.TickPosition.Center(
offset = 0,
spacing = 5,
),
),
)
}
}
Here’s what the above looks like:
Notice how it’s getting clipped at the third chart and not scrollable.
How do I make a scrollable list of charts?
Issue Analytics
- State:
- Created a year ago
- Comments:7
Top Results From Across the Web
Creating a Scrolling chart - Microsoft Excel 2016
Creating a Scrolling chart ; 1. Select the data (in this example, B5:C96). ; 2. On the Insert ribbon, in the Charts group,...
Read more >How to Create a Scroll Bar in Excel - Step by Step Tutorial
Click on Scroll Bar (Form Control) button and click anywhere on your worksheet. This will insert a Scroll Bar in the excel worksheet....
Read more >How To Create A Dynamic Scrolling Chart In Excel
In order to use the scroll bar control, you must first add the Developer tab to Excel. Go here to learn how to...
Read more >Create Scrollable Tables, Charts & Maps in Adobe XD
To make this table scrollable, simply select the scrollable columns group, and once again enable a horizontal scroll group from the property ...
Read more >Creating Scrollable Charts - Logi Analytics
In the Scrollable Chart dialog, checkEnable Scrollable Chart, set Number of Visible Values to 10 and Percentage of Scrolling Area Height to 10%....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
As a workaround, you could set
isZoomEnabled
tofalse
. It looks like the zoom logic is what’s causing vertical swipes to be consumed. I’ve just resolved this bug.What @Gowsky is referring to is that if you place your finger in an area not occupied by a chart (such as the empty space between two cards) and then swipe, you should be able to trigger a scroll. The charts consume all vertical swipes at the moment, but we’ll be looking into improving this.