Open GoogleCodeExporter opened 8 years ago
I was trying to request an enhancement but got rejected.
Original comment by graham.wallis@gmail.com
on 31 Mar 2010 at 4:24
Original comment by fg.mag...@gmail.com
on 31 Mar 2010 at 4:37
[deleted comment]
[sorry for the repost. removing wiki syntax because it didn't work...]
Nice idea. This could be a great addition to Visualize.
I'm wondering though if maybe this feature should be implemented via a callback
option. That way it could be more flexible for
applying any type of formatting to the data before visualizing it, since you
might
want to do all sorts of conversions, such as converting
commas to decimals.
Something like...
var x = o.formatData ? parseFloat( o.formatData($(this).text()) ) :
parseFloat($(this).text());
then you could specify your format removal via the option...
myTable.visualize({
formatData: function(text){
return text.replace(/[^\d\.-]/,'');
}
});
Thoughts?
Original comment by scottj...@gmail.com
on 31 Mar 2010 at 5:51
Wow i typed this very fast today. I just reread my reproduction steps, and
apologize
for my typos. It was supposed to say add currency symbol to the TD element.
I like that approach alot. Do we make it more flexible by adding multiple Data
formats? No clue what they could be but still.
function (text,type)
{
if(type==null) {return text.replace(/[^\d\.-]/,'')}; // may not need.
switch(type)
{
case:"Thousand"
some return
case:
default: return text.replace(/[^\d\.-]/,'')};
}
}
Original comment by graham.wallis@gmail.com
on 31 Mar 2010 at 6:04
Well, I was thinking that if it used a callback, the end-developer could
perform any
custom formatting they'd like. That way we wouldn't need to bake-in all sorts
of
possible scenarios that could occur. In my last message, the second code
snippit
would be the end-developer's call to enhance, specifying a custom format
callback to
strip non-number/decimals/negatives. In other words, that function wouldn't be
included in Visualize source code.
As a default, we might consider setting formatData to that callback function,
so it'd
always perform a basic cleanup, and then you could override it with your own
callback
to do other things if you wanted to. Always running that callback would
probably slow
things down a little though, so it may be best to just leave it false or
undefined by
default.
Anyway, if you like this callback idea, it'd be quite simple to implement.
Original comment by scottj...@gmail.com
on 31 Mar 2010 at 6:26
...that should be "the end-developer's call to visualize()", not "enhance".
Sorry, script
confusion. :)
Original comment by scottj...@gmail.com
on 31 Mar 2010 at 6:30
Agreed I have made the change on my end.
Original comment by graham.wallis@gmail.com
on 31 Mar 2010 at 6:34
Original issue reported on code.google.com by
graham.wallis@gmail.com
on 31 Mar 2010 at 4:24Attachments: