-
Notifications
You must be signed in to change notification settings - Fork 126
Open
Description
I managed to display the bubble chart but the data did not change even though the data changed (dynamic), how to fix it?, this is the code I put inside onCreate:
val aaChartView = binding.aaChartView
val aaChart = AAChart()
.type(AAChartType.Bubble)
val getTglIjtimaMasehi = awalBulanViewModel.getTglIjtimaMasehi()
val aaTitle = AATitle()
.text("Visualisasi Hilal $getTglIjtimaMasehi")
val aaXAxis = AAXAxis()
.min(240f)
.max(300f)
.tickInterval(10f)
.title(AATitle().text("X Azimuth"))
.gridLineWidth(1f)
val aaYAxis = AAYAxis()
.min(-10f)
.max(25f)
//.title(AATitle().text("Y Alt Hilal"))
.lineWidth(1f)
.gridLineWidth(1f)
val aaLegend = AALegend()
.enabled(true)
sunAltD = awalBulanViewModel.getSunAltD()
moonAltD = awalBulanViewModel.getMoonAltD()
sunAzD = awalBulanViewModel.getSunAzD()
moonAzD = awalBulanViewModel.getMoonAzD()
fun generateBubbleDataSun(): Array<Any> {
val data = mutableListOf<Any>()
data.add(arrayOf(sunAzD, sunAltD, 2.0))
return data.toTypedArray()
}
fun generateBubbleDataMoon(): Array<Any> {
val data = mutableListOf<Any>()
data.add(arrayOf(moonAzD, moonAltD, 2.0))
return data.toTypedArray()
}
val aaSeriesElementSun = AASeriesElement()
.name("SUN")
.data(generateBubbleDataSun())
.color("#FFFD22")
val aaSeriesElementMoon = AASeriesElement()
.name("MOON")
.data(generateBubbleDataMoon())
.color("#BFBFBF")
val aaOptions = AAOptions()
.chart(aaChart)
.title(aaTitle)
.xAxis(aaXAxis)
.yAxis(aaYAxis)
.legend(aaLegend)
.series(arrayOf(aaSeriesElementSun, aaSeriesElementMoon))
aaChartView.aa_drawChartWithChartOptions(aaOptions)
aaChartView.aa_updateChartWithOptions(aaOptions, true)
aaChartView.aa_onlyRefreshTheChartDataWithChartOptionsSeriesArray(arrayOf(aaSeriesElementSun, aaSeriesElementMoon), true)
aaChartView.aa_refreshChartWithChartOptions(aaOptions)
Metadata
Metadata
Assignees
Labels
No labels