Importing Data and Code Across Vizzes

You can import code and data across vizzes! This is useful for uploading data to VizHub and creating multiple visualizations of that data. If you update the data, all vizzes that use it instantly update as well. To upload datasets up to 6MB and use this import feature with them, upgrade to VizHub Premium.

For example, consider the following viz, which contains a dataset and a named export from index.js called data:

The custom URL for that viz is:

https://vizhub.com/curran/keeling-curve-data

It contains logic that import data from a CSV file, parses it, then exports it:

import data from './data.csv';
// Complex parsing logic goes here...
export { data };

Therefore it can be imported into another viz using the following syntax:

import { data } from '@curran/keeling-curve-data';

such as this line chart:

Benefits

One strong use case for importing across vizzes is the ability to upload a dataset once, then create many visualizations of it. You can also use this feature to export reusable components such as utilities for responding to resize, responsive axes, or any reusable logic.