πŸ“‘Data Types for Circular Plots

Introduction

Unlike the data types for linear plots, we don't have any custom data types for circular plots and are using the primary pair <T , V> to represent each data observation.

We use the following class to create data sets for circular plots.

  • List Data Strategy

List Data Strategy

This is one of the strategies in the library to format and manipulate the data fed for the observations. It take two types of data :-

  • itemsList - This is a List <Pair<String , Float> where each pair represents an observation. The first element in the pair is the title of data and the second element is the actual value.

  • unit - This represents the unit of the values.

Static List Data Strategy

Data objects which are static and won't change or need any re - composition, can be created normally like any other class object creation.

Here's an example of how to create it :-

// Creating List Data Strategy
val dataSet1 = ListDataStrategy(
    itemsList = listOf(
        Pair("Google", 100f), // 1st Observation
        Pair("Amazon", 109f) // 2nd Observation
    ),
    unit = "users" // Unit
)

State List Data Strategy

Data Sets that need to be remembered during re - composition can also be made and used like a mutable State data. Developers can create them for Dynamic UIs where the data plots need to be re-composed when the data changes.

Here's an example of how to do it :-

// Creating List Data Strategy
val dataSet1 by remember {
    mutableStateOf(
        ListDataStrategy(
            itemsList = listOf(
                Pair("Google", 100f), // 1st Observation
                Pair("Amazon", 109f) // 2nd Observation
            ),
            unit = "users" // Unit
        )
    )
}
⏺️Circular Plots

Last updated

Was this helpful?