diff --git a/examples/timeline/groups/visibleGroups.html b/examples/timeline/groups/visibleGroups.html
new file mode 100644
index 00000000..5025a23b
--- /dev/null
+++ b/examples/timeline/groups/visibleGroups.html
@@ -0,0 +1,113 @@
+
+
+
+ Timeline | A lot of grouped data
+
+
+
+
+
+
+
+
+
+
+ Timeline visible Groups
+
+
+
+
visible groups:
+
+ (Scroll with the mouse and see the items being focus automatically on the timeline)
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/lib/timeline/Core.js b/lib/timeline/Core.js
index 376eacb7..d3652641 100644
--- a/lib/timeline/Core.js
+++ b/lib/timeline/Core.js
@@ -664,6 +664,14 @@ Core.prototype.getVisibleItems = function() {
return this.itemSet && this.itemSet.getVisibleItems() || [];
};
+/**
+ * Get the id's of the currently visible groups.
+ * @returns {Array} The ids of the visible groups
+ */
+Core.prototype.getVisibleGroups = function() {
+ return this.itemSet && this.itemSet.getVisibleGroups() || [];
+};
+
/**
* Set Core window such that it fits all items
* @param {Object} [options] Available options:
diff --git a/lib/timeline/component/ItemSet.js b/lib/timeline/component/ItemSet.js
index ca3d4005..00586826 100644
--- a/lib/timeline/component/ItemSet.js
+++ b/lib/timeline/component/ItemSet.js
@@ -612,6 +612,25 @@ ItemSet.prototype.getVisibleItems = function() {
return ids;
};
+/**
+ * Get the id's of the currently visible groups.
+ * @returns {Array} The ids of the visible groups
+ */
+ItemSet.prototype.getVisibleGroups = function() {
+ var ids = [];
+
+ for (var groupId in this.groups) {
+ if (this.groups.hasOwnProperty(groupId)) {
+ var group = this.groups[groupId];
+ if (group.isVisible) {
+ ids.push(groupId)
+ }
+ }
+ }
+
+ return ids;
+};
+
/**
* Deselect a selected item
* @param {string | number} id