Skip to content

Commit b008ba8

Browse files
Dashoffset linetype (#260)
* Add demo and notebook. * Update KDoc (`linetype descriptions`). * Add missed changes. * Update notebooks --------- Co-authored-by: Olga Larionova <olarionova@horis.ru>
1 parent 09c85f8 commit b008ba8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+729
-109
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
package frontendContextDemo.scripts
2+
3+
import frontendContextDemo.ScriptInBatikContext
4+
import org.jetbrains.letsPlot.geom.geomSegment
5+
import org.jetbrains.letsPlot.intern.Plot
6+
import org.jetbrains.letsPlot.letsPlot
7+
import org.jetbrains.letsPlot.scale.scaleLinetypeIdentity
8+
import org.jetbrains.letsPlot.tooltips.tooltipsNone
9+
10+
object LineTypes {
11+
@JvmStatic
12+
fun main(args: Array<String>) {
13+
ScriptInBatikContext.eval("Line types") {
14+
15+
fun plot(linetypes: List<Any>): Plot {
16+
val n = linetypes.size
17+
val data = mapOf(
18+
"x" to List(n) { 0 },
19+
"xend" to List(n) { 1 },
20+
"y" to linetypes,
21+
"yend" to linetypes,
22+
"linetype" to linetypes
23+
)
24+
25+
return letsPlot(data) +
26+
geomSegment(size = 3, tooltips = tooltipsNone) {
27+
x = "x"; y = "y"; xend = "xend"; yend = "yend"; linetype = "linetype"
28+
} +
29+
scaleLinetypeIdentity()
30+
}
31+
32+
plot(
33+
listOf(
34+
"solid",
35+
"dashed",
36+
"dotted",
37+
"dotdash",
38+
"longdash",
39+
"twodash"
40+
)
41+
).show()
42+
43+
plot(
44+
listOf(
45+
listOf(1, 1),
46+
listOf(5, 5),
47+
listOf(10, 5),
48+
5 to listOf(10, 5),
49+
listOf(5, 10, 1, 10),
50+
listOf(10, 5, 1, 5, 1, 5)
51+
)
52+
).show()
53+
54+
plot(
55+
listOf(
56+
"11",
57+
"55",
58+
"A5",
59+
"5A1A"
60+
)
61+
).show()
62+
}
63+
}
64+
65+
}

0 commit comments

Comments
 (0)