E.g. This is what I tried so far: ```val plotData...
# datascience
c
E.g. This is what I tried so far:
Copy code
val plotData = buildMap<String, List<Any>> {
            // This creates synthetic points for each label, assigned near the first x/y coordinate. The
            // first coordinate is likely to be "smothered" but it otherwise should keep the perspective of the graph.
            val sortedLabels = allLabels.sorted()
                .mapIndexed { index: Int, label: String ->
                    TimeSeriesRow(
                        label,
                        data.first().x - 1.seconds + (0.001.seconds * index),
                        data.first().y
                    )
                }
            val concatenatedData = sortedLabels + data

            put(LABELS, concatenatedData.map { it.label })

            val groups = sortedLabels.map { PRE_FIRST_GROUP_VALUE } + (data.map { it.label }.group())
            // Lets Plot has an undocumented hardcoded limit of 1,000 groups
            check(groups.toSet().size < MAX_GROUPS) { "Cannot have more than 1,000 groups of data" }
            put(GROUPS, groups)

            put(X, concatenatedData.map { it.x })
            put(Y, concatenatedData.map { it.y })
        }