From f90e1e409277d7050059666ecea09e1510598ff2 Mon Sep 17 00:00:00 2001 From: Rodrigo Ferreira Date: Fri, 20 Dec 2019 13:30:40 -0300 Subject: [PATCH] Implementing fixed tooltip and hide Details Labels (#14) --- .../java/com/oxeanbits/forecastchart/ui/MainExample.kt | 1 + .../core/ui/component/ForecastChartComponent.kt | 9 ++++++++- .../com/oxeanbits/forecastchart/core/util/SetupChart.kt | 4 ---- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/oxeanbits/forecastchart/ui/MainExample.kt b/app/src/main/java/com/oxeanbits/forecastchart/ui/MainExample.kt index 3d8ea2b..c5fead4 100644 --- a/app/src/main/java/com/oxeanbits/forecastchart/ui/MainExample.kt +++ b/app/src/main/java/com/oxeanbits/forecastchart/ui/MainExample.kt @@ -54,6 +54,7 @@ class MainExample : AppCompatActivity() { forecastedLine.color, forecastedLine.forecasted) endDateBar(endDateBar.x, endDateBar.y) unit("m³") + detailsEnable(true) } } } diff --git a/core/src/main/java/com/oxeanbits/forecastchart/core/ui/component/ForecastChartComponent.kt b/core/src/main/java/com/oxeanbits/forecastchart/core/ui/component/ForecastChartComponent.kt index c6acf38..c0beaec 100644 --- a/core/src/main/java/com/oxeanbits/forecastchart/core/ui/component/ForecastChartComponent.kt +++ b/core/src/main/java/com/oxeanbits/forecastchart/core/ui/component/ForecastChartComponent.kt @@ -36,6 +36,7 @@ class ForecastChartComponent(context: Context) : LinearLayout(context), Anvil.Re private var endDateData: BarEntry = emptyBar() private var unit: String = "" private var zoomEnabled: Boolean = false + private var detailsEnable: Boolean = false public override fun onAttachedToWindow() { super.onAttachedToWindow() @@ -52,7 +53,9 @@ class ForecastChartComponent(context: Context) : LinearLayout(context), Anvil.Re size(MATCH, MATCH) orientation(VERTICAL) - renderDetailsLayout() + if(detailsEnable) { + renderDetailsLayout() + } renderChart() } } @@ -183,4 +186,8 @@ class ForecastChartComponent(context: Context) : LinearLayout(context), Anvil.Re fun zoomEnabled(zoomEnabled: Boolean){ this.zoomEnabled = zoomEnabled } + + fun detailsEnable(detailsEnable: Boolean){ + this.detailsEnable = detailsEnable + } } \ No newline at end of file diff --git a/core/src/main/java/com/oxeanbits/forecastchart/core/util/SetupChart.kt b/core/src/main/java/com/oxeanbits/forecastchart/core/util/SetupChart.kt index 646d969..1144405 100644 --- a/core/src/main/java/com/oxeanbits/forecastchart/core/util/SetupChart.kt +++ b/core/src/main/java/com/oxeanbits/forecastchart/core/util/SetupChart.kt @@ -73,9 +73,5 @@ object SetupChart{ combinedChart.marker = marker combinedChart.extraLeftOffset = SIDE_OFFSET combinedChart.extraRightOffset = SIDE_OFFSET - - combinedChart.setOnClickListener { - combinedChart.highlightValue(null) - } } } \ No newline at end of file