diff --git a/site/examples/data/4/App.svelte b/site/examples/data/4/App.svelte new file mode 100644 index 0000000..8005bb7 --- /dev/null +++ b/site/examples/data/4/App.svelte @@ -0,0 +1,153 @@ + + + + +
+ + +
+ +
+ + + +
+ {value} +
+
+ + + {value} + + + {#each stacks as stack, i} + {#if !isFlattened} + {#each stack.values as d, vi} + +
+ + {/each} + {:else} + {#each stack.values as d, vi} + +
+ + {/each} + {/if} + {/each} + +
diff --git a/site/examples/data/4/data.js b/site/examples/data/4/data.js new file mode 100644 index 0000000..3207f03 --- /dev/null +++ b/site/examples/data/4/data.js @@ -0,0 +1,14 @@ +export default [ + { year: 2019, apples: 3840, bananas: 1920, cherries: 960, dates: 400 }, + { year: 2018, apples: 1600, bananas: 1440, cherries: 960, dates: 400 }, + { year: 2017, apples: 820, bananas: 1000, cherries: 640, dates: 400 }, + { year: 2016, apples: 820, bananas: 560, cherries: 720, dates: 400 }, + { year: 2015, apples: 3840, bananas: 1020, cherries: 960, dates: 400 }, + { year: 2014, apples: 1600, bananas: 1240, cherries: 960, dates: 400 }, + { year: 2013, apples: 820, bananas: 1200, cherries: 640, dates: 400 }, + { year: 2012, apples: 820, bananas: 860, cherries: 720, dates: 400 }, + { year: 2011, apples: 840, bananas: 1920, cherries: 960, dates: 400 }, + { year: 2010, apples: 1600, bananas: 1440, cherries: 960, dates: 400 }, + { year: 2009, apples: 820, bananas: 1000, cherries: 640, dates: 400 }, + { year: 2008, apples: 820, bananas: 560, cherries: 720, dates: 400 } +]; diff --git a/site/examples/data/4/meta.json b/site/examples/data/4/meta.json new file mode 100644 index 0000000..119243d --- /dev/null +++ b/site/examples/data/4/meta.json @@ -0,0 +1 @@ +{"name": "Pancake • Stacked to Grouped Bar"} diff --git a/site/examples/data/5/App.svelte b/site/examples/data/5/App.svelte new file mode 100644 index 0000000..1e6ee62 --- /dev/null +++ b/site/examples/data/5/App.svelte @@ -0,0 +1,458 @@ + + + + +
+ + + +
2001
+
+ + +

UFO Sightings (By Shape)

+
+ +
2002
+
+ + + + + + + + + + {#each points as point, i} + + { + highlightSlope(point.id); + }} + on:mouseout={cancelHighlight} + class={`data ${hoverId === point.id ? 'highlight' : point.p[0].y > point.p[1].y ? 'downward' : 'upward'}`} + {d} /> + + {/each} + + + {#each data as d, i} + {#if leftClusters.find(j => j.shape === d.shape) === undefined} + +
highlightSlope(d.shape)} + on:mouseout={cancelHighlight} + class={`left-labels ${d.shape === hoverId ? 'highlight' : ''}`} + style={`transform: translate(0, ${left_label_shifts[i]}px)`}> + {`${d.shape}`} +
+
+ {/if} + {/each} + {#each data as d, i} + {#if rightClusters.find(j => j.shape === d.shape) === undefined} + +
highlightSlope(d.shape)} + on:mouseout={cancelHighlight} + class={`right-labels ${d.shape === hoverId ? 'highlight' : ''}`} + style={`transform: translate(0, ${right_label_shifts[i]}px)`}> + {`${d.shape} `} +
+
+ {/if} + {/each} + + {#if isLeftToolTip} +
+ {#each leftClusters as d} +
highlightSlope(d.shape)} + on:mouseout={cancelHighlight} + class={`tool-tip ${d.shape === hoverId ? 'highlight' : ''}`}> + {`${d.shape}`} +
+ {/each} +
+ {/if} +
+ + + {#if isRightToolTip} +
+ {#each rightClusters as d} +
highlightSlope(d.shape)} + on:mouseout={cancelHighlight} + class={`tool-tip ${d.shape === hoverId ? 'highlight' : ''}`}> + {`${d.shape}`} +
+ {/each} +
+ {/if} +
+ + {#if hoverId} + +
+

{hoverId}

+
+
+

2001

+

{displayData.y2001}

+
+
+

2002

+

{displayData.y2002}

+
+
+ +
+
+ {/if} +
+
+

+ Based on + + http://skedasis.com/d3/slopegraph/ + +

diff --git a/site/examples/data/5/data.js b/site/examples/data/5/data.js new file mode 100644 index 0000000..3d9b6a8 --- /dev/null +++ b/site/examples/data/5/data.js @@ -0,0 +1,23 @@ +export default [ + { shape: "light", y2001: 730, y2002: 722 }, + { shape: "triangle", y2001: 362, y2002: 365 }, + { shape: "unknown", y2001: 302, y2002: 387 }, + { shape: "circle", y2001: 270, y2002: 305 }, + { shape: "other", y2001: 266, y2002: 274 }, + { shape: "disk", y2001: 228, y2002: 259 }, + { shape: "fireball", y2001: 210, y2002: 194 }, + { shape: "sphere", y2001: 177, y2002: 195 }, + { shape: "oval", y2001: 170, y2002: 153 }, + { shape: "formation", y2001: 125, y2002: 102 }, + { shape: "cigar", y2001: 100, y2002: 83 }, + { shape: "changing", y2001: 92, y2002: 112 }, + { shape: "diamond", y2001: 74, y2002: 62 }, + { shape: "rectangle", y2001: 58, y2002: 56 }, + { shape: "flash", y2001: 53, y2002: 72 }, + { shape: "chevron", y2001: 50, y2002: 66 }, + { shape: "cylinder", y2001: 50, y2002: 65 }, + { shape: "egg", y2001: 46, y2002: 53 }, + { shape: "teardrop", y2001: 38, y2002: 44 }, + { shape: "cone", y2001: 25, y2002: 21 }, + { shape: "cross", y2001: 9, y2002: 12 } +]; diff --git a/site/examples/data/5/meta.json b/site/examples/data/5/meta.json new file mode 100644 index 0000000..b2239fc --- /dev/null +++ b/site/examples/data/5/meta.json @@ -0,0 +1 @@ +{ "name": "Pancake • Slope graph" } diff --git a/site/examples/data/index.svelte b/site/examples/data/index.svelte index 0a995af..f94e836 100644 --- a/site/examples/data/index.svelte +++ b/site/examples/data/index.svelte @@ -1,65 +1,101 @@ -
-
-

Population pyramid

-

Edit

-
- -
+
-
-

Treemap

-

Edit

-
- +
+

Population pyramid

+

+ + Edit + +

+
+
- \ No newline at end of file +
+
+

Treemap

+

+ + Edit + +

+
+ +
+
+
+

Stacked to Grouped Bars

+

+ + Edit + +

+
+ +
+
+
+

Slope Graph

+

+ + Edit + +

+
+ +