Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to display stacked bar chart with multiple dimensions and multiple expressions?

Hello,

The data I'm trying to display consists of counts of 3 different types of published data recorded by the publishing author and date. For example the table columns would be something like: date, author, type1_count, type2_count, type3_count. I want to display the data in a stacked bar chart where for each date there are 3 bars indicating the total of type1, type2 and type3 counts, and each of the bars is stacked showing the total per author.

I can get what I want displayed if I use the date and author as dimensions and the type as the expression, but this only works for a single expression. If I add a second expression for the second type count the stacked var goes away and the author get's displayed along the x-axis rather than within the stacked bar as with a single expression. Any ideas on how I may accoplish what I'm after?

Jeremy

1 Solution

Accepted Solutions
Not applicable
Author

Hi Jeremy,

I think you should transpose you data with crosstable in the script :

Crosstable (type, count , 2 )
LOAD * INLINE [
Author, Date, type1_count, type2_count, type3_count
user1, '01/30/2010', 2, 3, 1
user2, '01/30/2010', 1, 8, 2
user3, '01/30/2010', 2, 4, 7
user1, '02/30/2010', 1, 4, 9
user2, '02/30/2010', 6, 2, 2
user3, '02/30/2010', 7, 1, 7
];

Then you can create a chart with

Dimension : Author Date Type

Expression : sum(count)

cheers

JJ

View solution in original post

2 Replies
Not applicable
Author

Hi Jeremy,

I think you should transpose you data with crosstable in the script :

Crosstable (type, count , 2 )
LOAD * INLINE [
Author, Date, type1_count, type2_count, type3_count
user1, '01/30/2010', 2, 3, 1
user2, '01/30/2010', 1, 8, 2
user3, '01/30/2010', 2, 4, 7
user1, '02/30/2010', 1, 4, 9
user2, '02/30/2010', 6, 2, 2
user3, '02/30/2010', 7, 1, 7
];

Then you can create a chart with

Dimension : Author Date Type

Expression : sum(count)

cheers

JJ

Not applicable
Author

Thanks, that was exactly what I needed.