Jump to content
David Schwartz

brainstorming on a 2d data store

Recommended Posts

I have a situation where I've got a list of names and a list of places. I want to create a grid that displays a color in each cell that represents some data, sort of like a heat map.

 

Think something like "how many people named Hans visited this place in Seattle during this date range?" 

 

So the gist of it is that you go through each combination of x (eg, name) and y (eg, place) then set the color of the corresponding cell to some normalized value. (this is not about the colors or even what's in the cells)

 

There's a first pass goes through each (x,y) pair and does some queries to collect data, then saves it. 

 

In my mind, this is kind of like a stringlist with name=value pairs, where each 'name' is an (x,y) pair and the 'value' is an object (eg., another stringlist) that conains relevant data found for that specific pair.

 

The next pass processes the data and extracts relevant numbers, then assigns something like a color value (in this case).

 

There will be ways of filtering the data to offer different possible viewing models, which is why I read all the data first, then process it separately. (eliminates the need to re-issue the same queries over and over.)

 

Each time the filter is changed, the data is re-analyzed and the results displayed.

 

Possible ways I see of organizing this data include:


(1) array of array

 

(2) list of lists

 

(3) a dictionary that uses each (x,y) pair as the key and saves the data as the value. Then it would cycle over them and split the pair to get the (col,row) for accessing a grid cell.

 

(4) something else (?)

 

I'd rather not have to do everything with a nested loop, and there's not much to do once the color has been determined other than use it to set the color of a corresponding grid cell.

 

It's just a heat map that you look at. The user is MAINLY interested with what's in the SERIES of heat maps that are created over time so you can see how the data corresponding to the same (x,y) pairs changes over time.

 

So what's of most interest is ... it's a stack (ie, LIST) of 2D heatmaps. Which I guess makes it a 3D data organization.

 

What's the simplest way to organize and use the heat map data? (1), (2), or (3)? or maybe you have a (4) in mind?

Edited by David Schwartz

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×