From 72a0b3520d9e75b9efa1ef668eb45d57cdc10b2e Mon Sep 17 00:00:00 2001 From: Tabakhase Date: Sun, 18 Feb 2018 17:12:30 +0100 Subject: [PATCH] Bring back zoom in charts using chartjs-plugin-zoom (#890) * add chartjs-plugin-zoom + hammerjs * adds a "unzoom" button for chartjs-plugin-zoom * limits chartjs zoom and pan area by scanning all axis --- bower.json | 4 +- src/components/entity/ha-chart-base.html | 82 +++++++++++++++++++++++- src/resources/ha-chart-scripts.html | 4 +- 3 files changed, 87 insertions(+), 3 deletions(-) diff --git a/bower.json b/bower.json index 50eb05342b..b2b574369d 100644 --- a/bower.json +++ b/bower.json @@ -58,7 +58,9 @@ "webcomponentsjs": "^1.0.10", "chart.js": "~2.7.1", "moment": "^2.20.0", - "chartjs-chart-timeline": "fanthos/chartjs-chart-timeline#^0.1.3" + "chartjs-chart-timeline": "fanthos/chartjs-chart-timeline#^0.1.3", + "chartjs-plugin-zoom": "^0.6.3", + "hammerjs": "^2.0.8" }, "devDependencies": { "web-component-tester": "^6.3.0" diff --git a/src/components/entity/ha-chart-base.html b/src/components/entity/ha-chart-base.html index 2061e5d796..dd5dbeef23 100644 --- a/src/components/entity/ha-chart-base.html +++ b/src/components/entity/ha-chart-base.html @@ -64,6 +64,9 @@ margin-right: 6px; width: 10px; } + .chartZoomInline { + float: right; + } +
@@ -98,7 +109,7 @@ + +