lightweight-charts-android icon indicating copy to clipboard operation
lightweight-charts-android copied to clipboard

Compose: ChartView blinks with white color

Open sudansh opened this issue 1 year ago • 0 comments

I am using Android Compose and setting background but there white background comes up momentarily before setting up the background color. I have gone through previous issues on white color like 38 which was closed but still persists

code:

AndroidView(
                modifier = Modifier,
                factory = {
                    ChartsView(it).apply {
                        with(api) {
                            applyOptions {
                                layout = layoutOptions {
                                    background = SolidColor(Color.Green)
                                }
                            }
                        }
                    }
                },
                update = { chartsView ->
                    with(chartsView.api) {
                        applyOptions {
                            layout = layoutOptions {
                                background = SolidColor(surfaceColor)
                            }
                        }
                        addHistogramSeries(
                            options = histogramSeriesOptions {
                                color = barColor
                                visible = false
                                priceScaleId = PriceScaleId("")
                            },
                            onSeriesCreated = { seriesApi ->
                                seriesApi.priceScale().applyOptions(PriceScaleOptions().apply {
                                    scaleMargins = PriceScaleMargins(
                                        top = 0.7f,
                                        bottom = 0f,
                                    )
                                })
                                seriesApi.setData(barData.distinctBy { it.time })
                            }
                        )
                    }
                }
            )

https://github.com/tradingview/lightweight-charts-android/assets/61079/b21e5f42-d4d6-44d9-81f3-b73c0876e69d

sudansh avatar Nov 07 '23 11:11 sudansh