View Full Version : Graphic unable to render unless i have document.write in body.. argh!

04-22-2009, 02:57 PM
Apologies for my first post, I'm having a hard time rendering the graphic from the sparkline plugin unless I have document.write('') in the body. Whenever I pull that out, the little chart rendered from the plugin no longer works and its baffling to me.

How can I get the graphic to render without having that superfluous document.write in there?

Feel free to critic this code, I'm sure there are a handful of errors.

<script type="text/javascript" src="http://omnipotent.net/jquery.sparkline/jquery-1.2.6.js"></script>
<script type="text/javascript" src="http://omnipotent.net/jquery.sparkline/1.4.1/jquery.sparkline.js"></script>

<script type="text/javascript">
var string = new Array();

function displayResults(query) {
var script = document.createElement('script');
script.setAttribute('src', 'http://spreadsheets.google.com/feeds/cells'
+ '/' + 'pxh9i2raqICC7emBKMcrnUA'
+ '/' + 'od6' + '/public/values' +
script.setAttribute('id', 'jsonScript');
script.setAttribute('type', 'text/javascript');

function cellEntries(json) {
for (var i=0; i < json.feed.entry.length; i++) {
string[i] = json.feed.entry[i].content.$t;}

$(function() {
$('.inlinesparkline2').sparkline(string, {type: 'tristate'});

<script type="text/javascript">
<script type="text/javascript">
<span class="inlinesparkline2">Loading..</span>


04-22-2009, 07:17 PM
mods, can you move to main forum?

Even though my code contains JSON parts, my question does not specifically relate to that.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum