From 02cf03fd6affb719bf853e7f20ab6b1d2105613d Mon Sep 17 00:00:00 2001 From: pvictor Date: Wed, 15 Apr 2020 16:20:29 +0200 Subject: [PATCH] fixed resizing bug with auto update + dont update synced charts options --- R/apexcharter.R | 8 ++++++-- inst/htmlwidgets/apexcharter.js | 5 ++++- man/config_update.Rd | 8 ++++++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/R/apexcharter.R b/R/apexcharter.R index 4975bb9..dcba536 100644 --- a/R/apexcharter.R +++ b/R/apexcharter.R @@ -88,17 +88,21 @@ add_locale_apex <- function(widget) { #' should it draw from the existing paths or completely redraw #' the chart paths from the beginning. By default, the chart #' is re-rendered from the existing paths. +#' @param update_synced_charts All the charts in a group should +#' also update when one chart in a group is updated. #' #' @export config_update <- function(series_animate = TRUE, update_options = FALSE, options_animate = TRUE, - options_redrawPaths = TRUE) { + options_redrawPaths = TRUE, + update_synced_charts = FALSE) { list( series_animate = series_animate, update_options = update_options, options_animate = options_animate, - options_redrawPaths = options_redrawPaths + options_redrawPaths = options_redrawPaths, + update_synced_charts = update_synced_charts ) } diff --git a/inst/htmlwidgets/apexcharter.js b/inst/htmlwidgets/apexcharter.js index 648d315..6db1c72 100644 --- a/inst/htmlwidgets/apexcharter.js +++ b/inst/htmlwidgets/apexcharter.js @@ -245,10 +245,13 @@ HTMLWidgets.widget({ apexchart.updateSeries(axOpts.series, x.auto_update.series_animate); if (x.auto_update.update_options) { delete axOpts.series; + delete axOpts.chart.width; + delete axOpts.chart.height; apexchart.updateOptions( axOpts, x.auto_update.options_redrawPaths, - x.auto_update.options_animate + x.auto_update.options_animate, + x.auto_update.update_synced_charts ); } } else { diff --git a/man/config_update.Rd b/man/config_update.Rd index 1f2725d..22e26f5 100644 --- a/man/config_update.Rd +++ b/man/config_update.Rd @@ -8,7 +8,8 @@ config_update( series_animate = TRUE, update_options = FALSE, options_animate = TRUE, - options_redrawPaths = TRUE + options_redrawPaths = TRUE, + update_synced_charts = FALSE ) } \arguments{ @@ -21,7 +22,10 @@ config_update( \item{options_redrawPaths}{When the chart is re-rendered, should it draw from the existing paths or completely redraw the chart paths from the beginning. By default, the chart -is re-rendered from the existing paths} +is re-rendered from the existing paths.} + +\item{update_synced_charts}{All the charts in a group should +also update when one chart in a group is updated.} } \description{ Configuration for auto update