From 422d3081ee0ca2a958ea0c1ae1a527cbb2ce825d Mon Sep 17 00:00:00 2001 From: Igor Alshannikov Date: Wed, 20 Oct 2021 20:20:54 -0400 Subject: [PATCH] Increase default plot size: 500X333 -> 600X400 --- .../datalore/plot/builder/PlotSvgComponent.kt | 3 +-- .../datalore/plot/builder/presentation/Defaults.kt | 13 +++++++++++++ .../jetbrains/datalore/plot/PlotSizeHelper.kt | 12 ++++-------- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/plot-builder-portable/src/commonMain/kotlin/jetbrains/datalore/plot/builder/PlotSvgComponent.kt b/plot-builder-portable/src/commonMain/kotlin/jetbrains/datalore/plot/builder/PlotSvgComponent.kt index 1d1d775f0e8..bef235f5768 100644 --- a/plot-builder-portable/src/commonMain/kotlin/jetbrains/datalore/plot/builder/PlotSvgComponent.kt +++ b/plot-builder-portable/src/commonMain/kotlin/jetbrains/datalore/plot/builder/PlotSvgComponent.kt @@ -24,6 +24,7 @@ import jetbrains.datalore.plot.builder.interact.PlotInteractor import jetbrains.datalore.plot.builder.interact.PlotTooltipBounds import jetbrains.datalore.plot.builder.layout.* import jetbrains.datalore.plot.builder.layout.PlotLayoutUtil.liveMapBounds +import jetbrains.datalore.plot.builder.presentation.Defaults.DEF_PLOT_SIZE import jetbrains.datalore.plot.builder.presentation.Style import jetbrains.datalore.plot.builder.theme.AxisTheme import jetbrains.datalore.plot.builder.theme.Theme @@ -438,8 +439,6 @@ class PlotSvgComponent constructor( companion object { private val LOG = PortableLogging.logger(PlotSvgComponent::class) - - private val DEF_PLOT_SIZE = DoubleVector(600.0, 400.0) private const val DEBUG_DRAWING = PLOT_DEBUG_DRAWING } } diff --git a/plot-builder-portable/src/commonMain/kotlin/jetbrains/datalore/plot/builder/presentation/Defaults.kt b/plot-builder-portable/src/commonMain/kotlin/jetbrains/datalore/plot/builder/presentation/Defaults.kt index a53dcbccae1..27760a76843 100644 --- a/plot-builder-portable/src/commonMain/kotlin/jetbrains/datalore/plot/builder/presentation/Defaults.kt +++ b/plot-builder-portable/src/commonMain/kotlin/jetbrains/datalore/plot/builder/presentation/Defaults.kt @@ -5,10 +5,23 @@ package jetbrains.datalore.plot.builder.presentation +import jetbrains.datalore.base.geometry.DoubleVector import jetbrains.datalore.base.values.Color import jetbrains.datalore.plot.builder.presentation.Defaults.Plot.Axis object Defaults { + // Plot size + const val ASPECT_RATIO = 3.0 / 2.0 + const val MIN_PLOT_WIDTH = 50.0 + + @Suppress("MemberVisibilityCanBePrivate") + const val DEF_PLOT_WIDTH = 600.0 + + @Suppress("MemberVisibilityCanBePrivate") + const val DEF_LIVE_MAP_WIDTH = 800.0 + val DEF_PLOT_SIZE = DoubleVector(DEF_PLOT_WIDTH, DEF_PLOT_WIDTH / ASPECT_RATIO) + val DEF_LIVE_MAP_SIZE = DoubleVector(DEF_LIVE_MAP_WIDTH, DEF_LIVE_MAP_WIDTH / ASPECT_RATIO) + // HEX colors only (because of using of parseHex()) const val DARK_GRAY = "#3d3d3d" val GRAY = Color.GRAY.toHexColor() diff --git a/plot-config-portable/src/commonMain/kotlin/jetbrains/datalore/plot/PlotSizeHelper.kt b/plot-config-portable/src/commonMain/kotlin/jetbrains/datalore/plot/PlotSizeHelper.kt index 2de757dffed..b4d27280975 100644 --- a/plot-config-portable/src/commonMain/kotlin/jetbrains/datalore/plot/PlotSizeHelper.kt +++ b/plot-config-portable/src/commonMain/kotlin/jetbrains/datalore/plot/PlotSizeHelper.kt @@ -8,6 +8,10 @@ package jetbrains.datalore.plot import jetbrains.datalore.base.geometry.DoubleRectangle import jetbrains.datalore.base.geometry.DoubleVector import jetbrains.datalore.plot.builder.assemble.PlotFacets +import jetbrains.datalore.plot.builder.presentation.Defaults.ASPECT_RATIO +import jetbrains.datalore.plot.builder.presentation.Defaults.DEF_LIVE_MAP_SIZE +import jetbrains.datalore.plot.builder.presentation.Defaults.DEF_PLOT_SIZE +import jetbrains.datalore.plot.builder.presentation.Defaults.MIN_PLOT_WIDTH import jetbrains.datalore.plot.config.BunchConfig import jetbrains.datalore.plot.config.Option import jetbrains.datalore.plot.config.OptionsAccessor @@ -15,14 +19,6 @@ import jetbrains.datalore.plot.config.PlotConfig import kotlin.math.max object PlotSizeHelper { - private const val ASPECT_RATIO = 3.0 / 2.0 // TODO: theme - private const val MIN_PLOT_WIDTH = 50.0 // Used somethere else? - private const val DEF_PLOT_WIDTH = 500.0 - private const val DEF_LIVE_MAP_WIDTH = 800.0 - private val DEF_PLOT_SIZE = DoubleVector(DEF_PLOT_WIDTH, DEF_PLOT_WIDTH / ASPECT_RATIO) - private val DEF_LIVE_MAP_SIZE = DoubleVector(DEF_LIVE_MAP_WIDTH, DEF_LIVE_MAP_WIDTH / ASPECT_RATIO) - - /** * Plot spec can be either raw or processed */