zhaoweikai / flot

Automatically exported from code.google.com/p/flot
MIT License
0 stars 0 forks source link

Off by one bug with maxIndex/neededColors in fillInSeriesOptions() #753

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Using jquery.flot.js (commit: c202303a29639aeb5ce05fa647ba934268848d5c) from 
master.

When maxIndex == neededColors at line 441, neededColors isn't correctly 
adjusted. An indexing error later occurs at colors[s.color], line 485.

Attached test.html: one series with .color = 0; maxIndex = 0 and neededColors = 
0. neededColors should be adjusted to 1.

Attached test2.html: two series with .color = numeric index and one series with 
.color = null; maxIndex = 1 and neededColors = 1. neededColors should be 
adjusted to 2.

Proposed fix: init maxIndex to -1 (instead of 0) and compare maxIndex >= 
neededColors (instead of >)

Original issue reported on code.google.com by gabriel....@datadeflator.com on 13 Sep 2012 at 11:18

Attachments: