almende / vis

⚠️ This project is not maintained anymore! Please go to https://github.com/visjs
7.85k stars 1.48k forks source link

Cannot hide edge label #3700

Open fatore opened 6 years ago

fatore commented 6 years ago

I have a feature in my network to allow the user to display/hide the edges labels.

This piece of code used to work in previous VisJs versions:

// this.edges is a VisJs Dataset

this.edges.update({
  id: edge.id,
  label: '',
});

However, now (in 4.21.0) empty strings, null or undefined don't trigger a proper update in the graph anymore. Probably there is some falsy property check in the update method. So now I have to resort to something like:

this.edges.update({
  id: edge.id,
  label: ' ',
});

Besides not very elegant, this approach doesn't work well because the space string creates a gap in the edge.

dheerajbapat commented 6 years ago

Looks like its working for me in 4.21.0. Can you create a fiddle or plunker?

fatore commented 6 years ago

I'll try to replicate it in a Plunker, it's a bit tricky because the network is integrated with some AngularJS components. I directly assumed it was something wrong with VisJS because it works when providing a valid string, but I'll double check if it's not something with my Angular code instead.

fatore commented 6 years ago

@dheerajbapat Here's the promised fiddle:

https://jsfiddle.net/fatore/1z4qu07e/12/

cdbierl commented 6 years ago

Also a problem for me in 4.21.0. I reverted back to 4.20.1 and issue goes away.