Skip to content
This repository was archived by the owner on Sep 28, 2024. It is now read-only.
This repository was archived by the owner on Sep 28, 2024. It is now read-only.

Chart builders with data parameter for all charttypes #1132

@HoldYourWaffle

Description

@HoldYourWaffle

Is there a reason why only the piechart builder has a data parameter?

/**
* Create a PieChart with optional title data and add to the parent pane. The optional op will be performed on the new instance.
*/
fun EventTarget.piechart(title: String? = null, data: ObservableList<PieChart.Data>? = null, op: PieChart.() -> Unit = {}): PieChart {
val chart = if (data != null) PieChart(data) else PieChart()
chart.title = title
return opcr(this, chart, op)
}

/**
* Create a LineChart with optional title, axis and add to the parent pane. The optional op will be performed on the new instance.
*/
fun <X, Y> EventTarget.linechart(title: String? = null, x: Axis<X>, y: Axis<Y>, op: LineChart<X, Y>.() -> Unit = {}) =
LineChart<X, Y>(x, y).attachTo(this, op) { it.title = title }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions