Published
Edited
Mar 4, 2021
2 forks
Importers
3 stars
Insert cell
md`# render-raw-project`
Insert cell
html`<div id="root"></div>`
Insert cell
project = FileAttachment("pupulation.rawgraphs")
Insert cell
charts = Object.values(rawgraphCharts);
Insert cell
async function renderRAWProject(attachment, targetId) {
const textAttachment = await attachment.text()
const projectData = rawgraphsCore.deserializeProject(textAttachment, charts);
const results = rawgraphsCore.parseDataset(projectData.userData, projectData.dataTypes);
const viz = rawgraphsCore.chart(projectData.currentChart, {
data: results.dataset,
mapping: projectData.mapping,
dataTypes: projectData.dataTypes,
visualOptions: projectData.visualOptions
});
return viz.renderToDOM(document.getElementById(targetId))


}
Insert cell
renderRAWProject(project, '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