|
| 1 | +<script> |
| 2 | + import { Deeptable, Scatterplot } from '../src/deepscatter'; |
| 3 | + import { onMount } from 'svelte'; |
| 4 | + import SwitchPositions from './svelte/SwitchPositions.svelte'; |
| 5 | + import ColorChange from './svelte/ColorChange.svelte'; |
| 6 | + import SizeSlider from './svelte/SizeSlider.svelte'; |
| 7 | + import PositionScales from './svelte/PositionScales.svelte'; |
| 8 | + import SelectPoints from './svelte/SelectPoints.svelte'; |
| 9 | + const startSize = 0.8; |
| 10 | + const prefs = { |
| 11 | + max_points: 100000, |
| 12 | + alpha: 35, // Target saturation for the full page. |
| 13 | + zoom_balance: 0.05, // Rate at which points increase size. https://observablehq.com/@bmschmidt/zoom-strategies-for-huge-scatterplots-with-three-js |
| 14 | + point_size: startSize, // Default point size before application of size scaling |
| 15 | + background_color: '#EEEDDE', |
| 16 | + duration: 100, |
| 17 | + encoding: { |
| 18 | + x: { |
| 19 | + field: 'x', |
| 20 | + transform: 'literal', |
| 21 | + }, |
| 22 | + y: { |
| 23 | + field: 'y', |
| 24 | + transform: 'literal', |
| 25 | + }, |
| 26 | + }, |
| 27 | + }; |
| 28 | +
|
| 29 | + let scatterplot = null; |
| 30 | + onMount(async () => { |
| 31 | + const tb = await Deeptable.fromQuadfeather({ |
| 32 | + baseUrl: 'http://localhost:8080/everyone', |
| 33 | + }); |
| 34 | + window.tb = tb; |
| 35 | + scatterplot = new Scatterplot({ selector: '#deepscatter', deeptable: tb }); |
| 36 | + window.scatterplot = scatterplot; |
| 37 | + scatterplot.plotAPI(prefs); |
| 38 | + }); |
| 39 | +</script> |
| 40 | + |
| 41 | +<div id="overlay"> |
| 42 | + <!-- <SwitchPositions {scatterplot}></SwitchPositions> |
| 43 | + <ColorChange {scatterplot}></ColorChange> |
| 44 | + <SizeSlider size={startSize} {scatterplot}></SizeSlider> |
| 45 | + <PositionScales {scatterplot} /> |
| 46 | + <SelectPoints {scatterplot}></SelectPoints> --> |
| 47 | +</div> |
| 48 | + |
| 49 | +<div id="deepscatter"></div> |
| 50 | + |
| 51 | +<style> |
| 52 | + #overlay { |
| 53 | + position: fixed; |
| 54 | + z-index: 10; |
| 55 | + left: 40px; |
| 56 | + top: 40px; |
| 57 | + } |
| 58 | + #deepscatter { |
| 59 | + z-index: 0; |
| 60 | + width: 100vw; |
| 61 | + height: 100vh; |
| 62 | + } |
| 63 | +</style> |
0 commit comments