Published
Edited
Mar 11, 2021
Insert cell
md`# render-raw-project`
Insert cell
chart = {
let node = document.createElement("div");
node.id = "root";
renderRAWProject(project, 'root')
return node
}
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
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

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more