lightweight-charts-android
lightweight-charts-android copied to clipboard
Compose: ChartView blinks with white color
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