question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to make a scrollable list of charts?

See original GitHub issue

I 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: Chart list not scrollable

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:closed
  • Created a year ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
ghostcommented, Dec 16, 2022

As a workaround, you could set isZoomEnabled to false. It looks like the zoom logic is what’s causing vertical swipes to be consumed. I’ve just resolved this bug.

1reaction
ghostcommented, Oct 20, 2022

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found