1
0
mirror of https://github.com/lana-k/sqliteviz.git synced 2026-08-05 07:19:17 +08:00

fix: save chart settings wihtout data #137

This commit is contained in:
lana-k
2026-07-12 17:18:41 +02:00
parent 053b8fbecb
commit 39d1604959
3 changed files with 132 additions and 8 deletions

View File

@@ -81,11 +81,13 @@ export default {
data() {
return {
plotly,
state: this.initOptions || {
data: [],
layout: { autosize: true },
frames: []
},
state: this.initOptions
? JSON.parse(JSON.stringify(this.initOptions))
: {
data: [],
layout: { autosize: true },
frames: []
},
config: {
editable: true,
displaylogo: false,
@@ -146,7 +148,7 @@ export default {
this.handleResize()
await nextTick()
const plotlyDiv =
this.$refs.plotlyEditor.$el.querySelector('.js-plotly-plot')
this.$refs.plotlyEditor?.$el?.querySelector('.js-plotly-plot')
plotlyDiv?.on('plotly_selected', selectionEvent => {
if (selectionEvent) {
this.selectedItem = 1
@@ -177,7 +179,7 @@ export default {
// TODO: check changes and enable Save button if needed
},
update(data, layout, frames) {
if (layout.selections?.length > 0) {
if (layout?.selections?.length > 0) {
layout.selections = []
data.forEach(dataItem => delete dataItem.selectedpoints)
}

View File

@@ -58,7 +58,7 @@
</icon-button>
<icon-button
v-if="mode !== 'pivot'"
v-if="mode === 'graph'"
ref="viewNodeOrEdgeBtn"
tooltip="View details"
tooltipPosition="top-left"