|
35 | 35 | <el-button class="view-heatmap-button" @click="logToggle">Toggle log</el-button> |
36 | 36 | </span> |
37 | 37 | </div> |
38 | | - <plot-controls :parent-element="{element: $refs.plotContainer}" :controls-enabled="!loading" /> |
| 38 | + <plot-controls :parent-element="{element: $refs.plotlyplot}" :controls-enabled="!loading" /> |
39 | 39 | </div> |
40 | 40 | </template> |
41 | 41 |
|
@@ -69,7 +69,8 @@ export default { |
69 | 69 | filterY: [], |
70 | 70 | loading: false, |
71 | 71 | logScale: false, |
72 | | - logDataValues: markRaw([]) |
| 72 | + logDataValues: markRaw([]), |
| 73 | + resizeObserver: null, |
73 | 74 | } |
74 | 75 | }, |
75 | 76 | computed: { |
@@ -104,14 +105,26 @@ export default { |
104 | 105 | }, |
105 | 106 | mounted: function () { |
106 | 107 | this.loadData(this.sourceData) |
| 108 | + this.resizeObserver = new ResizeObserver(() => { |
| 109 | + if (this.$refs.plotlyplot) { |
| 110 | + Plotly.Plots.resize(this.$refs.plotlyplot) |
| 111 | + } |
| 112 | + }) |
| 113 | + this.resizeObserver.observe(this.$refs.plotContainer) |
| 114 | + }, |
| 115 | + beforeUnmount: function () { |
| 116 | + if (this.resizeObserver) { |
| 117 | + this.resizeObserver.disconnect() |
| 118 | + } |
107 | 119 | }, |
108 | 120 | methods: { |
109 | 121 | loadData(sourceData) { |
110 | 122 | if (sourceData.url) { |
111 | 123 | this.loading = true |
112 | 124 | DataManager.loadFile(sourceData.url, this.dataReady) // Use url |
113 | 125 | } else { |
114 | | - Plotly.react(this.$refs.plotlyplot, this.sourceData.data, this.sourceData.layout ? this.sourceData.layout : this.layout, this.options) // Use plolty input |
| 126 | + const layout = this.sourceData.layout ? this.sourceData.layout : this.layout |
| 127 | + Plotly.react(this.$refs.plotlyplot, this.sourceData.data, layout, this.options) // Use plolty input |
115 | 128 | } |
116 | 129 | }, |
117 | 130 | dataReady(data) { |
@@ -191,7 +204,8 @@ export default { |
191 | 204 | } |
192 | 205 | ] |
193 | 206 | const heatmapLayout = {title: {text: this.plotTitle}} |
194 | | - Plotly.react(this.$refs.plotlyplot, tdata, {...this.layout, ...heatmapLayout, ...this.plotLayout}, this.options) //this.getOptions()) |
| 207 | + const layout = {...this.layout, ...heatmapLayout, ...this.plotLayout} |
| 208 | + Plotly.react(this.$refs.plotlyplot, tdata, layout, this.options) //this.getOptions()) |
195 | 209 | }, |
196 | 210 | populateColumnHeaders(parsedData) { |
197 | 211 | let all_data = parsedData.data |
@@ -224,13 +238,6 @@ export default { |
224 | 238 | text-align: left; |
225 | 239 | } |
226 | 240 |
|
227 | | -.bottom-right-control { |
228 | | - position: absolute; |
229 | | - bottom: 16px; |
230 | | - right: 16px; |
231 | | - z-index: 3; |
232 | | -} |
233 | | -
|
234 | 241 | @media only screen and (max-width: 48em) { |
235 | 242 | .ui-controls { |
236 | 243 | position: absolute; |
@@ -325,24 +332,4 @@ export default { |
325 | 332 | margin-right: 2px; |
326 | 333 | margin-top: 2px; |
327 | 334 | } |
328 | | -
|
329 | | -.bottom-right-control :deep( .plot-popper ){ |
330 | | - padding: 9px 10px; |
331 | | - min-width: 150px; |
332 | | - font-size: 12px; |
333 | | - color: #fff; |
334 | | - background-color: #8300bf; |
335 | | -} |
336 | | -.bottom-right-control :deep( .plot-popper .popper__arrow::after ){ |
337 | | - border-left-color: #8300bf !important; |
338 | | -} |
339 | | -
|
340 | | -.bottom-right-control :deep( .el-select__tags-text ){ |
341 | | - max-width: 90px; |
342 | | - overflow: hidden; |
343 | | - text-overflow: ellipsis; |
344 | | - white-space: nowrap; |
345 | | - display: inline-block; |
346 | | - vertical-align: middle; |
347 | | -} |
348 | 335 | </style> |
0 commit comments