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

Add an ability to bind actions for clusters #358

Closed alexschedrov closed 8 years ago

alexschedrov commented 8 years ago

I think it's good feature to be able to bind some actions for clusters, e.g. click.

  1. When you have a lot of items in timeline, there's a use case when clusters never expanded.
  2. When you want to zoom in on cluster click.
$('.timeline-cluster').once().click(function() {
      var cluster = timeline.getCluster($(this).data('cluster-index'));
      // Do whatever you want with cluster and his timeline items.
      // - you can open dialog with list of items inside clusters.
      // - you can zoom in timeline:
      // links.Timeline.preventDefault(event);
      // links.Timeline.stopPropagation(event);
      // timeline.zoom(0.4);
      // timeline.trigger("rangechange");
      // timeline.trigger("rangechanged");
    });
josdejong commented 8 years ago

Thanks for your PR @Sanchiz . Two details:

alexschedrov commented 8 years ago

@josdejong Sounds good! Done

josdejong commented 8 years ago

Thanks. Can you please also fix the first bullet? There is no space before the word events now, so the cluster items would display something like 12events instead of 12 events.

alexschedrov commented 8 years ago

@josdejong oops, fixed. Also I'm going to create another PR and move cluster label into separate configuration.

josdejong commented 8 years ago

awesome, thanks