|
60 | 60 | } |
61 | 61 | </script> |
62 | 62 |
|
63 | | -<Plot |
64 | | - {data} |
65 | | - {fillParent} |
66 | | - {debounce} |
67 | | - {config} |
68 | | - layout={{ |
69 | | - margin: { t: 0 } |
70 | | - }} |
71 | | - libPlotly={useDefaultLib ? undefined : null} |
72 | | - on:click={console.log} |
73 | | - on:relayout={console.log} |
74 | | -/> |
| 63 | +<main> |
| 64 | + <section class="plot"> |
| 65 | + <Plot |
| 66 | + {data} |
| 67 | + {fillParent} |
| 68 | + {debounce} |
| 69 | + {config} |
| 70 | + layout={{ |
| 71 | + margin: { t: 0 } |
| 72 | + }} |
| 73 | + libPlotly={useDefaultLib ? undefined : null} |
| 74 | + on:click={console.log} |
| 75 | + on:relayout={console.log} |
| 76 | + /> |
| 77 | + </section> |
75 | 78 |
|
76 | | -<div class="controls"> |
77 | | - <button on:click={addData}>Add trace</button> |
78 | | - <button on:click={changeY0}>Increase y<sub>0</sub></button> |
79 | | - <button on:click={() => (useDefaultLib = !useDefaultLib)}>Swap lib</button> |
80 | | - <button on:click={() => (fillParent = false)}>Fixed size</button> |
81 | | - <button on:click={() => (fillParent = true)}>Fill parent</button> |
82 | | - <button on:click={() => (fillParent = 'width')}>Fill width</button> |
83 | | - <button on:click={() => (fillParent = 'height')}>Fill height</button> |
84 | | - <button on:click={() => (debounce = undefined)}>Don't debounce</button> |
85 | | - <button on:click={() => (debounce = 500)}>Debounce 500ms</button> |
86 | | - <button on:click={() => (debounce = { wait: 500, maxWait: 2000 })} |
87 | | - >Debounce 500ms, max wait 2s</button |
88 | | - > |
89 | | -</div> |
| 79 | + <section class="controls"> |
| 80 | + <button on:click={addData}>Add trace</button> |
| 81 | + <button on:click={changeY0}>Increase y<sub>0</sub></button> |
| 82 | + <button on:click={() => (useDefaultLib = !useDefaultLib)}>Swap lib</button> |
| 83 | + <button on:click={() => (fillParent = false)}>Fixed size</button> |
| 84 | + <button on:click={() => (fillParent = true)}>Fill parent</button> |
| 85 | + <button on:click={() => (fillParent = 'width')}>Fill width</button> |
| 86 | + <button on:click={() => (fillParent = 'height')}>Fill height</button> |
| 87 | + <button on:click={() => (debounce = undefined)}>Don't debounce</button> |
| 88 | + <button on:click={() => (debounce = 500)}>Debounce 500ms</button> |
| 89 | + <button on:click={() => (debounce = { wait: 500, maxWait: 2000 })} |
| 90 | + >Debounce 500ms, max wait 2s</button |
| 91 | + > |
| 92 | + </section> |
| 93 | +</main> |
90 | 94 |
|
91 | 95 | <style lang="scss"> |
92 | 96 | :global(html, body, body > div) { |
|
95 | 99 | width: 100vw; |
96 | 100 | height: 100vh; |
97 | 101 | } |
98 | | - .controls { |
99 | | - position: absolute; |
100 | | - left: 0; |
101 | | - bottom: 0; |
| 102 | + main { |
| 103 | + display: flex; |
| 104 | + flex-direction: column; |
| 105 | + justify-items: stretch; |
| 106 | +
|
| 107 | + width: 100vw; |
| 108 | + height: 100vh; |
| 109 | +
|
| 110 | + .plot { |
| 111 | + flex-grow: 1; |
| 112 | + margin: 1rem; |
| 113 | + } |
102 | 114 | } |
103 | 115 | </style> |
0 commit comments