Skip to content

Commit

Permalink
fix color_scale not a function error in MPtrjElemCountsPtable.svelte
Browse files Browse the repository at this point in the history
  • Loading branch information
janosh committed Nov 24, 2023
1 parent 0ad440c commit 2c8d9d0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
6 changes: 3 additions & 3 deletions site/src/lib/PtableHeatmap.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
export let heatmap_values: Record<string, number>
export let color_scale: string = `Viridis`
export let active_elem: ChemicalElement
export let active_element: ChemicalElement
export let log = false // log color scale
export const snapshot: Snapshot = {
Expand All @@ -19,12 +19,12 @@
{heatmap_values}
{color_scale}
{log}
bind:active_element={active_elem}
bind:active_element
show_photo={false}
>
<TableInset slot="inset">
<label for="log">Log color scale<Toggle id="log" bind:checked={log} /></label>
<PtableInset element={active_elem} elem_counts={heatmap_values} />
<PtableInset element={active_element} elem_counts={heatmap_values} />
<ColorBar
text_side="top"
{color_scale}
Expand Down
9 changes: 1 addition & 8 deletions site/src/routes/data/mptrj/MPtrjElemCountsPtable.svelte
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<script lang="ts">
import { PtableHeatmap } from '$lib'
import figshare_urls from '$root/data/figshare/1.0.0.json'
import type { Snapshot } from './$types'
export let color_scale = [`Inferno`]
export let log = false // log color scale
export let count_mode = `occurrence`
Expand All @@ -13,11 +11,6 @@
})
$: mp_trj_elem_counts = elem_counts[`../mp-trj-element-counts-by-${count_mode}.json`]
export const snapshot: Snapshot = {
capture: () => ({ color_scale, log, count_mode }),
restore: (values) => ({ color_scale, log, count_mode } = values),
}
</script>

<p>
Expand All @@ -26,4 +19,4 @@
which are frames of the DFT relaxations performed on all 154,719 MP materials.
</p>

<PtableHeatmap heatmap_values={mp_trj_elem_counts} {color_scale} {log} {count_mode} />
<PtableHeatmap heatmap_values={mp_trj_elem_counts} {log} {count_mode} {...$$props} />

0 comments on commit 2c8d9d0

Please sign in to comment.