Here is the script code from the source view. I removed a lot of the
geoData.addRow, I didn't think it was needed. There were several hundred of
them. They should be fine, because the table is showing up fine.
Thanks for looking.
<script type="text/javascript">
google.load('visualization', '1.0', {packages: ['controls','map']});
</script>
<script type="text/javascript">
google.setOnLoadCallback(drawVisualization);
function drawVisualization(){
var geoData = new
google.visualization.DataTable();geoData.addColumn('number',
'Lat');geoData.addColumn('number', 'Lon');geoData.addColumn('string',
'Value');geoData.addColumn('number', 'Name');geoData.addColumn('string',
'Date');geoData.addColumn('number',
'Event');geoData.addRow([-12.367581927507025,22.837432880325437,'100032 -
Crisis - Cross-Sectional',100032,'2010-06-08',1978]);
//window.alert(geoData.toSource());
var eventPicker = new google.visualization.ControlWrapper({
'controlType': 'CategoryFilter',
'containerId': 'control1',
'options': {
'filterColumnLabel': 'Event',
'ui': {
'labelStacking': 'vertical',
'allowTyping': false,
'allowMultiple': true
}
}
});
var valuePicker = new google.visualization.ControlWrapper({
'controlType': 'CategoryFilter',
'containerId': 'control3',
'options': {
'filterColumnLabel': 'Value',
'ui': {
'labelStacking': 'vertical',
'allowTyping': false,
'allowMultiple': true
}
}
});
var namePicker = new google.visualization.ControlWrapper({
'controlType': 'CategoryFilter',
'containerId': 'control2',
'options': {
'filterColumnLabel': 'Name',
'ui': {
'labelStacking': 'vertical',
'allowTyping': false,
'allowMultiple': true
}
}
});
var table = new google.visualization.ChartWrapper({
'chartType': 'Table',
'containerId': 'table_div',
'options': {
'alternatingRowStyle': true,
'allowHtml': true,
'page': 'enable',
'pageSize': 15
}
});
var map = new google.visualization.ChartWrapper({
'chartType': 'Map',
'containerId': 'map_div',
'options': {
'mapType': 'normal',
'showTip': true,
'useMapTypeControl': true,
'enableScrollWheel': true
},
'view': {'columns': [ 0, 1, 2 ]}
});
var dashboard = new
google.visualization.Dashboard(document.getElementById('dash_div'));
dashboard.bind(valuePicker, map);
//dashboard.bind(eventPicker, map);
dashboard.bind(namePicker, table);
dashboard.bind(eventPicker, table);
google.visualization.events.addListener(table, 'select',
function() {
map.setSelection(table.getSelection());
});
google.visualization.events.addListener(map, 'select',
function() {
table.setSelection(map.getSelection());
});
dashboard.draw(geoData);
}
</script>
On Friday, March 22, 2013 10:18:29 AM UTC-4, Mike Sherman wrote:
>
>
> <https://lh6.googleusercontent.com/-d1H3MkG3qv4/UUxn2kxTR3I/AAAAAAAABEU/lYPz0hJxLHg/s1600/Capture2.JPG>
> I am trying to show both a map with coordinates and a table of data for a
> specific page and I am trying to add dropdowns to filter both the map and
> the table.
> I was able to draw the map and table with no problems, but then I tried to
> use a dashboard for the first time. The table come up just fine, but the
> map will not show anymore. I set the view options to what I believe are the
> proper settings.
> Here is my code:
> <script type="text/javascript">
> google.load('visualization', '1.0', {packages: ['controls']});
>
> </script>
> <script type="text/javascript">
>
> google.setOnLoadCallback(drawVisualization);
> function drawVisualization(){
>
> <?php
> //echo "var geoData = google.visualization.arrayToDataTable([['Lat',
> 'Lon', 'Value', 'Name','Date','Event'],";
> echo "var geoData = new google.visualization.DataTable();";
> echo"geoData.addColumn('number', 'Lat');";
> echo"geoData.addColumn('number', 'Lon');";
> echo"geoData.addColumn('string', 'Value');";
> echo"geoData.addColumn('number', 'Name');";
> echo"geoData.addColumn('string', 'Date');";
> echo"geoData.addColumn('number', 'Event');";
> for($f = 0; $f < $count; $f++)
> {
> $var0 = mysql_result($result2,$f,'xcoor');
> $var1 = mysql_result($result2,$f,'ycoor');
> $var2 = mysql_result($result2,$f,'hh_number');
> $var3 = mysql_result($result2,$f,'icemr_site');
> $var4 = mysql_result($result2,$f,'hh_type');
> $var5 = mysql_result($result2,$f,'hh_number');
> $var6 = mysql_result($result2,$f,'today');
> $var7 = mysql_result($result2,$f,'event_id');
> switch ($var3) {
> case '1':
> $var3 = "Choma";
> break;
> case '2':
> $var3 = "Nchelenge";
> break;
> case '3':
> $var3 = "Mutasa";
> break;
> default:
> $var3 = "unknown";
> }
> switch ($var4) {
> case '1':
> $var4 = "Cross-Sectional";
> break;
> case '2':
> $var4 = "Longitudinal";
> break;
> default:
> $var3 = "unknown";
> }
> echo"geoData.addRow([".$var0.",".$var1.",'".$var2." -
> ".$var3." - ".$var4."',".$var5.",'".$var6."',".$var7."]);";
> }
> //echo"]);";?>
>
>
> var eventPicker = new google.visualization.ControlWrapper({
> 'controlType': 'CategoryFilter',
> 'containerId': 'control1',
> 'options': {
> 'filterColumnLabel': 'Event',
> 'ui': {
> 'labelStacking': 'vertical',
> 'allowTyping': false,
> 'allowMultiple': false
> }
> }
> });
>
> var namePicker = new google.visualization.ControlWrapper({
> 'controlType': 'CategoryFilter',
> 'containerId': 'control2',
> 'options': {
> 'filterColumnLabel': 'Name',
> 'ui': {
> 'labelStacking': 'vertical',
> 'allowTyping': false,
> 'allowMultiple': false
> }
> }
> });
>
> var table = new google.visualization.ChartWrapper({
> 'chartType': 'Table',
> 'containerId': 'table_div',
> 'options': {
> 'alternatingRowStyle': true,
> 'allowHtml': true,
> 'page': 'enable',
> 'pageSize': 15
> }
> });
>
>
> var map = new google.visualization.ChartWrapper({
> 'chartType': 'Map',
> 'containerId': 'map_div',
> 'options': {
> 'mapType': 'normal',
> 'showTip': true,
> 'useMapTypeControl': true,
> 'enableScrollWheel': true
>
> },
> 'view': {'columns': [ 0, 1, 2 ]}
> });
>
> var dashboard = new
> google.visualization.Dashboard(document.getElementById('dash_div'));
>
> dashboard.bind(namePicker, map);
> dashboard.bind(eventPicker, map);
> dashboard.bind(namePicker, table);
> dashboard.bind(eventPicker, table);
>
> dashboard.draw(geoData);
> }
>
> </script>
>
> <?php
> echo"</head>";
> echo"<div id=\"dash_div\" style=\"width:100%; height: 100%;\">";
> echo"<table>";
> echo"<tr><td><div id=\"control1\"></div><div
> id=\"control2\"></div></td></tr>";
> echo"<tr><td><div id=\"map_div\" style=\"width:50%; height:
> 50%;\"></div></td></tr>";
> echo"<tr><td ><div id=\"table_div\"></div></td></tr>";
> echo"</table>";
> echo"</div>";
> echo"</html>";
> ?>
>
> Thanks for any help, just not too sure what is wrong.
>
>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at
http://groups.google.com/group/google-visualization-api?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.