From 2cba438185297d678467a70776140a8f45e99ce9 Mon Sep 17 00:00:00 2001 From: Masayuki Tanaka Date: Tue, 18 Feb 2014 12:48:10 +0900 Subject: [PATCH] Update sample for stacked bar chart - #30 --- htdocs/samples/chart_bar_stacked.html | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/htdocs/samples/chart_bar_stacked.html b/htdocs/samples/chart_bar_stacked.html index ab7db41..f3c8ddd 100644 --- a/htdocs/samples/chart_bar_stacked.html +++ b/htdocs/samples/chart_bar_stacked.html @@ -11,13 +11,11 @@ var chart = c3.generate({ data: { columns: [ - ['data1', 30, 200, 200, 400, 150, 250], - ['data2', 130, -100, 100, 200, 150, 50] + ['data1', 30, 200, 200, 400, 150, -250], + ['data2', 130, -100, 100, 200, 150, 50], + ['data3', 230, -200, 200, 300, 250, 250] ], - types: { - data1: 'bar', - data2: 'bar' - }, + type: 'bar', groups: [ ['data1', 'data2'] ] @@ -28,6 +26,22 @@ } } }); + + + setTimeout(function () { + chart.groups([['data1', 'data2', 'data3']]) + }, 500); + + setTimeout(function () { + chart.load({ + columns: [['data4', 100, 50, 150, -200, 300, -100]] + }); + }, 1000); + + setTimeout(function () { + chart.groups([['data1', 'data2', 'data3', 'data4']]) + }, 1500); +