Forum:Can't use Google Chart API

Image hotlinking is enabled in Wikia (see my earlier posting on this). One area where this feature would be very useful for many wikis is the Google Chart API. However it does not work - probably because MediaWiki doesn't realize that the URL, which doesn't end in a known image extension such as .jpg, .gif or .png, returns an image.

http://chart.apis.google.com/chart?cht=p3&chd=s:hW&chs=250x100&chl=Hello|World

This line should be replaced by a chart, but it isn't. Does anyone know a way to make it work? Spankart 08:39, 8 December 2007 (UTC)


 * You really think hotlinking is enable ?

http://synaptique.ca/zimages/valid-css2-blue.png

http://synapse032.synaptique.ca/ima/minis/synapse032_image_014_mini.jpg


 * — TulipVorlax 01:35, 9 December 2007 (UTC)
 * P.S: Thoses are on my personnal hosting wich i am paying for. Each image link to the page where they actually are. — TulipVorlax 01:37, 9 December 2007 (UTC)

http://www.furrysoft.de/screenshots/tigger/plugins/SmileyTicker.png


 * Yes. See the smiley for example, or the Google logo on Forum:Image hotlinking. You need to remove the square brackets to make an image hotlink instead of a normal external link. Now back to my original question: Does anyone know a way to make using the Google Chart API work in Wikia? For example, can I do it with some JavaScript, e.g. via an HTML tag? Example (which doesn't work because you can't use the tag directly in wiki source:




 * Spankart 01:26, 10 December 2007 (UTC)
 * Hey, the part « you need to »... is, well you think i dont know how to use wiki code ? Sorry but i think i know better than you. External images can be hotlinked like you're saying should also be able to be put in a link like this :

http://www.furrysoft.de/screenshots/tigger/plugins/SmileyTicker.png


 * You can do JS on a wikia where you have admin right. You simply go to Mediawiki:Common.js. — TulipVorlax 08:28, 10 December 2007 (UTC)

By the way, i really dont know why some images are blocked while some others aren't. But i know one thing; Wikia is working on a way to let local communities decide wich domain name to permit and wich to blocked. Or at least i think they are... I dont remember where i've read this... — TulipVorlax 08:33, 10 December 2007 (UTC)


 * I'm sure you know wiki syntax better than me, TulipVorlax. I didn't know I could put a hotlinked image into a link. I do have admin rights in my wiki, but I don't know much about JS or CSS and so, unfortunately, I can't figure out how to solve the problem myself. I hope some wiki guru may be able to help. Spankart 09:48, 10 December 2007 (UTC)

Is nobody here who can help or give an advice? Spankart 12:57, 1 January 2008 (UTC)

Why not save the chart and upload it as an image? -- LordTBT Talk! 00:57, 5 January 2008 (UTC)


 * Because the great thing about this API is that the chart is created dynamically at runtime. This is particularly useful for charts that are updated regularly, but is also very helpful in all other cases (e.g. to customize and reformat the chart). Spankart 16:48, 5 January 2008 (UTC)

JavaScript solution
The code: User:Ciencia Al Poder/Render Google Charts.js. Copy, paste into your Special:Mypage/monobook.js, (or quartz.js, depending on the current skin) save and reload to see here the result.


 * |World This text is shown when hovering the mouse


 * |World Also this


 * |World This chart is not rendered

The chart images cannot be a link. --Ciencia Al Poder (talk) -WikiDex 12:48, 5 January 2008 (UTC)


 * You're a genius, Ciencia Al Poder! Thank you so much. I copied this into my wiki's MediaWiki:Common.js and it works perfectly. We should make this better known, I'm sure other wikis will find dynamic charts a great add-in too. Spankart 16:48, 5 January 2008 (UTC)


 * I'd make the script before, but I hadn't read the post, Have in mind that this only work with JavaScript enabled, so specify always a text to the link with a short description. Enjoy! --Ciencia Al Poder (talk) -WikiDex 17:00, 5 January 2008 (UTC)

Could you pls. assess pro/cons of the javascript solution? Is it good enough or MW ext. should be written for this? -- Nef (talk) 12:12, 14 January 2008 (UTC)


 * The JavaScript solution is safe: only renders links which url starts with "http://chart.apis.google.com/chart?", so no malicious pages could be rendered, nor "javascript:" uris. It doesn't rely on a server extension, so an update/enable/disable could be done instantaneously without having to wait to wikia techs. You can also specify a link not to be rendered. On the other hand, it's client-side, so it needs JavaScript enabled and adds some load to the browser. A MW extension would be good, but I don't know how many wikis really make use of the google charts. --Ciencia Al Poder (talk) -WikiDex 19:30, 14 January 2008 (UTC)


 * I agree, the JS solution is good enough for our wiki, but a MediaWiki extension might be better still. Two other minor disadvantages of the JS solution: a) when the page loads, it initially displays the URL for about 2-3 seconds, then the URL is replaced by the image, which takes up more space, so the entire page is repainted, see example; b) so far I wasn't able to put a chart side-by-side to text. I tried to put it into a table but it didn't work this way. Spankart 20:24, 14 January 2008 (UTC)


 * Try to insert it into a &lt;div style="float:right"&gt;&lt;/div&gt; --Ciencia Al Poder (talk) -WikiDex 21:03, 14 January 2008 (UTC)