Skip to content

Commit

Permalink
Merge pull request #81 from mipt-npm/dev
Browse files Browse the repository at this point in the history
v0.4.4
  • Loading branch information
altavir authored Jul 23, 2021
2 parents 9498f75 + b4c88c7 commit 35e549f
Show file tree
Hide file tree
Showing 39 changed files with 652 additions and 988 deletions.
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,32 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

### Security
## [0.4.4]
### Added
- Candlestick support
- Range builders for axis

### Changed
- build tools 0.10.0
- demo projects moved to examples

### Deprecated
- Direct usage of `range` in axis

### Removed

### Fixed
- #80
- Plotly coordinate array wrap is moved to the server side

### Security
## [0.4.3]

### Fixed
- Proper deserialization of single plot.
- A bug in jupyter lab visualization

### Security

## [0.4.2]
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
Dev builds and intermediate artifacts are available via `https://repo.kotlin.link` maven repository.

## Compatibility note
The current `0.4.2` version of the library is compatible with kotlin 1.4 with JS-IR and kotlinx-serialization 1.1.0. The JVM part requires **JVM 11** to run.
The current `0.4.4` version of the library is compatible with kotlin 1.4 with JS-IR and kotlinx-serialization 1.1.0. The JVM part requires JVM 11 to run.

# TL;DR
See [examples](./examples/src/main/kotlin).
Expand Down Expand Up @@ -55,8 +55,8 @@ The examples of the notebooks are shown in [notebooks](./examples/notebooks) dir

```kotlin
@file:Repository("https://repo.kotlin.link")
@file:DependsOn("space.kscience:plotlykt-jupyter:0.4.2")
//@file:DependsOn("space.kscience:plotlykt-server:0.4.2") // Use this one for sever integration.
@file:DependsOn("space.kscience:plotlykt-jupyter:0.4.4")
//@file:DependsOn("space.kscience:plotlykt-server:0.4.4") // Use this one for sever integration.
```

The module `plotly` allows rendering static plots in Jupyter. Jupyter lab is currently supported. Jupyter notebook (classic) is able to render only `PlotlyPage` objects, so one must convert plots to pages to be able to use notebook (see [demo notebook](./notebooks/plotlykt-demo-classic.ipynb)).
Expand Down Expand Up @@ -92,7 +92,7 @@ repositories {
}

dependencies {
implementation("space.kscience:plotlykt-server:0.4.2")
implementation("space.kscience:plotlykt-server:0.4.4")
}
```

Expand Down
19 changes: 2 additions & 17 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
plugins {
kotlin("js") apply false
kotlin("jupyter.api") apply false
id("ru.mipt.npm.gradle.project")
}

val dataforgeVersion by extra("0.4.0")
val dataforgeVersion by extra("0.4.3")

allprojects {
group = "space.kscience"
version = "0.4.2"

repositories {
maven("https://repo.kotlin.link")
maven("https://kotlin.bintray.com/kotlinx")
}

if(name.startsWith("plotlykt")){
apply<MavenPublishPlugin>()
}
version = "0.4.4"
}

apiValidation {
Expand All @@ -32,8 +21,4 @@ ksciencePublish{

readme {
readmeTemplate = file("docs/templates/README-TEMPLATE.md")
}

changelog{
version = project.version.toString()
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@ plugins {
}

repositories {
mavenLocal()
jcenter()
maven("https://dl.bintray.com/mipt-npm/dataforge")
maven("https://dl.bintray.com/mipt-npm/kscience")
maven("https://dl.bintray.com/mipt-npm/dev")
mavenCentral()
maven("https://repo.kotlin.link")
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {

repositories {
mavenCentral()
jcenter()
maven("https://repo.kotlin.link")
}

kotlin {
Expand Down
File renamed without changes.
100 changes: 17 additions & 83 deletions examples/notebooks/Issue-sim.ipynb

Large diffs are not rendered by default.

13 changes: 0 additions & 13 deletions examples/notebooks/plotly-server.json

This file was deleted.

13 changes: 0 additions & 13 deletions examples/notebooks/plotly.json

This file was deleted.

372 changes: 0 additions & 372 deletions examples/notebooks/plotlykt-demo-classic.ipynb

This file was deleted.

195 changes: 8 additions & 187 deletions examples/notebooks/plotlykt-demo.ipynb

Large diffs are not rendered by default.

231 changes: 15 additions & 216 deletions examples/notebooks/plotlykt-server-demo.ipynb

Large diffs are not rendered by default.

215 changes: 215 additions & 0 deletions examples/src/main/kotlin/candlestick/basicCandleStick.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
package candlestick

import space.kscience.dataforge.meta.invoke
import space.kscience.dataforge.meta.set
import space.kscience.plotly.Plotly
import space.kscience.plotly.layout
import space.kscience.plotly.makeFile
import space.kscience.plotly.models.AxisType
import space.kscience.plotly.models.CandleStick

internal val candleStickTrace = CandleStick {
x.strings = listOf(
"2017-01-04",
"2017-01-05",
"2017-01-06",
"2017-01-09",
"2017-01-10",
"2017-01-11",
"2017-01-12",
"2017-01-13",
"2017-01-17",
"2017-01-18",
"2017-01-19",
"2017-01-20",
"2017-01-23",
"2017-01-24",
"2017-01-25",
"2017-01-26",
"2017-01-27",
"2017-01-30",
"2017-01-31",
"2017-02-01",
"2017-02-02",
"2017-02-03",
"2017-02-06",
"2017-02-07",
"2017-02-08",
"2017-02-09",
"2017-02-10",
"2017-02-13",
"2017-02-14",
"2017-02-15"
)

close.numbers = listOf(
116.019997,
116.610001,
117.910004,
118.989998,
119.110001,
119.75,
119.25,
119.040001,
120,
119.989998,
119.779999,
120,
120.080002,
119.970001,
121.879997,
121.940002,
121.949997,
121.629997,
121.349998,
128.75,
128.529999,
129.080002,
130.289993,
131.529999,
132.039993,
132.419998,
132.119995,
133.289993,
135.020004,
135.509995
)

high.numbers = listOf(
116.510002,
116.860001,
118.160004,
119.43,
119.379997,
119.93,
119.300003,
119.620003,
120.239998,
120.5,
120.089996,
120.449997,
120.809998,
120.099998,
122.099998,
122.440002,
122.349998,
121.629997,
121.389999,
130.490005,
129.389999,
129.190002,
130.5,
132.089996,
132.220001,
132.449997,
132.940002,
133.820007,
135.089996,
136.270004
)

increasing {
lineColor("#17BECF")
}

decreasing {
lineColor("#7F7F7F")
}

line { color("rgba(31,119,180,1)") }

low.numbers = listOf(
115.75,
115.809998,
116.470001,
117.940002,
118.300003,
118.599998,
118.209999,
118.809998,
118.220001,
119.709999,
119.370003,
119.730003,
119.769997,
119.5,
120.279999,
121.599998,
121.599998,
120.660004,
120.620003,
127.010002,
127.779999,
128.160004,
128.899994,
130.449997,
131.220001,
131.119995,
132.050003,
132.75,
133.25,
134.619995
)

open.numbers = listOf(
115.849998,
115.919998,
116.779999,
117.949997,
118.769997,
118.739998,
118.900002,
119.110001,
118.339996,
120,
119.400002,
120.449997,
120,
119.550003,
120.419998,
121.669998,
122.139999,
120.93,
121.150002,
127.029999,
127.980003,
128.309998,
129.130005,
130.539993,
131.350006,
131.649994,
132.460007,
133.080002,
133.470001,
135.520004
)
}


fun main() {
Plotly.plot {
traces(candleStickTrace)
layout {
set("dragmode", "zoom")
margin {
r = 10
t = 25
b = 40
l = 60
}
showlegend = false
xaxis {
autorange = true
range("2017-01-03 12:00".."2017-02-15 12:00")
//rangeslider: { range: ["2017-01-03 12:00", "2017-02-15 12:00"] },
title = "Date"
type = AxisType.date
}
yaxis {
autorange = true
range(114.609999778..137.410004222)
type = AxisType.linear
}
}
}.makeFile()
}
Loading

0 comments on commit 35e549f

Please sign in to comment.