Presenters and formatters (visualisation idea) #53

Open
Stiivi opened this Issue May 10, 2012 · 13 comments

Projects

None yet

4 participants

@Stiivi
Data Brewery member

Add presenters/formatters module which will be able to format data for various visualisation libraries.

Also needed:

  • tables (any javascript table libs suggestions?)

Description

  • Presenter: presents whole result
  • Formatter: formats one value (like a table cell)

API suggestion:

  • get_presenter(name) - create a presenter instance, ex.:get_presenter("highcharts")`
  • Presenter.generate(object) - generate presentation of an object

Notes:

  • HTTP query would include a presenter key
@Stiivi
Data Brewery member

Looks like presenter will need also cut (for constructing URL links), browser (for additional queries, if necessary, like getting details) and cell detail (to form table headers).

queries in report(report) might contain key presenter to format the query to desired JSON structure (if presenter returns JSON-tranformable object)

@cwarden

I recommend ccc for an open source visualization solution.

@ovnicraft

We can consider too http://www.humblesoftware.com/flotr2/ is a good library for data visualization and shows you data in table and allows you to download data from graphics.

@Stiivi
Data Brewery member

both (ccc and flotr) look useable. the HTTP API might be simple format=flotr2, what about python interface?

result = browser.aggregate(...)
presenter = cubes.presenter("flotr2", options ...)
chart = presenter.present(result, type="pie", ...)

what do you think about this?

@ovnicraft

I am agree, so you gives

presenter = cubes.presenter("flotr2", options ...)

to allow modularity in UI libraries ?

@ovnicraft

@Stiivi when you say:

presenter = cubes.presenter("flotr2", options ...)
chart = presenter.present(result, type="pie", ...)

What contains chart ?, in if we got 2 layers python + JS side we need to response to JS side with JSON so would be better if just dumps result with presenter.

@Stiivi
Data Brewery member

@ovnicraft - you are right. chart should in fact be flotr2 representation of a chart (data structure that you directly pass to flotr2 libs). For example, *Presenter objects for JS charts should return objects that can be used by JS libraries, if the lib expects JSON, then it should be JSON. The two steps you mentioned have a reason:

presenter = cubes.presenter("flotr2", options ...)
chart1 = presenter.present(result1, type="pie", ...)
chart2 = presenter.present(result2, type="bar", ...)
chart3 = presenter.present(result3, type="line", ...)

I would prefer presenter to return an object that can be JSON-ified (not JSON string), so you can request multiple presentations with one request (for example, for whole report page).

What do you think?

@Stiivi Stiivi pushed a commit that referenced this issue Oct 17, 2012
Stefan Urbanek implemented simple data table and simple html table presenters; added…
… presenter registration and discovery; include templates in installation; partially implements #53
9d227e5
@Stiivi
Data Brewery member

Used cubes.create_presenter() instead of just cubes.presenter() to denote that new instance of presenter is created instead of reusing and reconfiguring existing one.

@Stiivi
Data Brewery member

Another interesting JS charting library: Rickshaw

@ovnicraft

I am agree with you about JSON-fied object, so Presenter class must be implement a json method to return ?

@Stiivi
Data Brewery member

It does not have to (see "text_table" presenter), but for most use cases it is going to be implemented as JSON. Result object should be displayed by caller by no minimal transformation effort at all, or just very minimal.

@Stiivi
Data Brewery member

Another lib: nvd3

@deytao deytao added a commit to deytao/cubes that referenced this issue Dec 3, 2012
Stefan Urbanek implemented simple data table and simple html table presenters; added…
… presenter registration and discovery; include templates in installation; partially implements #53
05f20c7
@code6 code6 pushed a commit to code6/cubes that referenced this issue Mar 13, 2014
Stefan Urbanek implemented simple data table and simple html table presenters; added…
… presenter registration and discovery; include templates in installation; partially implements #53
035ea37
@code6 code6 pushed a commit to code6/cubes that referenced this issue Mar 13, 2014
Stefan Urbanek implemented simple data table and simple html table presenters; added…
… presenter registration and discovery; include templates in installation; partially implements #53
c7ef022
@Stiivi Stiivi added wish and removed enhancement labels Jun 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment