From c9f0b7ed818b1e0e39e9e3df9cfded12a70aa496 Mon Sep 17 00:00:00 2001 From: "Christian P. MOMON" Date: Sat, 29 May 2021 11:18:51 +0200 Subject: [PATCH] Added animated option on Bar Charts. --- .../statoolinfos/htmlize/charts/BarChart.java | 12 ++++++++++++ .../statoolinfos/htmlize/charts/BarChartView.java | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/src/fr/devinsy/statoolinfos/htmlize/charts/BarChart.java b/src/fr/devinsy/statoolinfos/htmlize/charts/BarChart.java index d81aacd..d4f63b3 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/charts/BarChart.java +++ b/src/fr/devinsy/statoolinfos/htmlize/charts/BarChart.java @@ -35,6 +35,7 @@ public class BarChart private StringList labels; private BarChartDatasets datasets; private boolean stacked; + private boolean animated; /** * Instantiates a new bar chart. @@ -49,6 +50,7 @@ public class BarChart this.labels = new StringList(); this.datasets = new BarChartDatasets(); this.stacked = false; + this.animated = true; } /** @@ -163,6 +165,11 @@ public class BarChart return this.title; } + public boolean isAnimated() + { + return this.animated; + } + public boolean isDisplayTitle() { return this.displayTitle; @@ -173,6 +180,11 @@ public class BarChart return this.stacked; } + public void setAnimated(final boolean animated) + { + this.animated = animated; + } + public void setDisplayTitle(final boolean displayTitle) { this.displayTitle = displayTitle; diff --git a/src/fr/devinsy/statoolinfos/htmlize/charts/BarChartView.java b/src/fr/devinsy/statoolinfos/htmlize/charts/BarChartView.java index 7bb892b..6505145 100644 --- a/src/fr/devinsy/statoolinfos/htmlize/charts/BarChartView.java +++ b/src/fr/devinsy/statoolinfos/htmlize/charts/BarChartView.java @@ -117,6 +117,10 @@ public class BarChartView lines.append(" },\n"); lines.append(" stacked: ").append(chart.isStacked()).appendln(","); lines.append(" }]\n"); + lines.append(" },\n"); + lines.append(" animation:\n"); + lines.append(" {\n"); + lines.append(" duration: ").append(chart.isAnimated() ? 1000 : 0).appendln(); lines.append(" }\n"); lines.append(" }\n"); lines.append("}");