Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Presenters and formatters (visualisation idea) #53

Open
Stiivi opened this Issue · 13 comments

4 participants

@Stiivi
Owner

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
Owner

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

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

@Stiivi Stiivi referenced this issue from a commit
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
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.

@Stiivi
Owner

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

@Stiivi
Owner

Another lib: nvd3

@deytao deytao referenced this issue from a commit in deytao/cubes
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 referenced this issue from a commit in code6/cubes
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 referenced this issue from a commit in code6/cubes
Stefan Urbanek 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.