add a working version in the test cases or change js line 313 edit: legend=createLegend(leg); // create legend from array line 352 add: return legend;