Commit d504daf4 authored by unknown's avatar unknown
Browse files

v0.1.6.10 ShinyGR Model diagram now uses the dyStackedBarGroup function...

v0.1.6.10 ShinyGR Model diagram now uses the dyStackedBarGroup function instead of the plotter argument with the barChartPrecip.js file
Showing with 3 additions and 22 deletions
+3 -22
Package: airGRteaching Package: airGRteaching
Type: Package Type: Package
Title: Tools to Simplify the Use of the airGR Hydrological Package for Education (Including a Shiny Interface) 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 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"))) 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) Depends: airGR (>= 1.0.9.43)
......
...@@ -354,7 +354,8 @@ shinyServer(function(input, output, session) { ...@@ -354,7 +354,8 @@ shinyServer(function(input, output, session) {
data.xts <- xts(data[, -1L, drop = FALSE], order.by = data$DatesR) data.xts <- xts(data[, -1L, drop = FALSE], order.by = data$DatesR)
dg4 <- dygraph(data.xts, group = "mod_diag", ylab = "precip. [mm/d]") 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 <- dyAxis(dg4, name = "y", valueRange = c(max(data.xts[, "precip."], na.rm = TRUE), -1e-3))
dg4 <- dyEvent(dg4, input$Event, color = "orangered") dg4 <- dyEvent(dg4, input$Event, color = "orangered")
dg4 <- dyLegend(dg4, show = "onmouseover", width = 225) dg4 <- dyLegend(dg4, show = "onmouseover", width = 225)
......
"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);
}
}"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment