Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
--- fgCharting.jQuery.js 2008-03-15 03:00:52.000000000 +0800 +++ fgCharting.jQuery.js.multiple-table 2008-04-16 03:26:10.000000000 +0800 @@ -427,16 +427,16 @@ //graph data from table function - $.fn.getTableData = function(chartDimensions){ + $.fn.getTableData = function(chartDimensions, chartsrc){ var colors = ['#be1e2d','#666699','#92d5ea','#ee8310','#8d10ee','#5a3b16','#26a4ed','#f45a90','#e9e744']; var tableData = { members: function(){ var members = []; - $(this).find('tr:gt(0)').each(function(i){ + $('tr:gt(0)', chartsrc).each(function(i){ members[i] = {}; members[i].points = []; members[i].color = colors[i]; - $(this).find('td').each(function(){ + $('td', this).each(function(){ members[i].points.push($(this).text()*1); }); }); @@ -522,7 +522,7 @@ }, xLabels: function(){ var xLabels = []; - $(this).find('tr:eq(0) th').each(function(){ + $(this).find('tr:eq(0) th', chartsrc).each(function(){ xLabels.push($(this).html()); }); return xLabels; @@ -559,7 +559,7 @@ } } if(!$(this).attr('colored')){ - $(this).find('tr:gt(0) th').each(function(i){ + $(this).find('tr:gt(0) th', chartsrc).each(function(i){ $(this).css({'background-color': colors[i]}); }); $(this).attr('colored', 'true'); @@ -577,6 +577,7 @@ $.fgCharting = function(){ $('[class^=fgCharting_]').each(function(){ + try { //get the class that contains fgCharting settings and set it to chartClass var var thisClass = $(this).attr('class'); var chartClass = ''; @@ -603,7 +604,7 @@ //make sure data source and type is avail if($(chartSrc).size() > 0 && chartType != ''){ //get data from source table - var tableData = $(chartSrc).getTableData(chartDimensions); + var tableData = $(chartSrc).getTableData(chartDimensions, chartSrc); //create chart type specified switch (chartType){ case 'line': $(this).createLineGraph(tableData); @@ -622,6 +623,7 @@ break } } + } catch (e) { $(this).parent().remove(); } }); }
This paste will be private.
From the Design Piracy series on my blog: