Dashboard Home

Create Stacked Bar chart | jfreechart| dashboards

Create Stacked Bar chart | jfreechart| dashboards

The basic requirement of a stacked bar chart is that the SQL query should return three columns

 

for e.g.

select     Format(date,'YYMM') & ' - '& Format(date,'MMM') as       Month , switch(class is null,'Unknown Class',class is not null,class) as class_type, sum(amount) as Expense

from

[qb_data$]

where "Account Type" = 'Expense'

and date between         #10/1/2007# and     #05/23/2008#

and class   like '%'

group by Format(date,'YYMM') & ' - '& Format(date,'MMM'), switch(class is null,'Unknown Class',class is not null,class)

order by 1 asc

 

In the above SQL, the three columns are Month, Class_type and Expense.

 

The middle column seperates the bar into different stacks.

 

 

You can customize the bar chart appearance by following the steps mentioned in Create Dashboard Bar Chart

 

For the same query if you create a chart with type ='Bar' then the bars appear side-by-side