Hi,
can you please have a look at my Code? I tried to get my points annotated
but it doesn't work. Maybe you can help me.
<script type="text/javascript"
src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var dataTable = new google.visualization.DataTable();
dataTable.addColumn('number', 'PriceRentIndex');
dataTable.addColumn('number', 'PriceIncomeIndex');
dataTable.addColumn({'type': 'string', 'role': 'tooltip', 'p': {'html':
true}});
dataTable.addColumn({type:'string', role:'annotation'});
dataTable.addRows([
[2,4,createCustomHTMLContent('http://upload.wikimedia.org/wikipedia/commons/2/28/Flag_of_the_USA.svg',
4,2),'US'],
[5,9,createCustomHTMLContent('http://upload.wikimedia.org/wikipedia/commons/f/fa/Flag_of_the_People%27s_Republic_of_China.svg',
5,9),'CN'],
[-2,-2,createCustomHTMLContent('http://upload.wikimedia.org/wikipedia/commons/a/ae/Flag_of_the_United_Kingdom.svg',
-2,-2),'UK'],
]);
var options = {
'chartArea': {'width': '90%', 'height': '80%'},
hAxis: {title: 'price rent index',ticks:[-5,0,5,10,15]},
vAxis: {title: 'price income index',ticks:[-10,-5,0,5,10,15]},
legend: 'none',
colors:['#FD5F00'],
crosshair: { trigger: 'focus' },
tooltip: { isHtml: 'true' }
};
var chart = new
google.visualization.ScatterChart(document.getElementById('chart_div'));
chart.draw(dataTable, options);
}
function createCustomHTMLContent(flagURL, PriceIncomeIndex,PriceRentIndex) {
return '<div style="padding:5px 5px 5px 5px;">' +
'<img src="' + flagURL + '" style="width:75px;height:50px"><br/>' +
'<table>' +
'<tr>' +
'<td>Price vs. Rent: <b>' +PriceIncomeIndex + '</b></td>' +
'</tr>' +
'<tr>' +
'<td>Price vs. Income: <b>' + PriceRentIndex + '</b></td>' +
'</tr>' + '</table>' + '</div>';
}
Code hier eingeben...
--
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.
For more options, visit https://groups.google.com/d/optout.