Color is determined by value, so it is possible to give your regions specific colors (setting colorAxis.values and colorAxis.colors options to arrays that map values to colors 1-to-1, and then setting the data point values to the values in the colorAxis.values array). This changes the value displayed in the tooltip, unless you override it by setting the formatted value of the data point to whatever you actually want displayed. I can make an example of this if you need one.
To the best of my knowledge, newlines are still not supported in GeoCharts. The chart team recently rolled out HTML tooltips in some of the core charts, and I believe that they are planning on bringing these to GeoCharts, though I cannot say when that will be. On Sunday, December 9, 2012 8:32:53 PM UTC-5, Parasound wrote: > > Just two more small questions, > > 1.is there a way to change the color of the displayed regions, (the ones > defined by provinces) ? > > 2.Is the problem of new line in tooltip text fixed? > > > Thanks again > > On Monday, December 10, 2012 12:03:03 AM UTC+2, Parasound wrote: >> >> Hi there, >> >> my code follows and I am trying to display a geochart with >> ISO-3166-2<http://en.wikipedia.org/wiki/ISO_3166-2> codes >> of Greece eg GR-A, GR-K but what I only see is a world map with no colors >> and nothing else. >> >> Is there a bug, or am I missing something? >> thanks >> >> >> <script type="text/javascript" src="http://www.google.com/jsapi >> "></script> >> <script type="text/javascript"> >> >> google.load("visualization", "1", {packages:["geochart"]}); >> google.setOnLoadCallback(setupData); >> >> var newData = null; >> var viewgeomap = null; >> var map = null; >> >> /////////////////////////////// >> // Function setupData >> // Initializes the query and service to pull the data >> /////////////////////////////// >> function setupData() >> { >> //SPARQL endpoint we will use to query the datasets >> var sparqlproxy = "http://data-gov.tw.rpi.edu/ws/sparqlproxy.php?"; >> //this is where the actual SPARQL query is stored >> var queryloc = "http://files.myopera.com/myfiles/files/mysparql.sparql"; >> //url that will execute the query >> var queryurl = sparqlproxy + "output=gvds&service-uri= >> http://mysparqlendpoint =" + encodeURIComponent(queryloc); >> //construct the query >> var query = new google.visualization.Query(queryurl); >> //send query with callback function >> query.send(handleQueryResponse); >> }; >> >> >> /////////////////////////////// >> // Function handleQueryResponse >> // Checks for query errors, then processes >> /////////////////////////////// >> function handleQueryResponse(response) >> { >> >> // Check for query response errors. >> if (response.isError()) >> { >> alert('Error in query: ' + response.getMessage() + ' ' + >> response.getDetailedMessage()); >> return; >> } >> >> //gets the query result as a DataTable object >> >> >> var predata = response.getDataTable(); >> var vals = new Array(); >> var rownum = predata.getNumberOfRows(); >> // Make sure our data isn't empty. >> if (null==predata) >> return; >> >> //Get all available data coming from Q >> var newdata =new google.visualization.DataTable(); >> newdata.addColumn('string', 'CODE_3166'); >> newdata.addColumn('string', 'example1'); >> newdata.addColumn('number', 'example2'); >> newdata.addColumn('number', 'example3'); >> newdata.addColumn('number', 'example4'); >> newdata.addRows(newdata.getNumberOfRows()); >> >> >> for (var i = 0; i < rownum; i++ ) >> { >> var CODE_3166 = predata.getValue(i,0); >> var example1 =predata.getValue(i,1); >> var example2 =predata.getValue(i,2); >> var example3 =predata.getValue(i,3); >> var example4 =predata.getValue(i,4); >> vals [0] = CODE_3166; >> vals [1] = example1+"<br />example2: "+example2+"<br />example3: >> "+example3; >> vals [2] = example2; >> vals [3] = example3; >> vals [4] = example4; >> newdata.addRow(vals); >> >> viewmap = new google.visualization.DataView( newdata ); >> viewmap.setColumns([0, 1]); >> } >> >> >> var options = {}; >> //Now draw the map using this viewmap as a customized data table: >> >> geomap = new >> google.visualization.GeoChart(document.getElementById('visualization_Map')); >> geomap.draw(viewmap, options); >> }; >> </script> >> </head> >> <body> >> >> <!-- Presentation Content --> >> <table > >> <tr> >> <td style="width: 950px;" > >> <div id= 'visualization_Map'style="height:880px"><p><img src=" >> http://data-gov.tw.rpi.edu/images/ajax-loader.gif" alt="loading >> ..."></p></div> >> </td> >> >> </div> >> </td> >> </tr> >> </table> >> </body> >> </html> >> > -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-visualization-api/-/K7GohgsFvKkJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.
