Transaction

inner class Transaction

Handles data updates. An initially empty list of data sets is created and can be updated via the class’s functions. Each data set corresponds to a single nested Chart.

Functions

Link copied to clipboard
fun add(vararg series: List<ChartEntry>)

Adds a data set comprising the provided series.

fun add(dataSet: List<List<ChartEntry>>)
fun add(index: Int, dataSet: List<List<ChartEntry>>)

Adds a data set.

Link copied to clipboard
fun clear()

Clears the new list of data sets.

Link copied to clipboard

Requests a data update. If the update is accepted, true is returned. If the update is rejected, which occurs when there’s already an update in progress, false is returned. For suspending behavior, use commitSuspending.

Link copied to clipboard
suspend fun commitSuspending(): Deferred<Unit>

Runs a data update. Unlike commit, this function suspends the current coroutine and waits until an update can be run, meaning the update cannot be rejected. The returned Deferred implementation is marked as completed once the update has been processed.

Link copied to clipboard
fun populate()

Populates the new list of data sets with the current data sets.

Link copied to clipboard
fun removeAt(index: Int)

Removes the data set at the specified index.

Link copied to clipboard
fun set(pair: Pair<Int, List<List<ChartEntry>>>)

Replaces the data set at the specified index (Pair.first) with the provided data set (Pair.second).

fun set(index: Int, dataSet: List<List<ChartEntry>>)

Replaces the data set at the specified index with the provided data set.

Link copied to clipboard

Allows for adding auxiliary values, which can later be retrieved via ChartEntryModel.extraStore.