almende / chap-links-library

a web based visualization library for displaying graphs, networks, and timelines
http://almende.github.com/chap-links-library
Apache License 2.0
599 stars 167 forks source link

Tineline: Groups Collapse When Scrolling to No Data #325

Closed MattyBearBytes closed 9 years ago

MattyBearBytes commented 9 years ago

Replicate with the following examples. Scroll to the right. The more you zoom in the less distance you need to travel away from the activities to get it to collapse in on itself.

http://almende.github.io/chap-links-library/js/timeline/examples/example13_grouping.html http://almende.github.io/chap-links-library/js/timeline/examples/example15_mobile.html

Didn't seem to be an issue in 2.4 but now an issue once updated to 2.9.

grouping issue

MattyBearBytes commented 9 years ago

Line 1523 - Line 1528 of Timeline.Js has an iteration that sets the itemsHeight of each group to 0. There seems to be a TODO comment in there saying that it should check for a label.

 if (groups) { // TODO: need to check if labels exists?
        // loop through all groups to reset the items height
        groups.forEach(function (group) {
            group.itemsHeight = 0;
        });
    }

In removing that setting to 0, the problem goes away. Not understanding what this does exactly I'm going to submit a pull request that looks for a label before setting it to 0.

Each group in that "groups" variable has a property called "Content" containing the name of the group. If it contains a valid "Content" then I will prevent it from setting to 0.

josdejong commented 9 years ago

Just found another (small) fix for this, initializing the itemsHeight with the height of the label instead of with zero.

MattyBearBytes commented 9 years ago

Thanks @josdejong !
That definitely makes more sense.