Closed ValeryNo closed 2 years ago
Indeed you can. You can either use set
with dot-separated names like set("rangebreaks.value", listOf(2.0,3.0)
or you can use hierarchical meta builder like:
xaxis {
title = "x axis name"
set(
"rangebreaks",
listOf(
Meta {
"bounds" put listOf(2.0, 3.0)
},
Meta {
"bounds" put listOf(3.5, 4.5)
}
)
)
}
In case of rangebreaks I can't produce the result. The generated json seems to be fine, but I do not see changes in the picture. Complete plotly json example would help.
I've also found a minor bug in multiple node treatment (#80), which leads to additional field building and no array wrappings for single-element arrays. It will be fixed in the next release.
Thank you!
This worked to skip weekends:
layout {
xaxis {
set("rangebreaks",
listOf(
Meta { "enabled" put false },
Meta { "bounds" put listOf("sat", "mon") }
)
)
}
...
Nice. Feel free to open an issue for this feature (with Plotly json space you want to achieve) or even contribute the solution.
With dataforge 0.4 > 0.5 this part doesn't work anymore.
listOf(
....
Meta { "bounds" put listOf("sat", "mon") }
)
Problem being "bounds" put listOf..." Basically it doesn't accept lists. Any idea how to work this around in a current version?
Thank you in advance!
Yes, there was a breaking change. The typing is now more strict. You should use ListValue()
instead of listOf()
like it is done here: https://github.com/mipt-npm/plotly.kt/blob/19efcb7e88541542e72edc169d85c07bc51fbc8f/examples/src/main/kotlin/unsupportedFeature.kt#L36.
I will see to adding a local extension to Plotly so we can add lists of Any as before to avoid breaking compatibility. The problem is accepting Any
gives a number of bizarre runtime type errors that we would like to avoid.
Appreciate quick reply. The example given should work just fine!
Hi!
Trying to disable range breaks for dates based x-axis to avoid display of weekends. Supposedly setting rangebreaks.enabled should do (https://plotly.com/javascript/reference/#layout-xaxis-rangebreaks)
How can I do that?
PS. I'm using set(...) for other unsupported properties, but not sure if it can be used for setting hierarchical values like this one.