CartoDB map with charts dashboard

المشرف العام

Administrator
طاقم الإدارة
I'm trying to accomplish a very similar example like this one (map with charts on dashboards)

http://bl.ocks.org/ohasselblad/33e5f5f6c72f2ec45e87

The only thing is that my values are strings and not numbers. For example, I have a table that has three categories (active, out of service, fixed) i would like to draw pie chart of the percentage of those values.

I have an example very close but missing something.

Here is what I got so far

//------------------------------ CHARTS ----------------------------------------

google.load('visualization', '1.0', {'packages':['corechart']});google.load('visualization', '1.0', {'packages':['controls']});

google.setOnLoadCallback(drawChart);

function drawChart() {

var query = new google.visualization.Query('my viz url');

query.setQuery('select count(cartodb_id) where inspected_ contains Wachs');query.send(handleQueryResponse);}

function handleQueryResponse(response) { if (response.isError()) { alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage()); return; }

var data = response.getDataTable();

var chart = new google.visualization.PieChart(document.getElementById('chart_div'));

var options = {'title':'Inspection Progress', 'width':200, 'height':200};

chart.draw(data, options);}



أكثر...
 
أعلى