I think what you have is almost correct, it just needs a small tweak: in
the loop where you reset the formatted values, try setting them to the
actual value instead of null. Some formatters modify the already-formatted
value rather than the base value. You'd want something like this (in your
pseudocode):
for {
weightsTable.setValue(i,2,weight);
weightsTable.setFormattedValue(i,2,weight);
}
On Thursday, May 10, 2012 5:26:18 PM UTC-4, NA wrote:
>
>
> Is it possible to use a NumberFormatter and BarFormatter at the same time
> on a table whose underlying DataTable will be updated?
>
> I am able to render a Table with both a numberformatter and barformatter
> applied to the same column. That looks fine.
>
> But when I change the values, the last formatter applied is the only one
> that shows the correct values; the previous formatter shows the previous
> values. I've even tried removing all formatters, applying one formatter,
> forcing a redraw, then applying another formatter and again forcing a
> redraw. But the first formatter's values are always unchanged while the
> second formatter has the right values.
>
> This is especially frustrating because in the initial rendering, the
> column is formatted correctly by both formatters.
>
> I feel like I've asked this before or seen a similar thread, but searching
> this group didn't turn anything up.
>
> Any ideas?
>
> Pseudo code looks like:
>
> // weightsTable is a DataTable
> // weightsDisplay is a ChartWrapper
> // numberFormatter and barFormatter are formatters
>
> for {
> weightsTable.setValue(i,2,weight);
> weightsTable.setFormattedValue(i,2,null);
> }
>
> numberFormatter.format(weightsTable,2);
> barFormatter.format(weightsTable,2);
> weightsDisplay.draw();
>
> The first time this code is run, everything looks great. But when the
> code is called again (the table has already been rendered), I get the buggy
> behavior.
>
> I might resort to just deleting the entire table, though that's not a very
> satisfying workaround...
>
> thanks for any ideas,
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-visualization-api/-/tewFEEO73XYJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-visualization-api?hl=en.