You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using line chart and binding float values from -1 to 1 at y axis and dates in x axis labels. What I could see that dates are getting duplicates one behind another initially after setting the data set and while scrolling as well. The issue is coming when I have more than 15-20 dates when scrolling is available otherwise I couldn't see the duplicate x labels.
I have debugged my code as well I could see no duplicate dates/entries in x labels array, FYI.
Sometimes, some weird output.
Sometimes duplicate values.
Please help any one what I'm doing wrong here.
Sharing my 2 functions where I'm configuring chart and setting up the data.
// Calling this function after above one
private fun loadTimeSeriesChartData(data: ArrayList) {
binding.chartTimeSeries.clear()
// Creating data set
data.reverse()
val xAxisDateLabel = arrayListOf<String>()
val xAxisActivityEntries = arrayListOf<Entry>()
data.forEachIndexed { index, activity ->
xAxisDateLabel.add(activity.activityDate)
if (!activity.value.isNullOrEmpty()) {
xAxisActivityEntries.add(
Entry(index.toFloat(), activity.value.toFloat().roundOffDecimal())
)
} else {
xAxisActivityEntries.add(Entry(index.toFloat(), 0f))
}
}
// Adding value formatter for x axis labels
binding.chartTimeSeries.xAxis.apply {
valueFormatter = IndexAxisValueFormatter(xAxisDateLabel)
setLabelCount(data.size, false)
}
// Setting chart data to plot after clearing values
setTimeSeriesChartData(xAxisActivityEntries)
// Configuring settings of chart after data is set
binding.chartTimeSeries.apply {
extraTopOffset = 20f
extraBottomOffset = 20f
// Setting minimum x labels to display
setVisibleXRangeMaximum(10f)
moveViewToX(xAxisActivityEntries.last().x)
// Redrawing chart to update data values
invalidate()
}
}
The text was updated successfully, but these errors were encountered:
I'm using line chart and binding float values from -1 to 1 at y axis and dates in x axis labels. What I could see that dates are getting duplicates one behind another initially after setting the data set and while scrolling as well. The issue is coming when I have more than 15-20 dates when scrolling is available otherwise I couldn't see the duplicate x labels.
I have debugged my code as well I could see no duplicate dates/entries in x labels array, FYI.
Sometimes, some weird output.
Sometimes duplicate values.
Please help any one what I'm doing wrong here.
Sharing my 2 functions where I'm configuring chart and setting up the data.
private fun configureLineChart() {
}
// Calling this function after above one
private fun loadTimeSeriesChartData(data: ArrayList) {
The text was updated successfully, but these errors were encountered: