Public
Edited
Apr 17, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
viewof view = vegaEmbed(vegaSpecs[0])
Insert cell
viewof view2 = vegaEmbed(vegaSpecs[1])
Insert cell
viewof view3 = vegaEmbed(vegaSpecs[2])
Insert cell
Insert cell
Insert cell
url = custom !== '' ? custom : preset.url
Insert cell
rawData = fetch(url).then((response) => response.text())
Insert cell
data = {
const parsedData = papa.parse(rawData, { header: true });
return {
data: parsedData,
headers: Object.keys(parsedData.data[0])
};
}
Insert cell
visualizePrompt = `Here's a dataset:
${rawData.slice(0, 5000)}.
Suggest three ways to visualize this dataset, then provide the three corresponding Vega Lite specs in json format, using the url "${url}" for the data property.`
/*Answer the following question about this dataset: ${question}
Then suggest three ways to visualize the answer to this question, and generate associated vega lite specs using nice color schemes and the following URL for the data: "${url}".`*/
Insert cell
visualizeMessage = await askChatGpt(visualizePrompt)
Insert cell
Insert cell
Insert cell
Insert cell
openai = import('https://cdn.skypack.dev/openai@3.2.1?min')
Insert cell
MarkdownIt = require("markdown-it@12/dist/markdown-it.min.js")
Insert cell
vegaEmbed = require("vega-embed@6")
Insert cell
papa = require("papaparse@5.3.2/papaparse.min.js")
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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