Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Prevent slider from cutting off series. #390

Open
wants to merge 1 commit into from

1 participant

@arunv

This fixes what I think is a bug:

I have 4 series,

[
[{0, 1}, {1, 1}],
[{1, 1}, {2, 1}],
[{2, 1}, {3, 1}],
[{3, 1}, {4, 1}]
]

I use a slider to select the x-range (2.5, 4)

This means stackedData ends up being

[ [], [], [], [[3,4], [1, 1]] ]

At this point, reading stackedData[0][0] produces undefined, even though
there is data that belongs to the range.

@arunv arunv Prevent slider from cutting of series.
This fixes the following bug:

I have 4 series,

[
  [{0, 1}, {1, 1}],
  [{1, 1}, {2, 1}],
  [{2, 1}, {3, 1}],
  [{3, 1}, {4, 1}]
]

I use a slider to select the x-range (2.5, 4)

This means stackedData ends up being

[ [], [], [], [[3,4], [1, 1]] ]

At this point, reading stackedData[0][0] produces undefined, even though
there is data that belongs to the range.
63436fe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 12, 2014
  1. @arunv

    Prevent slider from cutting of series.

    arunv authored
    This fixes the following bug:
    
    I have 4 series,
    
    [
      [{0, 1}, {1, 1}],
      [{1, 1}, {2, 1}],
      [{2, 1}, {3, 1}],
      [{3, 1}, {4, 1}]
    ]
    
    I use a slider to select the x-range (2.5, 4)
    
    This means stackedData ends up being
    
    [ [], [], [], [[3,4], [1, 1]] ]
    
    At this point, reading stackedData[0][0] produces undefined, even though
    there is data that belongs to the range.
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 2 deletions.
  1. +4 −0 rickshaw.js
  2. +2 −2 rickshaw.min.js
View
4 rickshaw.js
@@ -2938,6 +2938,10 @@ Rickshaw.Graph.Renderer = Rickshaw.Class.create( {
domain: function(data) {
var stackedData = data || this.graph.stackedData || this.graph.stackData();
+
+ // filter out any series that may be empty in the current x-domain
+ stackedData = stackedData.filter(function (a) { return a && a.length != 0; });
+
var firstPoint = stackedData[0][0];
if (firstPoint === undefined) {
View
4 rickshaw.min.js
2 additions, 2 deletions not shown
Something went wrong with that request. Please try again.