diff --git a/jqBarGraph.js b/jqBarGraph.js index b07ef7f..9b0b938 100755 --- a/jqBarGraph.js +++ b/jqBarGraph.js @@ -114,7 +114,7 @@ max = max(data); colPosition = 0; // for printing colors on simple bar graph - for(var val in data){ + $.each(data, function(val, valData){ valueData = data[val][0]; if (valueData instanceof Array) @@ -180,13 +180,13 @@ sv = arr.prefix+valueData[i]+arr.postfix; fs = 12; // font-size is 0 if showValues = false } - o = "
"+sv+"
"; + o = "
"+sv+"
"; $('#graphFieldBar'+unique).prepend(o); } } if(arr.type=='multi') - $('.subBars'+el.id).css({ 'width': wid, 'position': 'absolute', 'bottom': 0 }); + $('.subBars'+el.id).css({ 'position': 'absolute', 'bottom': 0 }); //position of bars if(arr.position == 'bottom') $('.graphField'+el.id).css('bottom',0); @@ -203,12 +203,12 @@ $('#graphFieldBar'+unique).css({'height': fieldHeight}); } - } + }); //creating legend array from legends param - for(var l in arr.legends){ + $.each(arr.legends, function(l, lData){ leg.push([ arr.colors[l], arr.legends[l], el.id, l ]); - } + }); createLegend(leg); // create legend from array @@ -285,4 +285,4 @@ return 0; } -})(jQuery); \ No newline at end of file +})(jQuery);