Infinity value in LineChart

161 views
Skip to first unread message

Bassa Safa

unread,
Jun 2, 2012, 11:44:03 AM6/2/12
to Google Visualization API
Hi all,

I'm trying to initialize a LineChart with JSON-data. However one of
the data-cell has an abnormal high value... its 1.7976931348623157
E308. This browser is unable to process and format the data and after
a while firefox ask me if I would like to stop the script. Now to my
questions. Does LineChart have a maximum number for a number column?
Or is it the javascript language that sets up the limitations? How
could I denote that the maximum number should be used? Is there a way
to denote that the infinite number should be used?


my code:

var formatterPercent = new google.visualization.NumberFormat({pattern:
'##.##%'});
var formatterDate = new google.visualization.DateFormat({pattern:
'yyyy-MM-dd'});

var grundJsonData2 = <h:outputText value="#{historiskanalys.json}"
escape="false"/>;
var data2 = new google.visualization.DataTable(grundJsonData2);
formatterDate.format(data2, 0);
formatterPercent.format(data2, 1);
formatterPercent.format(data2, 2);
var chartLineChart2 = new google.visualization.ChartWrapper({
'chartType': 'LineChart',
'containerId': 'chart_div3',
'options': {
title: 'Company Performance previous year',
vAxis: {format: '##.##%', maxValue: 1, minValue: -1},
legend: {position: 'bottom'},
pointSize: 1
}
});
chartLineChart2.setDataTable(data2);
chartLineChart2.draw();

Thank you for your time.
best regards
bassa

Jinji

unread,
Jun 3, 2012, 11:20:46 AM6/3/12
to google-visua...@googlegroups.com
I don't have anything special to suggest, just that you should avoid such high numbers, that cause the Javascript engine to choke.

bassa

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To post to this group, send email to google-visua...@googlegroups.com.
To unsubscribe from this group, send email to google-visualizati...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.


Bassa Safa

unread,
Jun 4, 2012, 9:51:45 AM6/4/12
to Google Visualization API
Hi Jinji,

and thank you for your reply. Do you suggest any particular maximum
value to avoid?

best regards
bassa

asgallant

unread,
Jun 4, 2012, 10:47:17 AM6/4/12
to google-visua...@googlegroups.com
1.7976931348623157E308 is the largest representable floating point number in javascript.  Assuming (and this could be a whopper of an assumption) that the charts render faster when dealing with Integers rather than floats, the largest value for "fast" rendering would be 2147483647.  That is entirely speculative on my part.  I have no special knowledge or experience to back up the claim.
> > google-visualization-api@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-visualization-api+unsub...@googlegroups.com.

Bassa Safa

unread,
Jun 4, 2012, 10:53:26 AM6/4/12
to Google Visualization API
Hmm thanx, with my super-math skills (also known as a casio
calculator) =) I realize that 2147483647 = 2^32/2 -1. Seems
reasonable. Thanx for reply. Will truncate values bigger than this in
the future =)

best regards
bassa
> > > > google-visua...@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > > google-visualizati...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages