Friday 19 May 2017

Best way / framework to display aggregated data as Table / Cluster Data Chart

TL:DR Before we start I'd like to welcome everybody at this a bit "uneasy" question (for me) and to convince anyone who will helps me with my case with any kind of snippet/advice will be contributed with +rep. To the honest I'd like to mark this question with a bounty, but I literally can't because of my current rep.

What I'm actually using right now: Almost ME(A)N:

  • Mongo
  • Express
  • Node.js

The Case

I have a mongo database which filled with documents like :

{item_id:13257, price: 500, quantity: 5, timestamp:~today}
{item_id:13257, price: 456, quantity: 100, timestamp:~today}
{item_id:13257, price: 311, quantity: 5, timestamp:~today}
{item_id:13257, price: 500, quantity: 15, timestamp:~today}
{item_id:13257, price: 500, quantity: 150, timestamp:~yesterday}
{item_id:13257, price: ..., quantity: ..., timestamp:~yesterday before day}

all other documents looks something like this:

{
    item_id: always_the_same, 
    price: could_be_any_number, 
    quantity: could_be_any_number, 
    timestamp: from "now" up to "before X days"
}

As for now my server-side works fine and I have done everything for this. But the only thing I couldn't solve for myself is how to visualize this data properly (in my web-browser) in this case:

First of all, I don't need to display data for item:13257 'as-it-is', and I'll make an aggregation/group them, according to timestamp + price and sum them by quantity, so I'd like to see this at my HTML page like this: This is what I'd like to see on my HTML page

So here a couple of questions before I start writing a code for this:

What's the best way/framework to use for rendering this data as HTML?

I heard that react-tables is pretty good and should suit my needs, but I have also heard about angular/d3.js/charts.js/hightcharts.js Well, I'm not sure about last 3, but I have no experience in all of them, so I'd like to hear any advice from SW community.

What's the best way to import or aggregate data for this table?

For example for aggregation via mongoose with only "price" row with range (50++) will require: ((n=300)/(range=50))=6 time queries only for "today" timestamp

  1. 0-50
  2. 50-100
  3. 100-...
  4. ...-n

Is there any way to make this operation more easy and simple w/o using "for" cycle or async?

Well, I hope that SW community will help me with relevant experience.



via AlexZeDim

No comments:

Post a Comment