I have three columns of excel data I want to graph: name, a time value, and a Boolean (TRUE or FALSE). Essentially I want time on the X axis, and the counts or frequency of TRUEs and FALSEs on the Y axis.
Wat is the best way to do this, and which graph type would best represent this data?
I have around 900 data points.
Would a stacked area chart might be the best way to show the frequency of T v. F over time?
Your existing data is arranged in what is called a ‘time-history’ format, where you have discrete data points taken at specific times.
How you are wanting to display your data is called ‘time-at-level’. This type of display is used to display the number of times that an event occurred that fell between a specific defined range for that event. Normally this would be used on a dataset that has a varying value over time. Your case is a little bit unique in that the varying values over time are actually ‘time’.
So to answer one of your questions, yes a stacked area graph would be a decent way to show your results, or a grouped column chart would work as well.
In order to change your time-history data into time-at-level data you will need to crunch through your data, probably in a vba macro. If your time data points occurred at regular intervals, you could just break up the data into regular groups in Excel and used the COUNTIF function on each of the groups.
In your case you will need to loop through each line of data, determine if it is true or false, and increment a counter for the correct bin.
If you know the number of bins you want to break your time data into, the bin size can be calculated:
Binsize = (Largest time value – Smallest time value) / number of bins
Then you can set up an array or list that contains the maximum time value that can occur in each bin:
Bin 1: maxvalue = Binsize
Bin 2: maxvalue = Binsize * 2
.
.
Bin n: maxvalue = Binsize * n
Actually, you will need 2 arrays/lists. One for true values, one for false values.
At this point you can loop through each row of your data. You examine the time value and determine which bin it belongs in, then see if it corresponds to TRUE or FALSE, and increment the appropriate counter associated with that bin.
You will then have a count of all TRUEs and all FALSEs that occured in regularly spaced intervals, and you can redisplay your data in a time-at-level format and chart it however you want.