Replies: 3 comments 8 replies
-
Thanks a lot for the discussion, we realize that our documentation leaves a lot to be desired and would love to improve it. So, this is great feedback. One reason that documentation is difficult is because we're trying to keep a flexible component that can work in a wide variety of scenarios. For example, we don't assume you're using WebPack or force any assumptions on how you create your app. At the moment, we have our examples page showing several configurations. Hopefully you can match one of them with your toolchain and deployment model. The best way to emulate one of these pages is to Looks like you want just the Perhaps I'll suggest copying this page: https://microsoft.github.io/SandDance/tests/v4/umd/qualBarChartTest.html You'll want to get familiar with the Insight object which specifies the chart type and column mapping. If you use TypeScript in your project, then Intellisense may help you define these. Another way I like to create mine is to use the online app to dial in my chart, then invoke this in the JavaScript console: SandDanceApp.explorer.getInsight() Happy to continue the discussion if you can narrow down how you create and deploy your app. |
Beta Was this translation helpful? Give feedback.
-
Here's a complete example, with a dropdown that changes the x axis: <!DOCTYPE html>
<html>
<head>
<title>Single page SandDance</title>
<link rel="stylesheet" href="https://unpkg.com/@msrvida/sanddance@4/dist/css/sanddance.css" />
<style>
body {
font-family: Arial, Helvetica, sans-serif;
padding: 1em;
}
#vis {
height: 700px;
}
/* override SandDance styles */
.sanddance-root {
display: grid;
grid-template-columns: 80% 20%;
}
.sanddance-gl,
.sanddance-panel {
position: unset;
}
/* hide Vega ui sliders */
.vega-bindings {
display: none;
}
</style>
<script src="https://unpkg.com/vega@^5.22/build/vega.js" charset="utf-8"></script>
<script src="https://unpkg.com/@msrvida/sanddance@4/dist/umd/sanddance.js"></script>
</head>
<body>
<h1>Cars data</h1>
X axis:
<select id="xaxis">
<option>Horsepower</option>
<option>Cylinders</option>
<option>Displacement</option>
<option>Weight_in_lbs</option>
<option>Acceleration</option>
</select>
<div id="vis"></div>
<script>
SandDance.use(vega);
const viewer = new SandDance.Viewer(document.getElementById('vis'));
//measure size of canvas, defined in style sheet above
var glDiv = viewer.presenter.getElement(SandDance.VegaMorphCharts.PresenterElement.gl);
const size = {
height: glDiv.offsetHeight,
width: glDiv.offsetWidth
};
var insight = {
columns: {
color: 'Origin',
x: 'Horsepower',
y: 'Miles_per_Gallon'
},
scheme: 'category20',
size,
chart: 'scatterplot',
view: '2d'
};
//fetch cars.json from vega website
fetch('https://vega.github.io/vega-datasets/data/cars.json')
.then(response => response.json())
.then(data => {
viewer.render({ insight }, data);
//get selection and change insight column x
document.getElementById('xaxis').addEventListener('change', function () {
insight.columns.x = this.value;
viewer.render({ insight }, data);
});
});
</script>
<p>
Other page content
</p>
</body>
</html> |
Beta Was this translation helpful? Give feedback.
-
Hello Dan, Considering, the image,
My (last I hope) questions:
Thanks again for your help. EDIT : |
Beta Was this translation helpful? Give feedback.
-
Hello,
I've discovered a few days ago SandDance while looking for the best way to visualize 14.000 scrapped newspaper headlines on a particular topic. SandDance seems tremendous (demo app is amazing, moreover in ultra-3D).
However, even if I'm not a that-a-newbie, I found super hard to get starting building something real.
More precisely, below what I'd like to build:
But the fact is, I do not know how to start, install what(?) with node, run what/where, etc. React or standalone... etc.
Any clue or tuto?
I didn't found anything useful on www (chapter
Component architecture
isn't super newbie-friendly....).Thanks a lot for your help and this lib.
Beta Was this translation helpful? Give feedback.
All reactions