Skip to content

Commit d65e4cf

Browse files
committed
✨ fix for #275
1 parent 2b79498 commit d65e4cf

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

plotly_resampler/figure_resampler/assets/coarse_fine.js

+8-7
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ window.dash_clientside = Object.assign({}, window.dash_clientside, {
9090
const layout_axis_anchors = getLayoutAxisAnchors(main_graphDiv.layout);
9191

9292
// Use the maingraphDiv its layout to obtain a list of a list of all shared (x)axis names
93-
// in practice, these are the xaxis names that are linked to each other (i.e. the inner list is the
93+
// in practice, these are the xaxis names that are linked to each other (i.e. the inner list is the
9494
// xaxis names of the subplot columns)
9595
// e.g.: [ [xaxis1, xaxis2], [xaxis3, xaxis4] ]
9696
let shared_axes_list = _.chain(main_graphDiv.layout)
@@ -127,7 +127,7 @@ window.dash_clientside = Object.assign({}, window.dash_clientside, {
127127
};
128128

129129
// iterate over the selected data range
130-
console.log('selected data range', selectedData.range);
130+
console.log("selected data range", selectedData.range);
131131
for (const anchor_key in selectedData.range) {
132132
const selected_range = selectedData.range[anchor_key];
133133
// Obtain the anchor key of the orthogonal axis (x or y), based on the coarse graphdiv anchor pairs
@@ -157,6 +157,7 @@ window.dash_clientside = Object.assign({}, window.dash_clientside, {
157157
Object.keys(relayout).length > 0 ? Plotly.relayout(main_graphDiv, relayout) : null;
158158
return mainFigID;
159159
},
160+
160161
main_to_coarse: function (mainRelayout, coarseFigID, mainFigID) {
161162
const coarse_graphDiv = getGraphDiv(coarseFigID);
162163
const main_graphDiv = getGraphDiv(mainFigID);
@@ -180,6 +181,8 @@ window.dash_clientside = Object.assign({}, window.dash_clientside, {
180181
};
181182
};
182183

184+
// console.log("main to coarse", mainRelayout);
185+
183186
// Base case; no selections yet on the coarse graph
184187
if (!currentSelections) {
185188
// if current selections is None
@@ -220,11 +223,9 @@ window.dash_clientside = Object.assign({}, window.dash_clientside, {
220223
) {
221224
performed_update = true;
222225
if (
223-
// mainRelayout[x_axis_key + ".showspikes"] === false &&
224-
// mainRelayout[y_axis_key + ".showspikes"] === false
225-
// NOTE: for some reason, showspikes info is only availabel for the xaxis & yaxis keys
226-
mainRelayout["xaxis.showspikes"] === false &&
227-
mainRelayout["yaxis.showspikes"] === false
226+
// NOTE: for some reason, showspikes info is only available for the xaxis & yaxis keys
227+
_.has(mainRelayout, "xaxis.showspikes") &&
228+
_.has(mainRelayout, "yaxis.showspikes")
228229
) {
229230
// reset axis -> we use the coarse graphDiv layout
230231
x_range = coarse_graphDiv.layout[x_axis_key].range;

0 commit comments

Comments
 (0)