From d504daf4277dd728ffde56a2c97e52b60bb50af2 Mon Sep 17 00:00:00 2001
From: unknown <olivier.delaigue@ANPI1430.antony.irstea.priv>
Date: Thu, 28 Sep 2017 11:56:35 +0200
Subject: [PATCH] v0.1.6.10 ShinyGR Model diagram now uses the
 dyStackedBarGroup function instead of the plotter argument with the
 barChartPrecip.js file

---
 DESCRIPTION                    |  2 +-
 inst/ShinyGR/server.R          |  3 ++-
 inst/plugins/barChartPrecip.js | 20 --------------------
 3 files changed, 3 insertions(+), 22 deletions(-)
 delete mode 100644 inst/plugins/barChartPrecip.js

diff --git a/DESCRIPTION b/DESCRIPTION
index d963afb..554de2f 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,7 +1,7 @@
 Package: airGRteaching
 Type: Package
 Title: Tools to Simplify the Use of the airGR Hydrological Package for Education (Including a Shiny Interface)
-Version: 0.1.6.9
+Version: 0.1.6.10
 Date: 2017-09-28
 Authors@R: c(person("Olivier", "Delaigue", role = c("aut", "cre"), email = "airGR@irstea.fr"), person("Laurent", "Coron", role = c("aut")), person("Pierre", "Brigode", role = c("aut")), person("Guillaume", "Thirel", role = c("ctb")))
 Depends: airGR (>= 1.0.9.43)
diff --git a/inst/ShinyGR/server.R b/inst/ShinyGR/server.R
index 207c431..3ac706d 100644
--- a/inst/ShinyGR/server.R
+++ b/inst/ShinyGR/server.R
@@ -354,7 +354,8 @@ shinyServer(function(input, output, session) {
     data.xts <- xts(data[, -1L, drop = FALSE], order.by = data$DatesR)
     
     dg4 <- dygraph(data.xts, group = "mod_diag", ylab = "precip. [mm/d]")
-    dg4 <- dyOptions(dg4, colors = "#428BCA", drawXAxis = FALSE, plotter = barChartPrecip, retainDateWindow = FALSE)
+    dg4 <- dyOptions(dg4, colors = "#428BCA", drawXAxis = FALSE, retainDateWindow = FALSE)
+    dg4 <- dyBarSeries(dg4, name = "precip.")
     dg4 <- dyAxis(dg4, name = "y", valueRange = c(max(data.xts[, "precip."], na.rm = TRUE), -1e-3))
     dg4 <- dyEvent(dg4, input$Event, color = "orangered")
     dg4 <- dyLegend(dg4, show = "onmouseover", width = 225)
diff --git a/inst/plugins/barChartPrecip.js b/inst/plugins/barChartPrecip.js
deleted file mode 100644
index 0acd334..0000000
--- a/inst/plugins/barChartPrecip.js
+++ /dev/null
@@ -1,20 +0,0 @@
-"function barChartPrecip(e) {
-      var ctx = e.drawingContext;
-      var points = e.points;
-      var y_bottom = - e.dygraph.toDomYCoord(0);
-      
-      // This should really be based on the minimum gap
-      var bar_width = 3.0/3 * (points[1].canvasx - points[0].canvasx);
-      ctx.fillStyle = e.color;
-      
-      // Do the actual plotting.
-      for (var i = 0; i < points.length; i++) {
-      var p = points[i];
-      var center_x = p.canvasx;  // center of the bar
-      
-      ctx.fillRect(center_x - bar_width / 2, p.canvasy,
-      bar_width, y_bottom - p.canvasy);
-      ctx.strokeRect(center_x - bar_width / 2, p.canvasy,
-      bar_width, y_bottom - p.canvasy);
-      }
-    }"
-- 
GitLab