-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[change] Graph mode respects showLabelsAtZoomLevel setting #148 #187
base: master
Are you sure you want to change the base?
Conversation
src/js/netjsongraph.render.js
Outdated
self.echarts.on("graphRoam", (e) => { | ||
if ( | ||
self.echarts.getOption().series[0].zoom >= | ||
self.config.showLabelsAtZoomLevel | ||
) { | ||
self.echarts.setOption({ | ||
series: [ | ||
{ | ||
label: { | ||
show: true, | ||
}, | ||
}, | ||
], | ||
}); | ||
} | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After making these changes, the graph gets reset when the user zooms to a level more than 7
. The following video is of Multiple links render
example.
network-topology-2023-04-12_21.26.36.mp4
I see that similar implementation has been done for leaflet, but it does not experience this issue
netjsongraph.js/src/js/netjsongraph.render.js
Lines 437 to 459 in 4e9c72b
self.leaflet.on("zoomend", () => { | |
if (self.leaflet.getZoom() >= self.config.showLabelsAtZoomLevel) { | |
self.echarts.setOption({ | |
series: [ | |
{ | |
label: { | |
show: true, | |
}, | |
}, | |
], | |
}); | |
} else { | |
self.echarts.setOption({ | |
series: [ | |
{ | |
label: { | |
show: false, | |
}, | |
}, | |
], | |
}); | |
} | |
}); |
@totallynotvaishnav did you experience any similar issue while implementing showLabelsAtZoomLevel
setting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I haven't experienced this issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I edited an example from the Echart's documetation to test if there's a bug in Echarts itself. I created this codepen. The graph in the codepen does not shrink after reaching the zoom level like in the video in my previous comment. I suspect that the problem is here in netjsongraph.js.
network-topology-2023-04-13_19.21.25.mp4
e55223b
to
b06f460
Compare
Update: I was able to fix the issue described in my last comment. But now, we have another issue: echarts-animation-2023-04-27_13.21.28.mp4The graph animates-in when using setOption method. I have asked about this on StackOverflow. |
Closes #148