I'm having a weird issue occur when using DataView to modify columns. I'm
using Geochart with markers as the display mode. I want each marker to be
the same size and, currently, the color to be blue. The options that I
pass work correctly, except when calling setColumns or hideColumns. The
markers go from being smaller and blue to green and two or three times
bigger (see screenshots).
I'm passing in an id with the data that is used to make the markers a
clickable link. I do not want the id column to be displayed in the
tooltip, which is why I am using the DataView class. In the code below,
I'm using setColumns, but the issue also occurs when calling hideColmns.
<script type="text/javascript">
$(function(){
google.charts.load('current', {
'packages': ['geochart'],
'mapsApiKey': '{!! $apiKey !!}'
});
google.charts.setOnLoadCallback(drawMap);
});
function drawMap(){
var zoneData = {!! json_encode($zoneData) !!};
zoneData.unshift(['Address', 'Name', 'accountID']);
var data = google.visualization.arrayToDataTable(zoneData);
var options = {
displayMode: 'markers',
region: 'US',
legend: 'none',
colorAxis: {colors: ['#4374e0', '#4374e0']},
sizeAxis: {minSize: 5, maxSize: 5}
};
var view = new google.visualization.DataView(data);
view.setColumns([1]);
var chart = new
google.visualization.GeoChart(document.getElementById('accountMap'));
google.visualization.events.addListener(chart, 'select', function(){
var selection = chart.getSelection();
if(selection.length > 0){
var url = '{{route('account.details.route', 'ACCOUNT_ID')}}';
var accountID = data.getValue(selection[0].row, 2);
url = url.replace('ACCOUNT_ID', accountID);
window.open(url, '_blank');
}
});
chart.draw(view, options);
}
</script>
--
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 https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-visualization-api/fb6c777d-60e4-404d-a593-51e0bbe9c41b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.