Skip to content
This repository

Presenters and formatters (visualisation idea) #53

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

4 participants

Stefan Urbanek Christian G. Warden Cristian Salamea claudiobertoldi
Stefan Urbanek
Owner
Stiivi commented May 10, 2012

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
Stefan Urbanek
Owner
Stiivi commented May 23, 2012

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)

Christian G. Warden
cwarden commented May 23, 2012

I recommend ccc for an open source visualization solution.

Cristian Salamea

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.

Stefan Urbanek
Owner

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?

Cristian Salamea

I am agree, so you gives

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

to allow modularity in UI libraries ?

Cristian Salamea

@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.

Stefan Urbanek
Owner

@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?

Stefan Urbanek Stiivi referenced this issue from a commit October 17, 2012
implemented simple data table and simple html table presenters; added…
… presenter registration and discovery; include templates in installation; partially implements #53
9d227e5
Stefan Urbanek
Owner

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.

Stefan Urbanek
Owner

Another interesting JS charting library: Rickshaw

Cristian Salamea

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

Stefan Urbanek
Owner

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.

Stefan Urbanek
Owner

Another lib: nvd3

Jonathan Camile deytao referenced this issue from a commit in deytao/cubes October 17, 2012
implemented simple data table and simple html table presenters; added…
… presenter registration and discovery; include templates in installation; partially implements #53
05f20c7
code6 code6 referenced this issue from a commit in code6/cubes October 17, 2012
implemented simple data table and simple html table presenters; added…
… presenter registration and discovery; include templates in installation; partially implements #53
035ea37
code6 code6 referenced this issue from a commit in code6/cubes October 17, 2012
implemented simple data table and simple html table presenters; added…
… presenter registration and discovery; include templates in installation; partially implements #53
c7ef022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.