almende / vis

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

Bars on graph2d using sideBySide not equal width when missing items #500

Open mdxs opened 9 years ago

mdxs commented 9 years ago

When adding partial data (explained below) to a Graph2D chart with the handleOverlap: 'sideBySide' option, not all bars show equal width. Setting the width option seems to be (as expected, and correctly IMO) ignored by the sideBySide option to ensure that all bars are visible. However, in doing so, the code doesn't determine a new width to apply to all bars. This results in different width bars.

Compare bars on Friday the 13th in http://jsfiddle.net/wijgerden/cttyhfgu/ with the same in http://visjs.org/examples/graph2d/11_barsSideBySideGroups.html where the only difference is that I commented out one item. What you can also see in the fiddle is that the two bars on Fri 13th are not seperated by the space that the missing bar would occupy otherwise.

It probably would be possible for me to provide 0 (zero) values for the missing items in my data, but this would increase the amount of data to be transferred/processed; and it might provide the wrong information (it is not that the value was zero... we simply didn't have the data available).

Is it possible to ensure all bars on a graph2d chart have equal width when using the handleOverlap: 'sideBySide' option? Ideally keeping empty space for missing items in above case.

AlexDM0 commented 9 years ago

Hi,

The width you define is used as a width for a single bar (without overlap). That space is subdivided for overlapping cases.

If you have three datasets you want to compare and there are zero values in them, those are values too and should be shown. That is the idea behind the current implementation.

It is not possible to have blank spaces for missing values. You could fake this by having a group with an invisible style (rgba(0,0,0,0)) where you input your missing values.

Regards,

Alex

mdxs commented 9 years ago

I understand it is the current implementation; so it probably is more of a feature request.

Thanks for the suggestion to use invisible group(s), plural as any of the groups could have missing items... there are some remaining issues; with the icons and the legend, but I can work around that. See http://jsfiddle.net/wijgerden/vq4ezLgn/ (an updated fork of the sample fiddle) where I applied this; note the blank icon outline (but the icons could be hidden of course).

AlexDM0 commented 9 years ago

Hi,

Hmm. I didn't think of that. Maybe it would be useful to have the legend:true/false option for groups as well.

Regards,

Alex

AlexDM0 commented 9 years ago

Hi,

Over the last year a lot of feature requests have been made. We have just introduced our new website which has a list of the requested features. We have placed this request on that list.

The list can be found here: http://visjs.org/featureRequests.html

An explaination of the new system can be found here: http://visjs.org/blog.html#New\ website\ for\ vis.js!

I would like to stress that this does not mean we abandon this request. Discussion here will continue if needed on this feature but we will close it to keep our Github issue page more of a bug-todo list.

Future feature requests will still be made here and then added to the website by us.

Regards,

Alex

mojoaxel commented 8 years ago

Reopening as Feature-Request issue (see #2114). Everybody: Please feel free to implement this!