From 78cc0621265254db9f98680157617116000a29d5 Mon Sep 17 00:00:00 2001 From: Vic Huang Date: Mon, 3 May 2021 18:12:08 +0800 Subject: [PATCH] reload stacked bar chart groups when data changes --- react-c3js.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/react-c3js.js b/react-c3js.js index f730ac7..1338950 100644 --- a/react-c3js.js +++ b/react-c3js.js @@ -76,6 +76,11 @@ var C3Chart = function (_React$Component) { value: function loadNewData(data) { this.chart.load(data); } + }, { + key: 'updateGroups', + value: function updateGroups(groups) { + this.chart.groups(groups); + } }, { key: 'unloadData', value: function unloadData() { @@ -91,7 +96,8 @@ var C3Chart = function (_React$Component) { if (config.unloadBeforeLoad) { this.unloadData(); } - + + this.updateGroups(config.data.groups); this.loadNewData(config.data); } }, {