Hi,
I have a big data table, from which I want to create multiple data-views
by filtering.
Then, I want to be able to plot these data-views in the same graph. Is it
possible?
I am attaching the code:
<HTML>
<HEAD>
<style>.google-visualization-table-td {text-align: center
!important;}</style>
<script type="text/javascript"
src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('visualization', '1', {packages: ['corechart', 'table',
'gauge', 'controls']});
google.setOnLoadCallback(drawVisualization);
function drawVisualization() {
var data = google.visualization.arrayToDataTable([
['Config','Tech','Target','Area','CLK','Leak'],
['base','28hpc_7t',150,43422,153,0.0750],
['base','28hpc_7t',250,43680,254,0.0765],
['base','28hpc_7t',350,44505,359,0.0790],
['base','28hpc_7t',450,46073,466,0.0830],
['base','28hpc_7t',50,40340,102,0.0613],
['base','28hpc_7t',50,38873,98,0.0547],
['base','28hpc_7t',549,49179,578,0.0920],
['base','28hpc_9t',150,53319,152,0.1010],
['base','28hpc_9t',250,53542,255,0.1025],
['base','28hpc_9t',350,54128,367,0.1040],
['base','28hpc_9t',450,55668,468,0.1090],
['base','28hpc_9t',50,50196,102,0.0793],
['base','28hpc_9t',50,48929,100,0.0757],
['base','28hpc_9t',549,57517,572,0.1140],
['base','40lp',150,107063,154,0.0100],
['base','40lp',250,116927,260,0.0120],
['base','40lp',350,181603,361,0.0200],
['base','40lp',400,214187,366,0.0250],
['base','40lp',50,97320,53,0.0070],
['base','65lp',150,216385,147,0.0100],
['base','65lp',250,241016,252,0.0130],
['base','65lp',350,391627,349,0.0250],
['base','65lp',400,487018,361,0.0345],
['base','65lp',50,193721,48,0.0060],
]);
var area_format = new google.visualization.NumberFormat(
{pattern:'#,###'}
);
area_format.format(data, 4);
var base_65lp = new google.visualization.DataView(data);
base_65lp.setRows(base_65lp.getFilteredRows([{column: 0, value:
'base'}, {column: 1, value: '65lp'}]));
base_65lp.setColumns([3, 4]);
var base_40lp = new google.visualization.DataView(data);
base_40lp.setRows(base_40lp.getFilteredRows([{column: 0, value:
'base'}, {column: 1, value: '40lp'}]));
base_40lp.setColumns([3, 4]);
var line_chart = new
google.visualization.LineChart(document.getElementById('line_chart'));
var chart_options = {
title : 'Area-Speed Curve',
orientation : 'vertical',
explorer : {axis : 'horizontal', actions : ['dragToZoom',
'rightClickToReset']},
legend : {position : 'in'},
pointSize : 10,
sortColumn : 1,
'view' : {'columns' : [3, 4]},
};
line_chart.draw(base_40lp, chart_options);
// in the same line-chart, I want to draw another line using
base_65lp data-view.
// how can I do this?
//line_chart.draw(base_65lp, chart_options);
}
</script>
</HEAD>
<body style="font-family: Arial;border: 0 none;">
<center>
<div id="line_chart"></div>
</center>
</body>
</html>
--
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.