hyperlinks within fusion charts (patternformat?)

73 views
Skip to first unread message

ess0

unread,
Aug 27, 2011, 4:50:06 PM8/27/11
to google-visua...@googlegroups.com
Hi, I posted this to the Fusion Tables API group but I'm not sure how cross-posting works (and whether posts there need to be approved before going live). I'm trying to make a directory of websites, querying a fusion table. 


So instead of having the URLs be its own column, I'd like to have the names hyperlinked, so the table would look more like this:
Jane Doe      |    New York, NY
Jim Park       |    Mountain View, CA
Lane Smith   |    Los Angeles, CA

I've so far been unsuccessful in mashing up the PatternFormat example  with my current configuration for calling the fusion table as a data source for my table viz. Does anyone know of any solutions, or is this viz feature not available for fusion tables?

visigoth

unread,
Aug 28, 2011, 9:02:28 AM8/28/11
to google-visua...@googlegroups.com
Hi,

I'll consult with someone on the team who is more familiar with the Table visualization tomorrow.
In the meantime, can you please verify that you specify the allowHtml option as mentioned in comment #3 in the Formatters section of the documentation?

Thanks,
visigoth

asgallant

unread,
Aug 29, 2011, 9:30:34 AM8/29/11
to google-visua...@googlegroups.com
I don't know if this is exactly what you are looking for, but it should work:

google.load('visualization''1'{packages['table']});

function drawVisualization({
    var queryText encodeURIComponent("SELECT col0, col1, col2 FROM 1361649");
    var query new google.visualization.Query('http://www.google.com/fusiontables/gvizdata?tq='queryText);
    query.send(getData);
}

function getData(response{
    var data response.getDataTable();
    data.addColumn('string''foo');
    var formatter new google.visualization.PatternFormat('<a href="{1}">{0}</a>');
    formatter.format(data[01]3);

    new google.visualization.Table(document.getElementById('visualization')).draw(data{
        allowHtmltrue,
        showRowNumberfalse,
        alternatingRowStyletrue
    });
}

google.setOnLoadCallback(drawVisualization);


You can create a view from 'data' excluding the columns you don't need and draw the chart using the view if you don't want to see the extra columns.

ess0

unread,
Aug 29, 2011, 8:59:11 PM8/29/11
to google-visua...@googlegroups.com
Oh, that's a great solution, asgallant. Worked great!

ess0

unread,
Aug 29, 2011, 8:59:39 PM8/29/11
to google-visua...@googlegroups.com
Oh, and thanks! :)

asgallant

unread,
Aug 30, 2011, 10:05:06 AM8/30/11
to google-visua...@googlegroups.com
You're welcome.
Reply all
Reply to author
Forward
0 new messages