Skip to content

Feature: Formal URL API #1365

@NickCrews

Description

@NickCrews

First, thanks for your work on this, I think vega is brilliant.

I want to make it easy to share interactive versions of charts with coworkers. I am using altair to make charts. I could export as a static HTML, but that involves uploading and downloading files.

In your webui, you can get a shareable link to a chart by encoding the JSON spec into a LZ compressed string, which is then stored directly in the URL. Brilliant! I can share this URL with coworkers and it's super easy.

Currently, I can go through this flow:

  1. use chart.to_json() from Altair
  2. copy that json string manually into the webui
  3. use the webui to get the shareable link

I would like to make this more streamlined, so there is something like Chart.to_url() which gives me the link directly.

The problem is that the web UI uses a custom implementation of LZ compression, and while there is a python port it is outdated and doesn't work (doesn't decode from URI). So from python, I don't have a good way of encoding the JSON spec into the URL.

To make this work, I think we would need to:

  1. Get buy in from you that this is worthwhile
  2. Switch to have a more formal/portable URL encode/decode algorithm so other languages can write to it
  3. Ideally, formalize the URL API even more so you can choose options like "enter in fullscreen"
  4. Ideally, have an option to make the viewed chart super clean and minimal, even more minimal than fullscreen.
  5. Ideally, add this .to_url() method to altair.Chart. But I can write my own helper function for this, so not really needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions