in plot-api/src/commonMain/kotlin/org/jetbrains/letsPlot/bistro/waterfall/WaterfallPlotBuilder.kt [40:95]
fun build(): Plot {
return letsPlot(data) + OptionsMap(
kind = BISTRO,
name = Waterfall.NAME,
options = mapOf(
Waterfall.X to x,
Waterfall.Y to y,
Waterfall.MEASURE to measure,
Waterfall.GROUP to group,
Waterfall.COLOR to color,
Waterfall.FILL to fill,
Waterfall.SIZE to size,
Waterfall.ALPHA to alpha,
Waterfall.LINE_TYPE to linetype,
Waterfall.WIDTH to width,
Waterfall.SHOW_LEGEND to showLegend,
Waterfall.RELATIVE_TOOLTIPS to when (relativeTooltips) {
is TooltipOptions -> relativeTooltips.options
else -> relativeTooltips
},
Waterfall.ABSOLUTE_TOOLTIPS to when (absoluteTooltips) {
is TooltipOptions -> absoluteTooltips.options
else -> absoluteTooltips
},
Waterfall.BASE to base,
Waterfall.CALCULATE_TOTAL to calcTotal,
Waterfall.TOTAL_TITLE to totalTitle,
Waterfall.SORTED_VALUE to sortedValue,
Waterfall.THRESHOLD to threshold,
Waterfall.MAX_VALUES to maxValues,
Waterfall.H_LINE to hline,
Waterfall.H_LINE_ON_TOP to hlineOntop,
Waterfall.CONNECTOR to connector,
Waterfall.RELATIVE_LABELS to when (relativeLabels) {
is layerLabels -> relativeLabels.options
else -> relativeLabels
},
Waterfall.ABSOLUTE_LABELS to when (absoluteLabels) {
is layerLabels -> absoluteLabels.options
else -> absoluteLabels
},
Waterfall.LABEL to label,
Waterfall.LABEL_FORMAT to labelFormat,
Waterfall.BACKGROUND_LAYERS to when (backgroundLayers) {
is Layer -> listOf(backgroundLayers.toSpec())
is FeatureList -> backgroundLayers.elements.map {
when (it) {
is Layer -> it.toSpec()
else -> error("Invalid type in backgroundLayers list")
}
}
else -> backgroundLayers
}
).filterNonNullValues()
)
}