A guide to loading remote data into CanvasXpress.
CanvasXpress not only lets you create data visualizations in the JSON format, but it also allows you to load other data formats, including XML, PNG, and tab-delimited (CSV, TSV). It also reads compressed and archived data — a gzipped file (.gz) or a .zip, .tar or .tar.gz archive that bundles one or more of the supported files.
Create these visualization formats programmatically or by dragging and dropping them into the CanvasXpress visualization.
Below is an example showing a visualization of a CSV file dataset. See the parameters in the JSON below.
new CanvasXpress({
renderTo: "canvasCSV",
data: "https://raw.githubusercontent.com/neuhausi/Rdatasets/master/csv/datasets/ToothGrowth.csv",
config: {
title: "Tooth Growth",
smpLabelRotate: 90,
graphType: "Boxplot",
theme: "CanvasXpress",
graphOrientation: "vertical",
xAxis: ["len"],
metaData: {
"dose": true
},
groupingFactors: ["dose"]
}
});
To demonstrate the drag and drop capabilities of the CanvasXpress visualization, you may download the files below and drag them into the visualization. This tool allows for easy and time-effective handling of datasets.
Data files are often shipped compressed or bundled together. CanvasXpress reads them directly — drag a compressed or archived file onto a visualization, or point data at its URL, and it is decompressed and rendered in the browser with no server round-trip and no extra libraries.
data property is the name of another file in the archive, that file is loaded as the data and the JSON supplies the config, title and events.
Loading from a URL works like any other remote file — set data to the archive's address and CanvasXpress fetches, decompresses and renders it:
// A .zip / .tar / .tar.gz that bundles the data (and optional config)
new CanvasXpress({
renderTo: "canvasArchive",
data: "https://www.canvasxpress.org/data/archives/expression.tar.gz"
});
// A single gzip-compressed file
new CanvasXpress({
renderTo: "canvasGz",
data: "https://www.canvasxpress.org/data/archives/expression.csv.gz",
config: { graphType: "Heatmap" }
});
The supported entry formats are the same ones listed above (JSON, CSV/TSV, XML, GML, GEXF, GeoJSON, SVG, PNG, Parquet). Drag-and-drop handles all of them; loading over a URL currently supports JSON, CSV/TSV, Parquet, SVG and PNG entries (graph and map formats inside a URL archive are handled by drag-and-drop). Encrypted and Zip64 archives are not supported.