Skip to content

Commit 46e629f

Browse files
jonasvddjvdd
andauthored
✨ fix for #275 (#286)
* ✨ fix for #275 * 🧹 review code --------- Co-authored-by: Jeroen Van Der Donckt <[email protected]>
1 parent 2b79498 commit 46e629f

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

plotly_resampler/figure_resampler/assets/coarse_fine.js

+7-8
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);
@@ -184,7 +185,7 @@ window.dash_clientside = Object.assign({}, window.dash_clientside, {
184185
if (!currentSelections) {
185186
// if current selections is None
186187
coarse_xy_axiskeys.forEach((xy_pair) => {
187-
console.log("xy pair", xy_pair);
188+
// console.log("xy pair", xy_pair);
188189
const x_axis_key = _.has(layout_axis_anchors, xy_pair.y) ? layout_axis_anchors[xy_pair.y] : "xaxis";
189190
const y_axis_key = _.has(layout_axis_anchors, xy_pair.x) ? layout_axis_anchors[xy_pair.x] : "yaxis";
190191
// console.log('xaxis key', x_axis_key, main_graphDiv.layout[x_axis_key]);
@@ -220,11 +221,9 @@ window.dash_clientside = Object.assign({}, window.dash_clientside, {
220221
) {
221222
performed_update = true;
222223
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
224+
// NOTE: for some reason, showspikes info is only available for the xaxis & yaxis keys
225+
_.has(mainRelayout, "xaxis.showspikes") &&
226+
_.has(mainRelayout, "yaxis.showspikes")
228227
) {
229228
// reset axis -> we use the coarse graphDiv layout
230229
x_range = coarse_graphDiv.layout[x_axis_key].range;

0 commit comments

Comments
 (0)