Browse Source

Fix error on click for graph2D when no data is provided (#2472)

readme-improvements
Uli Fahrer 8 years ago
committed by yotamberk
parent
commit
9692d0df49
2 changed files with 3 additions and 3 deletions
  1. +1
    -1
      docs/graph2d/index.html
  2. +2
    -2
      lib/timeline/Graph2d.js

+ 1
- 1
docs/graph2d/index.html View File

@ -1162,7 +1162,7 @@ function (option, path) {
<li><code>x</code> (Number): relative horizontal position of the click event.</li> <li><code>x</code> (Number): relative horizontal position of the click event.</li>
<li><code>y</code> (Number): relative vertical position of the click event.</li> <li><code>y</code> (Number): relative vertical position of the click event.</li>
<li><code>time</code> (Date): Date of the clicked event.</li> <li><code>time</code> (Date): Date of the clicked event.</li>
<li><code>value</code> (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.</li>
<li><code>value</code> (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.</li>
<li><code>what</code> (String or null): name of the clicked thing: <code>background</code>, <code>axis</code>, <code>dat-axis</code>, <code>custom-time</code>, or <code>current-time</code>, <code>legend</code>.</li> <li><code>what</code> (String or null): name of the clicked thing: <code>background</code>, <code>axis</code>, <code>dat-axis</code>, <code>custom-time</code>, or <code>current-time</code>, <code>legend</code>.</li>
<li><code>event</code> (Object): the original click event.</li> <li><code>event</code> (Object): the original click event.</li>
</ul> </ul>

+ 2
- 2
lib/timeline/Graph2d.js View File

@ -299,10 +299,10 @@ Graph2d.prototype.getEventProperties = function (event) {
var value = []; var value = [];
var yAxisLeft = this.linegraph.yAxisLeft; var yAxisLeft = this.linegraph.yAxisLeft;
var yAxisRight = this.linegraph.yAxisRight; var yAxisRight = this.linegraph.yAxisRight;
if (!yAxisLeft.hidden) {
if (!yAxisLeft.hidden && this.itemsData.length > 0) {
value.push(yAxisLeft.screenToValue(y)); value.push(yAxisLeft.screenToValue(y));
} }
if (!yAxisRight.hidden) {
if (!yAxisRight.hidden && this.itemsData.length > 0) {
value.push(yAxisRight.screenToValue(y)); value.push(yAxisRight.screenToValue(y));
} }

Loading…
Cancel
Save