I've been playing with the visualization API aka dynamic charts and I've found that the example at http://code.google.com/apis/visualization/documentation/gallery/annotatedtimeline.html does not really work on localhost. That is, Error calling method on NPObject
is thrown when a event is clicked (points A
and B
in the example aforementioned). I suppose that is a security issue on the server end (Google's flash base).
There's no API key, authentication or anything similar required - as far as I know. What am I missing?
Thanks
Update: The very same example on jsFiddle: http://jsfiddle.net/gT5GB/ Localhost seems not to be the issue, it's the non-google domain 开发者_如何学编程I guess.
Since that jsFiddle code is hosted on a domain, the note at the very bottom of the documentation should not apply:
Because of Flash security settings, this (and all Flash-based visualizations) might not work correctly when accessed from a file location in the browser (e.g., file:///c:/webhost/myhost/myviz.html) rather than from a web server URL (e.g., http://www.myhost.com/myviz.html).
I had the same issue today and have solved it. I was not using localhost anywhere, I was hosted on a proper domain, and I too was receiving the NPObject error when clicking on the legends. I was also just using the example directly from http://code.google.com/apis/chart/interactive/docs/gallery/annotatedtimeline.html
The cause was that Google's example uses https://www.google.com/jsapi (note the HTTPS), whereas my site was over plain HTTP. I'm not that familiar with Flash, but I suspect it has similar rules for secure/non-secure as it does for crossdomain requests.
Changing Google's example to use http://www.google.com/jsapi solved the pr
Yes, this is a limitation related to security in Flash. It's covered here: Flash - HTTP requests won't work on localhost
So your best bet is to host this somewhere (it can be a server in the same machine).
精彩评论