OpenTSDB/opentsdb — pull request #162 by isavin (2013-02-15 12:44:43+00:00)
Title: Don't show the keys for series which don't have datapoints inside the y/y2 ranges

When using yrange/y2range the graph shows only the series with data points within the specified ranges but the legend shows in addition to these the keys for the series outside the yrange/y2range as well.

This feature restricts the keys shown in the legend to the keys of the series visible on the graph.

Sample use case:
* you have tcollector running on 100 machines and you are looking at the proc.loadavg.15min split by host (host=*)
* you will have 100 series on the graph and 100 keys in the legend; color/shape key combinations will likely be similar for some series
* out of the 100 series a few have high load values and you want to identify the host but it's difficult to discern the colors/shapes and you need to verify the guess by changing host=* to host= and checking if the values match for each
* alternatively you could restrict the yrange/y2range to an interval which would contain just points from the series you are interested in
* the graph will contain only those series and the legend will contain only the keys for those series (before this change the legend would contain all the keys)

Implementation:
* parse the values for yrange and y2range and determine the min/max values
* when dumping the series in the file determine if at least one point is within the min/max range
* when plotting the graph set "notitle" for the series without points inside the range

Please let me know if an option to toggle this behavior is required and I'll add one.