diff --git a/docs/graph2d/index.html b/docs/graph2d/index.html
index d0edebd1..c1783b51 100644
--- a/docs/graph2d/index.html
+++ b/docs/graph2d/index.html
@@ -782,6 +782,12 @@ onRender: function(item, group, graph2d) {
This defines with which axis, left or right, the graph is coupled. Example 5 shows groups with different Y axis. If no groups are coupled
with an axis, it will not be shown. |
+
+ excludeFromLegend |
+ Boolean |
+ false |
+ Group option only. Excludes the the group from beeing listed in the legend. |
+
Timeline Options
diff --git a/lib/timeline/component/GraphGroup.js b/lib/timeline/component/GraphGroup.js
index 0aac3316..d9d53405 100644
--- a/lib/timeline/component/GraphGroup.js
+++ b/lib/timeline/component/GraphGroup.js
@@ -66,7 +66,7 @@ GraphGroup.prototype.setZeroPosition = function(pos) {
*/
GraphGroup.prototype.setOptions = function(options) {
if (options !== undefined) {
- var fields = ['sampling','style','sort','yAxisOrientation','barChart'];
+ var fields = ['sampling','style','sort','yAxisOrientation','barChart','excludeFromLegend'];
util.selectiveDeepExtend(fields, this.options, options);
// if the group's drawPoints is a function delegate the callback to the onRender property
diff --git a/lib/timeline/component/Legend.js b/lib/timeline/component/Legend.js
index e34e9d95..cedfe9fd 100644
--- a/lib/timeline/component/Legend.js
+++ b/lib/timeline/component/Legend.js
@@ -43,10 +43,13 @@ Legend.prototype.clear = function() {
Legend.prototype.addGroup = function(label, graphOptions) {
- if (!this.groups.hasOwnProperty(label)) {
- this.groups[label] = graphOptions;
+ // Include a group only if the group option 'excludeFromLegend: false' is not set.
+ if (graphOptions.options.excludeFromLegend != true) {
+ if (!this.groups.hasOwnProperty(label)) {
+ this.groups[label] = graphOptions;
+ }
+ this.amountOfGroups += 1;
}
- this.amountOfGroups += 1;
};
Legend.prototype.updateGroup = function(label, graphOptions) {