-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
130 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,24 @@ | ||
<script lang="ts"> | ||
export let scatterplot; | ||
let value = 'category10'; | ||
const schemes = [ | ||
'okabe', | ||
'category10', | ||
'dark2', | ||
'pastel2' | ||
] | ||
const schemes = ['okabe', 'category10', 'dark2', 'pastel2']; | ||
function changeColor() { | ||
scatterplot.plotAPI({ | ||
encoding: { | ||
color: { | ||
field: scatterplot.prefs.encoding.color.field, | ||
range: value, | ||
// range: ["red", "yellow", "pink", "purple"], | ||
// domain: ["Apple", "Banana", "Strawberry", "Mulberry"] | ||
} | ||
} | ||
}) | ||
// range: ["red", "yellow", "pink", "purple"], | ||
// domain: ["Apple", "Banana", "Strawberry", "Mulberry"] | ||
}, | ||
}, | ||
}); | ||
} | ||
</script> | ||
|
||
<select bind:value={value} on:change={changeColor}> | ||
<select bind:value on:change={changeColor}> | ||
{#each schemes as scheme} | ||
<option value={scheme}>{scheme}</option> | ||
{/each} | ||
</select> | ||
</select> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<script lang="ts"> | ||
export let scatterplot; | ||
function plotBigX() { | ||
scatterplot.plotAPI({ | ||
encoding: { | ||
x: { | ||
field: 'x', | ||
domain: [-1, 1], | ||
range: [-2, 2], | ||
transform: 'linear', | ||
}, | ||
y: { | ||
field: 'y', | ||
domain: [-1, 1], | ||
range: [-3, 3], | ||
transform: 'linear', | ||
}, | ||
}, | ||
}); | ||
// for (let d of ['x', 'y']) { | ||
// scatterplot.deeptable.transformations[`big_${d}`] = async function ( | ||
// tile, | ||
// ) { | ||
// const trueVals = (await tile.get_column(d)).toArray(); | ||
// const out = new Float32Array(trueVals.length); | ||
// for (let i = 0; i < out.length; i++) { | ||
// out[i] = trueVals[i] * 2; | ||
// } | ||
// return out; | ||
// }; | ||
// } | ||
// scatterplot.plotAPI({ | ||
// encoding: { | ||
// x: { | ||
// field: 'big_x', | ||
// transform: 'linear', | ||
// domain: scatterplot.deeptable.extent.x.map((d) => d * 2), | ||
// range: scatterplot.deeptable.extent.x, | ||
// }, | ||
// y: { | ||
// field: 'big_y', | ||
// transform: 'linear', | ||
// domain: scatterplot.deeptable.extent.y.map((d) => d * 2), | ||
// range: scatterplot.deeptable.extent.y, | ||
// }, | ||
// }, | ||
// }); | ||
} | ||
function plotNormal() { | ||
scatterplot.plotAPI({ | ||
encoding: { | ||
x: { | ||
field: 'x', | ||
domain: [-1, 1], | ||
range: [-1, 1], | ||
}, | ||
y: { | ||
field: 'y', | ||
domain: [-1, 1], | ||
range: [-2, 2], | ||
}, | ||
}, | ||
}); | ||
} | ||
</script> | ||
|
||
<button on:click={plotBigX}>big x</button> | ||
<button on:click={plotNormal}>normal x</button> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters