Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

pandafy
Copy link
Member

@pandafy pandafy commented Apr 12, 2023

Closes #148

@pandafy pandafy marked this pull request as draft April 12, 2023 15:57
Comment on lines 314 to 329
self.echarts.on("graphRoam", (e) => {
if (
self.echarts.getOption().series[0].zoom >=
self.config.showLabelsAtZoomLevel
) {
self.echarts.setOption({
series: [
{
label: {
show: true,
},
},
],
});
}
});
Copy link
Member Author

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

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?

Copy link
Member

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

Copy link
Member Author

@pandafy pandafy Apr 13, 2023

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

@pandafy pandafy marked this pull request as ready for review April 27, 2023 07:56
@pandafy
Copy link
Member Author

pandafy commented Apr 27, 2023

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.mp4

The graph animates-in when using setOption method. I have asked about this on StackOverflow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[change] Show node labels only after hitting a certain zoom level
2 participants