From 4b40b6bdf2c8bcc56cd6d0db98f684d971454edb Mon Sep 17 00:00:00 2001 From: Folyd Date: Sun, 27 Jun 2021 11:48:47 +0800 Subject: [PATCH] Support legend --- index.html | 1 + src/SvelteHeatmap.svelte | 19 ++++++++++++++++-- src/views/Legend.svelte | 42 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 src/views/Legend.svelte diff --git a/index.html b/index.html index e709b88..1a3c8b2 100644 --- a/index.html +++ b/index.html @@ -120,6 +120,7 @@

svelte-heatmap

startDate: moment().subtract(5, 'months').toDate(), endDate: moment().toDate(), view: 'monthly', + displayLegend: false, }, target: document.querySelector('#monthly'), }); diff --git a/src/SvelteHeatmap.svelte b/src/SvelteHeatmap.svelte index 23d19d8..1b48963 100644 --- a/src/SvelteHeatmap.svelte +++ b/src/SvelteHeatmap.svelte @@ -53,6 +53,16 @@ {/each} {/if} + {#if displayLegend} + + {/if} \ No newline at end of file diff --git a/src/views/Legend.svelte b/src/views/Legend.svelte new file mode 100644 index 0000000..21c470b --- /dev/null +++ b/src/views/Legend.svelte @@ -0,0 +1,42 @@ + + {#each colors as color, index} + + {/each} + + Less + + + More + + + + \ No newline at end of file