I’m trying to use the interactive charts in my web-solution.
I’ve got a version working (with thanks to Marc Boegem), but that chart does not quite meet our requirements.
So i’ve contacted a google chart expert to give me a working html file that has the chart as I want it in my solution.
In the sample solution the button ‘old’ shows the working chart, the button ‘new’ is the new chart that I want to use.
I hope there is someone that can transform this to a working sample, or at least point me in the correct direction.
This is the new html code that I want to include:
<html>
<head>
<script type='text/javascript' src='https://www.google.com/jsapi'></script>
<script type='text/javascript'>
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Name');
data.addColumn('number', 'Value');
data.addColumn({type: 'string', role: 'annotation'});
data.addColumn({type: 'string', role: 'style'});
data.addRows([
['D', 400, 'a%', 'color: #A81B36'],
['Q', 300, 'b%', 'color: #FD9827'],
['P', 400, 'c%', 'color: #0F7F11']
]);
// use a DataView to null out the values in the value and annotation columns to start,
// so the chart will animate properly when we redraw it
var view = new google.visualization.DataView(data);
view.setColumns([0, {
type: 'number',
calc: function () {return 0;}
}, {
type: 'string',
role: 'annotation',
calc: function () {return '';}
}, 3]);
var chart = new google.visualization.ColumnChart(document.getElementById('chart'));
var option = {
title: 'Here is Title',
height: 400,
width: 600,
animation: {
duration: 1000,
easing: 'out'
},
tooltip: {
isHtml: true
},
legend: 'none',
hAxis: {
title: 'Cups'
},
vAxis: {
title: 'Year',
minValue: 0,
maxValue: 500
}
};
var runOnce = google.visualization.events.addListener(chart, 'ready', function () {
google.visualization.events.removeListener(runOnce);
chart.draw(data, option);
});
chart.draw(view, option);
}
google.load('visualization', '1', {packages:['corechart'], callback: drawChart});
</script>
</head>
<body>
<div id='chart'></div>
</body>
</html>
GoogleChart.servoy (5.69 KB)