better auto update method
This commit is contained in:
parent
5728a361da
commit
ea901187ac
|
@ -87,13 +87,13 @@ add_locale_apex <- function(widget) {
|
|||
#' @param 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.
|
||||
#'
|
||||
#' @export
|
||||
config_update <- function(series_animate = TRUE,
|
||||
update_options = FALSE,
|
||||
options_animate = TRUE,
|
||||
options_redrawPaths = FALSE) {
|
||||
options_redrawPaths = TRUE) {
|
||||
list(
|
||||
series_animate = series_animate,
|
||||
update_options = update_options,
|
||||
|
|
|
@ -135,6 +135,21 @@ HTMLWidgets.widget({
|
|||
if (!axOpts.chart.hasOwnProperty("parentHeightOffset")) {
|
||||
axOpts.chart.parentHeightOffset = 0;
|
||||
}
|
||||
|
||||
// added events to remove minheight container
|
||||
if (!axOpts.chart.hasOwnProperty("events")) {
|
||||
axOpts.chart.events = {};
|
||||
}
|
||||
if (!axOpts.chart.events.hasOwnProperty("mounted")) {
|
||||
axOpts.chart.events.mounted = function(chartContext, config) {
|
||||
el.style.minHeight = 0;
|
||||
};
|
||||
}
|
||||
if (!axOpts.chart.events.hasOwnProperty("updated")) {
|
||||
axOpts.chart.events.updated = function(chartContext, config) {
|
||||
el.style.minHeight = 0;
|
||||
};
|
||||
}
|
||||
|
||||
if (x.hasOwnProperty("shinyEvents") & HTMLWidgets.shinyMode) {
|
||||
if (!axOpts.hasOwnProperty("chart")) {
|
||||
|
@ -226,8 +241,10 @@ HTMLWidgets.widget({
|
|||
apexchart.render();
|
||||
} else {
|
||||
if (x.auto_update) {
|
||||
//console.log(x.auto_update);
|
||||
apexchart.updateSeries(axOpts.series, x.auto_update.series_animate);
|
||||
if (x.auto_update.update_options) {
|
||||
delete axOpts.series;
|
||||
apexchart.updateOptions(
|
||||
axOpts,
|
||||
x.auto_update.options_redrawPaths,
|
||||
|
|
|
@ -8,7 +8,7 @@ config_update(
|
|||
series_animate = TRUE,
|
||||
update_options = FALSE,
|
||||
options_animate = TRUE,
|
||||
options_redrawPaths = FALSE
|
||||
options_redrawPaths = TRUE
|
||||
)
|
||||
}
|
||||
\arguments{
|
||||
|
|
Loading…
Reference in New Issue