diff --git a/docs/graph2d/index.html b/docs/graph2d/index.html index 8f07e20a..66a488f0 100644 --- a/docs/graph2d/index.html +++ b/docs/graph2d/index.html @@ -1162,7 +1162,7 @@ function (option, path) {
  • x (Number): relative horizontal position of the click event.
  • y (Number): relative vertical position of the click event.
  • time (Date): Date of the clicked event.
  • -
  • value (Number[]): The data value of the click event. The array contains one value when there is one data axis visible, and two values when there are two visible data axes.
  • +
  • value (Number[]): The data value of the click event. The array contains one value when there is one data axis visible, and two values when there are two visible data axes. It is empty when no data is provided.
  • what (String or null): name of the clicked thing: background, axis, dat-axis, custom-time, or current-time, legend.
  • event (Object): the original click event.
  • diff --git a/lib/timeline/Graph2d.js b/lib/timeline/Graph2d.js index cd350ec3..0e294592 100644 --- a/lib/timeline/Graph2d.js +++ b/lib/timeline/Graph2d.js @@ -299,10 +299,10 @@ Graph2d.prototype.getEventProperties = function (event) { var value = []; var yAxisLeft = this.linegraph.yAxisLeft; var yAxisRight = this.linegraph.yAxisRight; - if (!yAxisLeft.hidden) { + if (!yAxisLeft.hidden && this.itemsData.length > 0) { value.push(yAxisLeft.screenToValue(y)); } - if (!yAxisRight.hidden) { + if (!yAxisRight.hidden && this.itemsData.length > 0) { value.push(yAxisRight.screenToValue(y)); }