Published
Edited
Mar 4, 2021
1 fork
Insert cell
md`# test-rawgraphs

An example of loading a .rawgraphs project as FileAttachment and rendering it in Observable
`
Insert cell
html`<div id="root"></div>`
Insert cell
project = FileAttachment("pupulation.rawgraphs").text()
Insert cell
charts = Object.values(rawgraphCharts);
Insert cell
projectData = rawgraphsCore.deserializeProject(project, charts);

Insert cell
results = rawgraphsCore.parseDataset(projectData.userData, projectData.dataTypes);
Insert cell
viz = rawgraphsCore.chart(projectData.currentChart, {
data: results.dataset,
mapping: projectData.mapping,
dataTypes: projectData.dataTypes,
visualOptions: projectData.visualOptions
});
Insert cell
viz.renderToDOM(document.getElementById('root'))
Insert cell
md`## imports
see https://observablehq.com/@observablehq/introduction-to-require
`
Insert cell
rawgraphsCore = import("https://cdn.skypack.dev/@rawgraphs/rawgraphs-core")
Insert cell
rawgraphCharts = import("https://cdn.skypack.dev/@rawgraphs/rawgraphs-charts")
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more