From 1b898ae4c661e3f7c93fb953272253a0bff79f3c Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sun, 4 Feb 2024 16:27:22 +0300 Subject: [PATCH 1/4] Move to DF 0.8 --- build.gradle.kts | 6 ++-- .../space/kscience/plotly/jsdemo/main.kt | 3 +- examples/native-demo/build.gradle.kts | 14 ++-------- plotlykt-core/api/plotlykt-core.api | 1 + .../kotlin/space/kscience/plotly/Plot.kt | 11 ++++++-- .../kotlin/space/kscience/plotly/dfExt.kt | 21 -------------- .../kscience/plotly/events/PlotlyEvent.kt | 4 +-- .../space/kscience/plotly/models/Axis.kt | 2 +- .../space/kscience/plotly/models/Bar.kt | 4 +-- .../space/kscience/plotly/models/Box.kt | 4 +-- .../kscience/plotly/models/CandleStick.kt | 4 +-- .../space/kscience/plotly/models/Contour.kt | 4 +-- .../kscience/plotly/models/ContourSpec.kt | 2 +- .../space/kscience/plotly/models/Histogram.kt | 8 +++--- .../space/kscience/plotly/models/Layout.kt | 17 +++++------ .../space/kscience/plotly/models/Legend.kt | 4 +-- .../space/kscience/plotly/models/Marker.kt | 6 ++-- .../space/kscience/plotly/models/Scatter.kt | 4 +-- .../kscience/plotly/models/SelectedPoints.kt | 6 ++-- .../space/kscience/plotly/models/Shape.kt | 2 +- .../space/kscience/plotly/models/Table.kt | 16 +++++------ .../space/kscience/plotly/models/Text.kt | 2 +- .../space/kscience/plotly/models/Trace.kt | 28 +++++++++---------- .../space/kscience/plotly/models/Violin.kt | 4 +-- .../space/kscience/plotly/models/geo/Geo.kt | 8 +++--- .../kscience/plotly/models/geo/GeoMapBox.kt | 2 +- .../plotly/models/geo/GeoProjection.kt | 2 +- settings.gradle.kts | 1 + 28 files changed, 84 insertions(+), 106 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 436aab55..19b1901b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,12 +5,12 @@ plugins { id("space.kscience.gradle.project") } -val dataforgeVersion by extra("0.7.1") -val plotlyVersion by extra("2.24.1") +val dataforgeVersion by extra("0.8.0") +val plotlyVersion by extra("2.29.0") allprojects { group = "space.kscience" - version = "0.6.1" + version = "0.7.0-dev-1" } apiValidation { diff --git a/examples/js-demo/src/main/kotlin/space/kscience/plotly/jsdemo/main.kt b/examples/js-demo/src/main/kotlin/space/kscience/plotly/jsdemo/main.kt index 039ac038..abb6c5ee 100644 --- a/examples/js-demo/src/main/kotlin/space/kscience/plotly/jsdemo/main.kt +++ b/examples/js-demo/src/main/kotlin/space/kscience/plotly/jsdemo/main.kt @@ -12,7 +12,6 @@ import kotlinx.serialization.json.Json import org.w3c.dom.HTMLElement import org.w3c.dom.events.Event import space.kscience.dataforge.meta.MetaSerializer -import space.kscience.dataforge.meta.toMutableMeta import space.kscience.plotly.* import space.kscience.plotly.events.PlotlyEventListenerType import space.kscience.plotly.models.ScatterMode @@ -133,7 +132,7 @@ fun main(): Unit = withCanvas { } val serialized = plot.toJsonString() console.log(serialized) - val deserialized = Plot(Json.decodeFromString(MetaSerializer, serialized).toMutableMeta()) + val deserialized = Plot(Json.decodeFromString(MetaSerializer, serialized)) plotDiv(plot = deserialized).on(PlotlyEventListenerType.CLICK){ console.info(it.toString()) } diff --git a/examples/native-demo/build.gradle.kts b/examples/native-demo/build.gradle.kts index da6b56ae..fac2a32d 100644 --- a/examples/native-demo/build.gradle.kts +++ b/examples/native-demo/build.gradle.kts @@ -10,20 +10,12 @@ repositories { } kotlin { - val hostOs = System.getProperty("os.name") - val isMingwX64 = hostOs.startsWith("Windows") - val nativeTarget = when { - hostOs == "Mac OS X" -> macosX64("native") - hostOs == "Linux" -> linuxX64("native") - isMingwX64 -> mingwX64("native") - else -> throw GradleException("Host OS is not supported in Kotlin/Native.") - } - - nativeTarget.apply { - binaries { + linuxX64{ + binaries{ executable() } } + sourceSets{ commonMain { dependencies { diff --git a/plotlykt-core/api/plotlykt-core.api b/plotlykt-core/api/plotlykt-core.api index 73d0ee80..14fb4c5e 100644 --- a/plotlykt-core/api/plotlykt-core.api +++ b/plotlykt-core/api/plotlykt-core.api @@ -114,6 +114,7 @@ public final class space/kscience/plotly/PlotGridKt { } public final class space/kscience/plotly/PlotKt { + public static final fun Plot (Lspace/kscience/dataforge/meta/Meta;)Lspace/kscience/plotly/Plot; public static final fun layout (Lspace/kscience/plotly/Plot;Lkotlin/jvm/functions/Function1;)V public static final fun toJsonString (Lspace/kscience/plotly/Plot;)Ljava/lang/String; public static final fun trace (Lspace/kscience/plotly/Plot;Lkotlin/jvm/functions/Function1;)Lspace/kscience/plotly/models/Trace; diff --git a/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/Plot.kt b/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/Plot.kt index 9d4f23e9..54ec6343 100644 --- a/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/Plot.kt +++ b/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/Plot.kt @@ -1,3 +1,5 @@ +@file:OptIn(DFExperimental::class) + package space.kscience.plotly import kotlinx.serialization.json.JsonObject @@ -8,6 +10,7 @@ import space.kscience.dataforge.meta.descriptors.Described import space.kscience.dataforge.meta.descriptors.MetaDescriptor import space.kscience.dataforge.meta.descriptors.node import space.kscience.dataforge.misc.DFBuilder +import space.kscience.dataforge.misc.DFExperimental import space.kscience.plotly.models.Layout import space.kscience.plotly.models.Trace @@ -17,17 +20,17 @@ import space.kscience.plotly.models.Trace @DFBuilder public class Plot( override val meta: ObservableMutableMeta = ObservableMutableMeta(), -) : Configurable, MetaRepr, Described { +) : Configurable, MetaRepr, Described{ /** * Ordered list ot traces in the plot */ - public val data: List by list(Trace) + public val data: List by meta.listOfScheme(Trace) /** * Layout specification for th plot */ - public val layout: Layout by meta.spec(Layout) + public val layout: Layout by meta.scheme(Layout) public fun addTrace(trace: Trace) { meta.appendAndAttach("data", trace.meta) @@ -70,6 +73,8 @@ public class Plot( } } +public fun Plot(meta: Meta): Plot = Plot(ObservableMutableMeta { update(meta) }) + internal fun Plot.toJson(): JsonObject = buildJsonObject { put("layout", layout.meta.toJson()) put("data", buildJsonArray { diff --git a/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/dfExt.kt b/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/dfExt.kt index 1b14b5c0..8fcd5234 100644 --- a/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/dfExt.kt +++ b/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/dfExt.kt @@ -27,27 +27,6 @@ private fun MutableMeta.getIndexedProviders(name: Name): Map Configurable.list( - spec: Specification, - key: Name? = null, -): ReadWriteProperty> = object : ReadWriteProperty> { - override fun getValue(thisRef: Any?, property: KProperty<*>): List { - val name = key ?: property.name.asName() - return meta.getIndexedProviders(name).values.map { item -> - spec.write(item) - } - } - - override fun setValue(thisRef: Any?, property: KProperty<*>, value: List) { - val name = key ?: property.name.asName() - meta.setIndexed(name, value.map { it.meta }) - } -} - /** * List of values delegate */ diff --git a/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/events/PlotlyEvent.kt b/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/events/PlotlyEvent.kt index e96a00f2..89d29be1 100644 --- a/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/events/PlotlyEvent.kt +++ b/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/events/PlotlyEvent.kt @@ -18,8 +18,8 @@ public data class PlotlyEventPoint( public val x: Value? = null, public val y: Value? = null, // -// public var data: Trace by spec(Trace) -// public var fullData: Trace by spec(Trace) +// public var data: Trace by scheme(Trace) +// public var fullData: Trace by scheme(Trace) ) diff --git a/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Axis.kt b/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Axis.kt index 4145522e..6ec6ff9c 100644 --- a/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Axis.kt +++ b/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Axis.kt @@ -91,7 +91,7 @@ public class Axis : Scheme() { /** * Sets the tick font. */ - public var tickfont: Font by spec(Font) + public var tickfont: Font by scheme(Font) /** * Determines whether ticks are drawn or not. If "", this axis' ticks are not drawn. diff --git a/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Bar.kt b/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Bar.kt index e633fb3a..9abf2779 100644 --- a/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Bar.kt +++ b/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Bar.kt @@ -16,9 +16,9 @@ public class Bar : Trace(), SelectedPoints { */ override var selectedpoints: List by numberList() - override var selected: SelectPoints by spec(SelectPoints) + override var selected: SelectPoints by scheme(SelectPoints) - override var unselected: SelectPoints by spec(SelectPoints) + override var unselected: SelectPoints by scheme(SelectPoints) /** * Sets where the bar base is drawn (in position axis units). In "stack" or "relative" barmode, diff --git a/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Box.kt b/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Box.kt index 7570032f..46eec003 100644 --- a/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Box.kt +++ b/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Box.kt @@ -155,9 +155,9 @@ public class Box : Trace(), SelectedPoints { */ override var selectedpoints: List by numberList() - override var selected: SelectPoints by spec(SelectPoints) + override var selected: SelectPoints by scheme(SelectPoints) - override var unselected: SelectPoints by spec(SelectPoints) + override var unselected: SelectPoints by scheme(SelectPoints) /** * Sets the amount of jitter in the sample points drawn. diff --git a/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/CandleStick.kt b/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/CandleStick.kt index 4b6a5c3c..98f811e9 100644 --- a/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/CandleStick.kt +++ b/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/CandleStick.kt @@ -68,8 +68,8 @@ public class CandleStick : Trace() { public var lineWidth: Double by double(2.0, Name.parse("line.width")) - public var increasing: CandleStickLine by spec(CandleStickLine) - public var decreasing: CandleStickLine by spec(CandleStickLine) + public var increasing: CandleStickLine by scheme(CandleStickLine) + public var decreasing: CandleStickLine by scheme(CandleStickLine) /** * Number between 0 and 1. diff --git a/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Contour.kt b/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Contour.kt index d99a9282..e46f9cfb 100644 --- a/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Contour.kt +++ b/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Contour.kt @@ -3,7 +3,7 @@ package space.kscience.plotly.models import space.kscience.dataforge.meta.SchemeSpec import space.kscience.dataforge.meta.boolean import space.kscience.dataforge.meta.enum -import space.kscience.dataforge.meta.spec +import space.kscience.dataforge.meta.scheme import space.kscience.plotly.intGreaterThan public class Contour : Trace(), HeatmapContour, ContourSpec { @@ -31,7 +31,7 @@ public class Contour : Trace(), HeatmapContour, ContourSpec { */ override var ncontours: Int by intGreaterThan(1) - override var contours: Contours by spec(Contours) + override var contours: Contours by scheme(Contours) /** * Determines whether or not the contour level attributes are picked by an algorithm. diff --git a/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/ContourSpec.kt b/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/ContourSpec.kt index d5e447d7..adf7214b 100644 --- a/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/ContourSpec.kt +++ b/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/ContourSpec.kt @@ -50,7 +50,7 @@ public class Contours : Scheme() { * Sets the font used for labeling the contour levels. The default color * comes from the lines, if shown. The default family and size come from `layout.font`. */ - public var labelfont: Font by spec(Font) + public var labelfont: Font by scheme(Font) public fun labelfont(block: Font.() -> Unit) { labelfont = Font(block) diff --git a/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Histogram.kt b/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Histogram.kt index d9086edc..75163070 100644 --- a/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Histogram.kt +++ b/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Histogram.kt @@ -150,11 +150,11 @@ public open class Histogram : Trace() { */ public var direction: HistogramDirection by enum(HistogramDirection.increasing) - public var cumulative: Cumulative by spec(Cumulative) + public var cumulative: Cumulative by scheme(Cumulative) - public var xbins: Bins by spec(Bins) + public var xbins: Bins by scheme(Bins) - public var ybins: Bins by spec(Bins) + public var ybins: Bins by scheme(Bins) /** * Specifies the maximum number of desired bins. This value will be used in an algorithm @@ -248,7 +248,7 @@ public class Histogram2DContour : Histogram(), ContourSpec { */ override var ncontours: Int by intGreaterThan(1) - override var contours: Contours by spec(Contours) + override var contours: Contours by scheme(Contours) /** * Determines whether or not the contour level attributes are picked by an algorithm. diff --git a/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Layout.kt b/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Layout.kt index f502f88e..ae8e3145 100644 --- a/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Layout.kt +++ b/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Layout.kt @@ -1,12 +1,13 @@ @file:Suppress("EnumEntryName") +@file:OptIn(DFExperimental::class) package space.kscience.plotly.models import space.kscience.dataforge.meta.* import space.kscience.dataforge.meta.set +import space.kscience.dataforge.misc.DFExperimental import space.kscience.dataforge.names.asName import space.kscience.plotly.appendAndAttach -import space.kscience.plotly.list import space.kscience.plotly.numberGreaterThan import space.kscience.plotly.numberInRange import kotlin.js.JsName @@ -119,9 +120,9 @@ public class Layout : Scheme() { meta["title.text"] = value?.asValue() } - public var xaxis: Axis by spec(Axis) + public var xaxis: Axis by scheme(Axis) - public var yaxis: Axis by spec(Axis) + public var yaxis: Axis by scheme(Axis) /** * Enumerated, one of ( "stack" | "group" | "overlay" | "relative" ) @@ -176,7 +177,7 @@ public class Layout : Scheme() { */ public var violingroupgap: Number by numberInRange(0.0..1.0) - public var legend: Legend by spec(Legend) + public var legend: Legend by scheme(Legend) /** * An annotation is a text element that can be placed anywhere in the plot. @@ -184,9 +185,9 @@ public class Layout : Scheme() { * or with respect to the actual data coordinates of the graph. * Annotations can be shown with or without an arrow. */ - public var annotations: List by list(Text) + public var annotations: List by listOfScheme(Text) - public var shapes: List by list(Shape) + public var shapes: List by listOfScheme(Shape) /** * Sets the background color of the paper where the graph is drawn. @@ -200,7 +201,7 @@ public class Layout : Scheme() { */ public val plot_bgcolor: Color by color() - public var margin: Margin by spec(Margin) + public var margin: Margin by scheme(Margin) /** * Determines how boxes at the same location coordinate are displayed on the graph. If "group", @@ -292,7 +293,7 @@ public class Layout : Scheme() { */ public fun yaxis(index: Int, block: Axis.() -> Unit) { require(index >= 2) { "Secondary axis index must be 2 or more" } - val axisSpec by spec(Axis, "yaxis$index".asName()) + val axisSpec by scheme(Axis, "yaxis$index".asName()) axisSpec.apply(block) } diff --git a/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Legend.kt b/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Legend.kt index b7f75d15..9742c8fa 100644 --- a/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Legend.kt +++ b/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Legend.kt @@ -3,7 +3,7 @@ package space.kscience.plotly.models import space.kscience.dataforge.meta.Scheme import space.kscience.dataforge.meta.SchemeSpec import space.kscience.dataforge.meta.enum -import space.kscience.dataforge.meta.spec +import space.kscience.dataforge.meta.scheme import space.kscience.plotly.numberGreaterThan import space.kscience.plotly.numberInRange import kotlin.js.JsName @@ -97,7 +97,7 @@ public class Legend : Scheme() { /** * Sets the font used to text the legend items. */ - public var font: Font by spec(Font) + public var font: Font by scheme(Font) /** * Sets the orientation of the legend (vertical/horizontal). diff --git a/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Marker.kt b/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Marker.kt index 62589e48..315755b7 100644 --- a/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Marker.kt +++ b/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Marker.kt @@ -106,7 +106,7 @@ public class Marker : Scheme() { */ public var sizemode: SizeMode by enum(SizeMode.diameter) - public var line: MarkerLine by spec(MarkerLine) + public var line: MarkerLine by scheme(MarkerLine) /** * Sets the marker color. It accepts either a specific color or an array of numbers that are mapped to the colorscale @@ -119,9 +119,9 @@ public class Marker : Scheme() { */ public var pieColors: List by listOfValues(key = "colors".asName()) - public var colorbar: ColorBar by spec(ColorBar) + public var colorbar: ColorBar by scheme(ColorBar) - public var gradient: Gradient by spec(Gradient) + public var gradient: Gradient by scheme(Gradient) /** * Sets the color of the outlier sample points. Default: rgba(0, 0, 0, 0). diff --git a/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Scatter.kt b/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Scatter.kt index 4fe1b550..8e85accc 100644 --- a/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Scatter.kt +++ b/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Scatter.kt @@ -96,9 +96,9 @@ public open class Scatter : Trace(), SelectedPoints { */ override var selectedpoints: List by numberList() - override var selected: SelectPoints by spec(SelectPoints) + override var selected: SelectPoints by scheme(SelectPoints) - override var unselected: SelectPoints by spec(SelectPoints) + override var unselected: SelectPoints by scheme(SelectPoints) /** * Sets the area to fill with a solid color. Defaults to "none" unless this trace is stacked, then diff --git a/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/SelectedPoints.kt b/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/SelectedPoints.kt index b7e0da7c..56e660f0 100644 --- a/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/SelectedPoints.kt +++ b/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/SelectedPoints.kt @@ -2,7 +2,7 @@ package space.kscience.plotly.models import space.kscience.dataforge.meta.Scheme import space.kscience.dataforge.meta.SchemeSpec -import space.kscience.dataforge.meta.spec +import space.kscience.dataforge.meta.scheme import space.kscience.plotly.numberGreaterThan import space.kscience.plotly.numberInRange @@ -26,9 +26,9 @@ public class SelectMarker : Scheme() { } public class SelectPoints : Scheme() { - public var marker: SelectMarker by spec(SelectMarker) + public var marker: SelectMarker by scheme(SelectMarker) - public var textfont: Font by spec(Font) + public var textfont: Font by scheme(Font) public fun marker(block: SelectMarker.() -> Unit) { marker = SelectMarker(block) diff --git a/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Shape.kt b/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Shape.kt index 6e8a5755..a4a8990b 100644 --- a/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Shape.kt +++ b/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Shape.kt @@ -150,7 +150,7 @@ public class Shape : Scheme() { */ public var opacity: Number by numberInRange(0.0..1.0) - public var line: LayoutLine by spec(LayoutLine) + public var line: LayoutLine by scheme(LayoutLine) /** * Sets the color filling the shape's interior. Only applies to closed shapes. Default: rgba(0, 0, 0, 0) diff --git a/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Table.kt b/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Table.kt index 89ccf5ef..c888f3a6 100644 --- a/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Table.kt +++ b/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Table.kt @@ -51,17 +51,17 @@ public class Header : Scheme() { /** * [LayoutLine] type object. * */ - public var line: LayoutLine by spec(LayoutLine) + public var line: LayoutLine by scheme(LayoutLine) /** * [Fill] type object. * */ - public var fill: Fill by spec(Fill) + public var fill: Fill by scheme(Fill) /** * [Font] type object. * */ - public var font: Font by spec(Font) + public var font: Font by scheme(Font) public fun values(array: Iterable) { values.set(array) @@ -117,17 +117,17 @@ public class Cells : Scheme() { /** * [LayoutLine] type object. * */ - public var line: LayoutLine by spec(LayoutLine) + public var line: LayoutLine by scheme(LayoutLine) /** * [Fill] type object. * */ - public var fill: Fill by spec(Fill) + public var fill: Fill by scheme(Fill) /** * [Font] type object. * */ - public var font: Font by spec(Font) + public var font: Font by scheme(Font) public fun values(array: Iterable) { values.set(array) @@ -196,12 +196,12 @@ public class Table : Trace() { /** * [Header] type object. Used to define the header row. * */ - public var header: Header by spec(Header) + public var header: Header by scheme(Header) /** * [Cells] type object. Used to define rows containing data. * */ - public var cells: Cells by spec(Cells) + public var cells: Cells by scheme(Cells) public fun header(block: Header.() -> Unit) { header = Header(block) diff --git a/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Text.kt b/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Text.kt index 32257fa5..efe3ee76 100644 --- a/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Text.kt +++ b/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Text.kt @@ -38,7 +38,7 @@ public class Text : Scheme() { /** * Sets the annotation text font. */ - public var font: Font by spec(Font) + public var font: Font by scheme(Font) /** * Sets the annotation's x position. If the axis `type` is "log", diff --git a/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Trace.kt b/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Trace.kt index f4a4d316..36af015a 100644 --- a/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Trace.kt +++ b/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Trace.kt @@ -294,7 +294,7 @@ public class Title : Scheme() { /** * Sets the title font. */ - public var font: Font by spec(Font) + public var font: Font by scheme(Font) /** * Sets the container `x` refers to. "container" spans the entire `width` of the plot. @@ -340,7 +340,7 @@ public class Title : Scheme() { * The same rule applies if `xanchor`/`yanchor` is determined automatically. Padding is muted if * the respective anchor value is "middle"/"center". */ - public var pad: Margin by spec(Margin) + public var pad: Margin by scheme(Margin) public fun font(block: Font.() -> Unit) { font = Font(block) @@ -545,7 +545,7 @@ public class ColorBar : Scheme() { */ public val bgcolor: Color by color() - public var title: Title by spec(Title) + public var title: Title by scheme(Title) /** * Sets the width (in px) of the axis line. @@ -567,7 +567,7 @@ public class ColorBar : Scheme() { /** * Sets the color bar's tick label font */ - public var tickfont: Font by spec(Font) + public var tickfont: Font by scheme(Font) public fun title(block: Title.() -> Unit) { title = Title(block) @@ -657,7 +657,7 @@ public class Hoverlabel : Scheme() { /** * Sets the font used in hover labels. * */ - public var font: Font by spec(Font) + public var font: Font by scheme(Font) /** * Sets the horizontal alignment of the text content within hover label box. Has an effect @@ -806,7 +806,7 @@ public open class Trace : Scheme() { */ public var labels: List by listOfValues() - public var line: LayoutLine by spec(LayoutLine) + public var line: LayoutLine by scheme(LayoutLine) /** * Sets the colorscale. The colorscale must be an array @@ -815,7 +815,7 @@ public open class Trace : Scheme() { */ public var colorscale: Value? by value() - public var colorbar: ColorBar by spec(ColorBar) + public var colorbar: ColorBar by scheme(ColorBar) /** * Sets the fill color if `contours.type` is "constraint". Defaults to @@ -858,9 +858,9 @@ public open class Trace : Scheme() { */ public var opacity: Number by numberInRange(0.0..1.0) - //var line by spec(Line) + //var line by scheme(Line) - public var marker: Marker by spec(Marker) + public var marker: Marker by scheme(Marker) /** * Sets hover text elements associated with each (x,y) pair. If a single string, the same string appears over all @@ -895,7 +895,7 @@ public open class Trace : Scheme() { /** * Sets the text font. */ - public var textfont: Font by spec(Font) + public var textfont: Font by scheme(Font) /** * Flaglist string. Any combination of "x", "y", "z", "text", "name" joined with a "+" OR "all" or "none" or "skip". @@ -905,9 +905,9 @@ public open class Trace : Scheme() { */ public var hoverinfo: String? by string() - public var error_x: Error by spec(Error) + public var error_x: Error by scheme(Error) - public var error_y: Error by spec(Error) + public var error_y: Error by scheme(Error) /** * Sets the orientation of the plot(s). @@ -959,9 +959,9 @@ public open class Trace : Scheme() { */ public var ycalendar: Calendar by enum(Calendar.gregorian) - public var domain: Domain by spec(Domain) + public var domain: Domain by scheme(Domain) - public var hoverlabel: Hoverlabel by spec(Hoverlabel) + public var hoverlabel: Hoverlabel by scheme(Hoverlabel) public fun values(array: Iterable) { values = array.map { Value.of(it) } diff --git a/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Violin.kt b/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Violin.kt index aaab5924..cd36e293 100644 --- a/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Violin.kt +++ b/plotlykt-core/src/commonMain/kotlin/space/kscience/plotly/models/Violin.kt @@ -119,7 +119,7 @@ public class Violin : Trace() { */ public var hoveron: ViolinHoveron by enum(ViolinHoveron.`violins+points+kde`) - public var meanline: MeanLine by spec(MeanLine) + public var meanline: MeanLine by scheme(MeanLine) /** * If "outliers", only the sample points lying outside the whiskers @@ -144,7 +144,7 @@ public class Violin : Trace() { */ public var span: List by listOfValues() - public var box: ViolinBox by spec(ViolinBox) + public var box: ViolinBox by scheme(ViolinBox) /** * Sets the amount of jitter in the sample points drawn. diff --git a/plotlykt-geo/src/commonMain/kotlin/space/kscience/plotly/models/geo/Geo.kt b/plotlykt-geo/src/commonMain/kotlin/space/kscience/plotly/models/geo/Geo.kt index a4b86492..b8585f29 100644 --- a/plotlykt-geo/src/commonMain/kotlin/space/kscience/plotly/models/geo/Geo.kt +++ b/plotlykt-geo/src/commonMain/kotlin/space/kscience/plotly/models/geo/Geo.kt @@ -21,7 +21,7 @@ public enum class GeoScope{ public class Geo : Scheme() { public val bgcolor: Color by color() - public var center: MapCoordinates by spec(MapCoordinates) + public var center: MapCoordinates by scheme(MapCoordinates) public val coastlinecolor: Color by color() public var coastlinewidth: Number by number(1) @@ -54,10 +54,10 @@ public class Geo : Scheme() { public var showland: Boolean? by boolean() public var showocean: Boolean? by boolean() - public var lataxis: MapAxis by spec(MapAxis) - public var lonaxis: MapAxis by spec(MapAxis) + public var lataxis: MapAxis by scheme(MapAxis) + public var lonaxis: MapAxis by scheme(MapAxis) - public var projection: GeoProjection by spec(GeoProjection) + public var projection: GeoProjection by scheme(GeoProjection) public var scope: GeoScope by enum(GeoScope.world) diff --git a/plotlykt-geo/src/commonMain/kotlin/space/kscience/plotly/models/geo/GeoMapBox.kt b/plotlykt-geo/src/commonMain/kotlin/space/kscience/plotly/models/geo/GeoMapBox.kt index 97e15d08..d0a22d4d 100644 --- a/plotlykt-geo/src/commonMain/kotlin/space/kscience/plotly/models/geo/GeoMapBox.kt +++ b/plotlykt-geo/src/commonMain/kotlin/space/kscience/plotly/models/geo/GeoMapBox.kt @@ -23,7 +23,7 @@ public class GeoMapBox : Scheme() { */ public var pitch: Number by number(0) - public var center: MapCoordinates by spec(MapCoordinates) + public var center: MapCoordinates by scheme(MapCoordinates) //TODO domain diff --git a/plotlykt-geo/src/commonMain/kotlin/space/kscience/plotly/models/geo/GeoProjection.kt b/plotlykt-geo/src/commonMain/kotlin/space/kscience/plotly/models/geo/GeoProjection.kt index 241d0936..cd3f53e1 100644 --- a/plotlykt-geo/src/commonMain/kotlin/space/kscience/plotly/models/geo/GeoProjection.kt +++ b/plotlykt-geo/src/commonMain/kotlin/space/kscience/plotly/models/geo/GeoProjection.kt @@ -9,7 +9,7 @@ public class GeoProjection : Scheme() { * the point of view as a proportion of the sphere’s radius. */ public var distance: Number by numberGreaterThan(1.001, default = 2.0) - public var rotation: MapCoordinatesWithRotation by spec(MapCoordinatesWithRotation) + public var rotation: MapCoordinatesWithRotation by scheme(MapCoordinatesWithRotation) /** * Zooms in or out on the map view. A scale of "1" corresponds diff --git a/settings.gradle.kts b/settings.gradle.kts index 0091c83d..b54ae36a 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -46,6 +46,7 @@ include( ":plotlykt-script", ":examples", ":examples:fx-demo", + ":examples:compose-demo", ":examples:js-demo", ":examples:native-demo" ) \ No newline at end of file From c0cd53cf692ccb2bebdfba416aab79fa7d3de2f7 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sun, 4 Feb 2024 16:27:43 +0300 Subject: [PATCH 2/4] Add compose demo --- examples/compose-demo/build.gradle.kts | 42 +++++++++ .../space/kscience/plotly/compose/App.kt | 86 +++++++++++++++++ .../space/kscience/plotly/compose/server.kt | 92 +++++++++++++++++++ 3 files changed, 220 insertions(+) create mode 100644 examples/compose-demo/build.gradle.kts create mode 100644 examples/compose-demo/src/jvmMain/kotlin/space/kscience/plotly/compose/App.kt create mode 100644 examples/compose-demo/src/jvmMain/kotlin/space/kscience/plotly/compose/server.kt diff --git a/examples/compose-demo/build.gradle.kts b/examples/compose-demo/build.gradle.kts new file mode 100644 index 00000000..407d7fd3 --- /dev/null +++ b/examples/compose-demo/build.gradle.kts @@ -0,0 +1,42 @@ +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + +plugins { + kotlin("multiplatform") + id("org.jetbrains.compose") version "1.5.12" +} + +repositories { + mavenCentral() + maven("https://repo.kotlin.link") + maven("https://jogamp.org/deployment/maven") +} + +kotlin{ + jvm() + jvmToolchain(17) + sourceSets{ + jvmMain{ + dependencies { + implementation(compose.runtime) + implementation(compose.foundation) + implementation(compose.material) + implementation(compose.desktop.currentOs) + implementation("io.github.kevinnzou:compose-webview-multiplatform:1.8.6") + implementation(projects.plotlyktServer) + implementation(spclibs.logback.classic) + } + } + } +} + +tasks.withType { + kotlinOptions.freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn" +} + +compose { + desktop { + application { + mainClass = "space.kscience.plotly.compose.AppKt" + } + } +} diff --git a/examples/compose-demo/src/jvmMain/kotlin/space/kscience/plotly/compose/App.kt b/examples/compose-demo/src/jvmMain/kotlin/space/kscience/plotly/compose/App.kt new file mode 100644 index 00000000..ed307250 --- /dev/null +++ b/examples/compose-demo/src/jvmMain/kotlin/space/kscience/plotly/compose/App.kt @@ -0,0 +1,86 @@ +package space.kscience.plotly.compose + +import androidx.compose.foundation.layout.* +import androidx.compose.material.* +import androidx.compose.runtime.* +import androidx.compose.ui.Modifier +import androidx.compose.ui.unit.dp +import androidx.compose.ui.window.Window +import androidx.compose.ui.window.application +import com.multiplatform.webview.web.LoadingState +import com.multiplatform.webview.web.WebView +import com.multiplatform.webview.web.rememberWebViewNavigator +import com.multiplatform.webview.web.rememberWebViewStateWithHTMLData +import dev.datlag.kcef.KCEF +import kotlinx.coroutines.flow.MutableStateFlow + +private val allowedPages = listOf( + "Static", + "Dynamic" +) + +@Composable +fun App() { + val scaleFlow = remember { MutableStateFlow(1f) } + val scale by scaleFlow.collectAsState() + val scope = rememberCoroutineScope() + val server = remember { + scope.servePlots(scaleFlow) + } + + val state = rememberWebViewStateWithHTMLData(staticPlot()) + + val navigator = rememberWebViewNavigator() + + val loadingState = state.loadingState + if (loadingState is LoadingState.Loading) { + LinearProgressIndicator( + progress = loadingState.progress, + modifier = Modifier.fillMaxWidth() + ) + } + + Row(Modifier.fillMaxSize()) { + Column(Modifier.width(300.dp)) { + Button({ navigator.loadHtml(staticPlot()) }, modifier = Modifier.fillMaxWidth()) { + Text("Static") + } + Button({ navigator.loadUrl("http://localhost:7778/Dynamic") }, modifier = Modifier.fillMaxWidth()) { + Text("Dynamic") + } + + Slider( + scale, + { scaleFlow.value = it }, + valueRange = 0.1f..10f, + modifier = Modifier.fillMaxWidth() + ) + } + Column(Modifier.fillMaxSize()) { + + WebView( + state = state, + navigator = navigator, + modifier = Modifier.fillMaxSize() + ) + } + } +} + +fun main() = application { + KCEF.initBlocking( + builder = { + progress { + onDownloading { + println("Download progress: $it%") + } + } + release(true) + } + ) + Window(onCloseRequest = ::exitApplication) { + MaterialTheme { + App() + } + } +} diff --git a/examples/compose-demo/src/jvmMain/kotlin/space/kscience/plotly/compose/server.kt b/examples/compose-demo/src/jvmMain/kotlin/space/kscience/plotly/compose/server.kt new file mode 100644 index 00000000..5965eb6f --- /dev/null +++ b/examples/compose-demo/src/jvmMain/kotlin/space/kscience/plotly/compose/server.kt @@ -0,0 +1,92 @@ +package space.kscience.plotly.compose + +import io.ktor.server.engine.ApplicationEngine +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.delay +import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.isActive +import kotlinx.coroutines.launch +import space.kscience.plotly.* +import space.kscience.plotly.models.Scatter +import space.kscience.plotly.models.invoke +import space.kscience.plotly.server.pushUpdates +import space.kscience.plotly.server.serve +import kotlin.math.PI +import kotlin.math.cos +import kotlin.math.sin + +fun staticPlot(): String = Plotly.page { + val x = (0..100).map { it.toDouble() / 100.0 }.toDoubleArray() + val y1 = x.map { sin(2.0 * PI * it) }.toDoubleArray() + val y2 = x.map { cos(2.0 * PI * it) }.toDoubleArray() + val trace1 = Scatter(x, y1) { + name = "sin" + } + val trace2 = Scatter(x, y2) { + name = "cos" + } + plot(config = PlotlyConfig { responsive = true }) {//static plot + traces(trace1, trace2) + layout { + title = "First graph, row: 1, size: 8/12" + xaxis.title = "x axis name" + yaxis { title = "y axis name" } + } + } +}.render() + +fun CoroutineScope.servePlots(scale: StateFlow): ApplicationEngine = Plotly.serve(this, port = 7778) { + page("Static") { container -> + val x = (0..100).map { it.toDouble() / 100.0 }.toDoubleArray() + val y1 = x.map { sin(2.0 * PI * it) }.toDoubleArray() + val y2 = x.map { cos(2.0 * PI * it) }.toDoubleArray() + val trace1 = Scatter(x, y1) { + name = "sin" + } + val trace2 = Scatter(x, y2) { + name = "cos" + } + plot(renderer = container) {//static plot + traces(trace1, trace2) + layout { + title = "First graph, row: 1, size: 8/12" + xaxis.title = "x axis name" + yaxis { title = "y axis name" } + } + } + } + + page("Dynamic") { container -> + val x = (0..100).map { it.toDouble() / 100.0 } + val y = x.map { sin(2.0 * PI * it) } + + val trace = Scatter(x, y) { name = "sin" } + + val plot = plot("dynamic", config = PlotlyConfig { responsive = true }, renderer = container) { + traces(trace) + layout { + title = "Dynamic plot" + xaxis.title = "x axis name" + yaxis.title = "y axis name" + } + } + + launch { + var time: Long = 0 + while (isActive) { + delay(10) + time += 10 + val frequency = scale.value.toDouble() + val dynamicY = x.map { sin(2.0 * PI * frequency * (it + time.toDouble() / 1000.0)) } + //trace.y.numbers = dynamicY + plot.data[0].y.numbers = dynamicY + plot.layout { + xaxis.title = "x axis name (t = $time)" + } + } + } + } + pushUpdates(100) +} + + From b0b8af303c57a41cfd8dbeb38b574ec3b54199f9 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sun, 4 Feb 2024 16:34:56 +0300 Subject: [PATCH 3/4] Add wasm target --- examples/src/main/kotlin/gridPageLayout.kt | 73 +++++++++++++++++- plotlykt-core/build.gradle.kts | 4 +- .../kotlin/space/kscience/plotly/PlotGrid.kt | 75 ------------------- plotlykt-geo/build.gradle.kts | 1 + .../space/kscience/plotly/script/builder.kt | 6 +- 5 files changed, 78 insertions(+), 81 deletions(-) delete mode 100644 plotlykt-core/src/jvmMain/kotlin/space/kscience/plotly/PlotGrid.kt diff --git a/examples/src/main/kotlin/gridPageLayout.kt b/examples/src/main/kotlin/gridPageLayout.kt index 7e5c4c4a..d87a8409 100644 --- a/examples/src/main/kotlin/gridPageLayout.kt +++ b/examples/src/main/kotlin/gridPageLayout.kt @@ -1,3 +1,4 @@ +import kotlinx.html.div import space.kscience.plotly.* import space.kscience.plotly.models.Trace import space.kscience.plotly.models.invoke @@ -6,8 +7,76 @@ import kotlin.math.PI import kotlin.math.cos import kotlin.math.sin -@Suppress("DEPRECATION") -@UnstablePlotlyAPI + +private class PlotGrid { + public data class PlotCell(val id: String, val plot: Plot, val row: Int, val col: Int, val width: Int = 1) + + private val cells = HashMap() + + /** + * @return Columns in ascending order, grouped by rows in ascending order. + * */ + public val grid: List> + get() = cells.values.groupBy { it.row }.toSortedMap().values.map { + it.sortedBy { cell -> cell.col } + }.toList() + + public operator fun get(id: String): PlotCell? = cells[id] + + private var currentRow = 0 + private var currentCol = 0 + + public fun plot( + plot: Plot, + id: String = plot.toString(), + width: Int = 6, + row: Int? = null, + col: Int? = null, + ): Plot { + val actualRow = if (row != null) { + row + } else { + currentCol = 0 + currentRow++ + } + + val actualColumn = col ?: currentCol++ + + cells[id] = PlotCell(id, plot, actualRow, actualColumn, width) + + return plot + } + + public fun plot( + row: Int? = null, + col: Int? = null, + id: String? = null, + width: Int = 6, + block: Plot.() -> Unit, + ): Plot { + val plot = Plotly.plot(block) + return plot(plot, id ?: plot.toString(), width, row, col) + } +} + + +private fun Plotly.grid(block: PlotGrid.() -> Unit): PlotlyPage { + val grid = PlotGrid().apply(block) + return page(cdnBootstrap, cdnPlotlyHeader) { container -> + div("col") { + grid.grid.forEach { row -> + div("row") { + row.forEach { cell -> + div("col-${cell.width}") { + plot(cell.plot, cell.id, renderer = container) + } + } + } + } + } + } +} + fun main() { val x = (0..100).map { it.toDouble() / 100.0 } diff --git a/plotlykt-core/build.gradle.kts b/plotlykt-core/build.gradle.kts index d66a46c1..e2c78c90 100644 --- a/plotlykt-core/build.gradle.kts +++ b/plotlykt-core/build.gradle.kts @@ -14,10 +14,12 @@ kotlin{ kscience { fullStack(bundleName = "js/plotly-kt.js") native() + wasm() dependencies { api("space.kscience:dataforge-meta:$dataforgeVersion") - api(spclibs.kotlinx.html) + //api(spclibs.kotlinx.html) + api("org.jetbrains.kotlinx:kotlinx-html:0.11.0") } jsMain{ diff --git a/plotlykt-core/src/jvmMain/kotlin/space/kscience/plotly/PlotGrid.kt b/plotlykt-core/src/jvmMain/kotlin/space/kscience/plotly/PlotGrid.kt deleted file mode 100644 index c6b5080c..00000000 --- a/plotlykt-core/src/jvmMain/kotlin/space/kscience/plotly/PlotGrid.kt +++ /dev/null @@ -1,75 +0,0 @@ -package space.kscience.plotly - -import kotlinx.html.div - -@UnstablePlotlyAPI -@Deprecated("Discontinued in favor of VisionForge layouts") -public class PlotGrid { - public data class PlotCell(val id: String, val plot: Plot, val row: Int, val col: Int, val width: Int = 1) - - private val cells = HashMap() - - /** - * @return Columns in ascending order, grouped by rows in ascending order. - * */ - public val grid: List> - get() = cells.values.groupBy { it.row }.toSortedMap().values.map { - it.sortedBy { cell -> cell.col } - }.toList() - - public operator fun get(id: String): PlotCell? = cells[id] - - private var currentRow = 0 - private var currentCol = 0 - - public fun plot( - plot: Plot, - id: String = plot.toString(), - width: Int = 6, - row: Int? = null, - col: Int? = null, - ): Plot { - val actualRow = if (row != null) { - row - } else { - currentCol = 0 - currentRow++ - } - - val actualColumn = col ?: currentCol++ - - cells[id] = PlotCell(id, plot, actualRow, actualColumn, width) - - return plot - } - - public fun plot( - row: Int? = null, - col: Int? = null, - id: String? = null, - width: Int = 6, - block: Plot.() -> Unit, - ): Plot { - val plot = Plotly.plot(block) - return plot(plot, id ?: plot.toString(), width, row, col) - } -} - -@UnstablePlotlyAPI -@Deprecated("Discontinued in favor of VisionForge layouts") -public fun Plotly.grid(block: PlotGrid.() -> Unit): PlotlyPage { - val grid = PlotGrid().apply(block) - return page(cdnBootstrap, cdnPlotlyHeader) { container -> - div("col") { - grid.grid.forEach { row -> - div("row") { - row.forEach { cell -> - div("col-${cell.width}") { - plot(cell.plot, cell.id, renderer = container) - } - } - } - } - } - } -} diff --git a/plotlykt-geo/build.gradle.kts b/plotlykt-geo/build.gradle.kts index d6ff96fc..788c4c15 100644 --- a/plotlykt-geo/build.gradle.kts +++ b/plotlykt-geo/build.gradle.kts @@ -7,6 +7,7 @@ kscience{ jvm() js() native() + wasm() dependencies { api(project(":plotlykt-core")) } diff --git a/plotlykt-script/src/main/kotlin/space/kscience/plotly/script/builder.kt b/plotlykt-script/src/main/kotlin/space/kscience/plotly/script/builder.kt index ca7d1176..82981317 100644 --- a/plotlykt-script/src/main/kotlin/space/kscience/plotly/script/builder.kt +++ b/plotlykt-script/src/main/kotlin/space/kscience/plotly/script/builder.kt @@ -13,7 +13,7 @@ import kotlin.script.experimental.jvm.jvm import kotlin.script.experimental.jvmhost.BasicJvmScriptingHost @UnstablePlotlyAPI -fun Plotly.page( +public fun Plotly.page( source: SourceCode, title: String = "Plotly.kt", headers: Array = arrayOf(cdnPlotlyHeader), @@ -59,7 +59,7 @@ fun Plotly.page( } @UnstablePlotlyAPI -fun Plotly.page( +public fun Plotly.page( file: File, title: String = "Plotly.kt", headers: Array = arrayOf(cdnPlotlyHeader), @@ -68,7 +68,7 @@ fun Plotly.page( @OptIn(UnstablePlotlyAPI::class) -fun Plotly.page( +public fun Plotly.page( string: String, title: String = "Plotly.kt", headers: Array = arrayOf(cdnPlotlyHeader), From 95be28d9b2a5c2e88b538bf7b744af367bf70851 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sun, 4 Feb 2024 16:36:04 +0300 Subject: [PATCH 4/4] Update changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 65fc95c8..c72ae37b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,12 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased ### Added +- Compose demo ### Changed +- Migrated to DF 0.8 ### Deprecated ### Removed +- Grid view ### Fixed