datasette-vega
datasette-vega copied to clipboard
Chart suggestions
When the page first loads the plugin should come up with 1-3 chart suggestions with human descriptions and display those as options. Clicking an option will open the graphing tool pre-configured for the selected suggestion.
For example..
Suggested charts: name against goose eggs, name against league_average_gpct
Maybe even suggest some bar charts and some scatter charts (and maybe a line chart if the data is obviously temporal).
To do this I think I'm going to change the properties of the <DatasetteVega ...>
component.
It currently takes a base_url=
property (with a URL to the .json
version of a Datasette table or query) and an optional columns=
property so that our tests don't fail trying to make a fetch()
call.
Instead, I'm going to pass in the actual data=
data array having fetched it already. The code that inserts <DatasetteVega ...>
will be responsible for fetching the data first.
This means the columns logic and the suggestions logic can run entirely within the component based just on the passed in properties. It should also allow me to write unit tests for the component without needing to mock fetch()
calls.
Related note: I shouldn't render a graph at all unless both the x_column
and y_column
have been selected.
If you're looking into this, it this paper here, on making suggested visualisations outlined in this paper here, might be of interest:
https://idl.cs.washington.edu/papers/compassql/
Creating effective visualizations requires domain familiarity as well as design and analysis expertise, and may impose a tedious specification process. To address these difficulties, many visualization tools complement manual specification with recommendations.
However, designing interfaces, ranking metrics, and scalable recommender systems remain important research challenges. In this paper, we propose a common framework for facilitating the development of visualization recommender systems in the form of a specification language for querying over the space of visualizations.
We present the preliminary design of CompassQL, which defines (1) a partial specification that describes enumeration constraints, and (2) methods for choosing, ranking, and grouping recommended visualizations. To demonstrate the expressivity of the language, we describe existing recommender systems in terms of CompassQL queries.
There's also a working version of it at. http://vega.github.io/voyager/
If you take an csv export from say, here:
https://fivethirtyeight.datasettes.com/fivethirtyeight-440525b/nba-elo%2Fnbaallelo.csv?_size=max
And dump it in, and it automatically generates a load of different charts based on the dimensions in the data.
Then, if you then drag say , points (ptz) from the left, to the X axis slot, it then creates a load more viz, based on it. How cool?
This isn't a feature request, I was just playing with it when looking over datasette-vega, and figured it might be of interest 👍
Any update on this? Would be pretty cool to have it!
There's now a second, updated version of Voyager.
https://vega.github.io/voyager2/
Another useful project in the chart recommendation space is Lux, although it seems to require Jupyter to be active to be able to use it. I'll file an issue to see if there are recommendations about running Lux headlessly (without Jupyter active) as a standalone python process.
https://lux-api.readthedocs.io/en/latest/