Home
Analytics
Graph to show Percentage using 2 data sources
hulmea
Hi All,
A picture tells a thousand words so attached is a screen shot that should show you what I am trying to do.
I have 2 columns Active and count(The count is the total and active is a proportion of that). I want to show a pie chat that uses the Count as the 100 percent value and the Active (Set to 0 in the screen shot as this is generated by java script) to be a percentage of this.
Getting the percentage value is easy into a table
var Total_Active = parseInt(reportContext.getGlobalVariable("gvar"));
var Total_Course = dataSetRow["COUNT(*)"];
var percentage = ( Total_Active / Total_Course) * 100;
percentage +"%"
But I just can't figure out how to get it into a PIE chart or Meter chat. I would like to be able to do this for either PIE of meter.
Any help will be appreciated.
Thanks
Andy
Find more posts tagged with
Comments
CBR
Hi,
i have to admit that i never worked with a meter chart. So my answer just relates to the pie chart question:
the pie chart assumes that your data is absolute and not percentage data. Let's assume that you have 3 records for your pie chart. Your dataset has 2 columns: SliceName and SliceSize.
the records look like
SliceName SliceSize
slice1 8
slice2 1
slice3 1
sliceName will be used as category name and sliceSize as sliceSize definition
The first thing the chart will do is to calculate percentages by calculating 100% as Sum SliceSize for all records = 10. After that it will calculate the percentage for each record to draw the slice accordingly:
slice1= how many % of 10 is absolute value 8 --> 80%
slice2=10%
slice3=10%
There is no option to tell the pie that your data is already using percentage values.
You most likely want to add 2 different rows to your dataset like follows:
Title | Value
|
Active 20
Total 80 (the difference to 100%)
Then use Title as Category and Value as SliceSize Definition column
hulmea
The 2 sources of data do not come from the same data set and a join could not be done on them. I could set these both as global variables but then would need to know how to create then both into one data set.
Thanks for the help.