I currently developing a dashboard for my business where i want to have
several charts.
I'm sure that my code is full of erros so if anyone could please point me
in the right direction would be and amazing help
1st problem - i can only print 1st chart
2nd problem - the data im showing is just a small part of a big set where i
want to group by Year / month to show me the revenue per month
3rd problem - i can't show the second chart on my screen...
This is my charts code:
google.charts.load("current", {packages:["corechart"]});
google.charts.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Categoria', 'Total Mensal'],
<?PHP echo $resumo_data; ?>
]);
var options = {
title: 'Resumo De Receita por Categorias',
pieHole: 0.4,
chartArea: {
width: '90%',
height: '90%',
// leave room for y-axis labels
},
legend: {
position: 'right'
},
colors: ['#e0440e', '#e6693e', '#ec8f6e', '#f3b49f', '#f6c7b6']
};
var chart = new
google.visualization.PieChart(document.getElementById('donutchart'));
chart.draw(data, options);
}
//segundo grafico
function drawChart2() {
var data2 = new google.visualization.DataTable();
data.addColumn('date', 'Time of Day');
data.addColumn('number', 'Rating');
// alimentar dados do segundo grafico
data.addRows([ [new Date(2009, 0, 01), 4550][new Date(2009, 1, 01),
4550][new Date(2009, 2, 01), 4550][new Date(2009, 3, 01), 4550][new
Date(2009, 4, 01), 4550][new Date(2009, 5, 01), 4550][new Date(2009, 6,
01), 4550][new Date(2009, 7, 01), 4550][new Date(2009, 8, 01), 4550][new
Date(2009, 9, 01), 4550][new Date(2009, 10, 01), 4550][new Date(2009, 11,
01), 4550][new Date(2010, 0, 01), 4550][new Date(2010, 1, 01), 4550][new
Date(2010, 2, 01), 4550][new Date(2010, 3, 01), 4550][new Date(2010, 4,
01), 4550][new Date(2010, 5, 01), 4550][new Date(2010, 6, 01), 4550][new
Date(2010, 7, 01), 4550][new Date(2010, 8, 01), 4550][new Date(2010, 9,
01), 4550][new Date(2010, 10, 01), 4550][new Date(2010, 11, 01), 4550][new
Date(2011, 0, 01), 4550][new Date(2011, 1, 01), 4550][new Date(2011, 2,
01), 4550][new Date(2011, 3, 01), 4550][new Date(2011, 4, 01), 4550][new
Date(2011, 5, 01), 4550][new Date(2011, 6, 01), 4550][new Date(2011, 7,
01), 4550][new Date(2011, 8, 01), 4550][new Date(2011, 9, 01), 4550][new
Date(2011, 10, 01), 4550][new Date(2011, 11, 01), 4550][new Date(2012, 0,
01), 4550][new Date(2012, 1, 01), 4550][new Date(2012, 2, 01), 4550][new
Date(2012, 3, 01), 4550][new Date(2012, 4, 01), 4550][new Date(2012, 5,
01), 4550][new Date(2012, 6, 01), 4550][new Date(2012, 7, 01), 4550][new
Date(2012, 8, 01), 4550][new Date(2012, 9, 01), 4550][new Date(2012, 10,
01), 4550][new Date(2012, 11, 01), 4550][new Date(2013, 0, 01), 4550][new
Date(2013, 1, 01), 4550][new Date(2013, 2, 01), 4550][new Date(2013, 3,
01), 4550][new Date(2013, 4, 01), 4550][new Date(2013, 5, 01), 3749.3][new
Date(2013, 6, 01), 3749.3][new Date(2013, 7, 01), 3749.3][new Date(2013, 8,
01), 3749.3][new Date(2013, 9, 01), 3749.3][new Date(2013, 10, 01),
3749.3][new Date(2013, 11, 01), 3749.3][new Date(2014, 0, 01), 3749.3]
]);
var options2 = {
title: 'Rate the Day on a Scale of 1 to 10',
width: 900,
height: 500,
hAxis: {
format: 'Y/m/d',
gridlines: {count: 15}
},
vAxis: {
gridlines: {color: 'none'},
minValue: 0
}
};
var chart2 = new
google.visualization.LineChart(document.getElementById('chart_div'));
chart2.draw(data2, options2);
}
//segundo grafico
function drawChart2() {
var data2 = new google.visualization.DataTable();
data.addColumn('date', 'Time of Day');
data.addColumn('number', 'Rating');
// alimentar dados do segundo grafico
data.addRows([ [new Date(2009, 0, 01), 4550][new Date(2009, 1, 01),
4550][new Date(2009, 2, 01), 4550][new Date(2009, 3, 01), 4550][new
Date(2009, 4, 01), 4550][new Date(2009, 5, 01), 4550][new Date(2009, 6,
01), 4550][new Date(2009, 7, 01), 4550][new Date(2009, 8, 01), 4550][new
Date(2009, 9, 01), 4550][new Date(2009, 10, 01), 4550][new Date(2009, 11,
01), 4550][new Date(2010, 0, 01), 4550][new Date(2010, 1, 01), 4550][new
Date(2010, 2, 01), 4550][new Date(2010, 3, 01), 4550][new Date(2010, 4,
01), 4550][new Date(2010, 5, 01), 4550][new Date(2010, 6, 01), 4550][new
Date(2010, 7, 01), 4550][new Date(2010, 8, 01), 4550][new Date(2010, 9,
01), 4550][new Date(2010, 10, 01), 4550][new Date(2010, 11, 01), 4550][new
Date(2011, 0, 01), 4550][new Date(2011, 1, 01), 4550][new Date(2011, 2,
01), 4550][new Date(2011, 3, 01), 4550][new Date(2011, 4, 01), 4550][new
Date(2011, 5, 01), 4550][new Date(2011, 6, 01), 4550][new Date(2011, 7,
01), 4550][new Date(2011, 8, 01), 4550][new Date(2011, 9, 01), 4550][new
Date(2011, 10, 01), 4550][new Date(2011, 11, 01), 4550][new Date(2012, 0,
01), 4550][new Date(2012, 1, 01), 4550][new Date(2012, 2, 01), 4550][new
Date(2012, 3, 01), 4550][new Date(2012, 4, 01), 4550][new Date(2012, 5,
01), 4550][new Date(2012, 6, 01), 4550][new Date(2012, 7, 01), 4550][new
Date(2012, 8, 01), 4550][new Date(2012, 9, 01), 4550][new Date(2012, 10,
01), 4550][new Date(2012, 11, 01), 4550][new Date(2013, 0, 01), 4550][new
Date(2013, 1, 01), 4550][new Date(2013, 2, 01), 4550][new Date(2013, 3,
01), 4550][new Date(2013, 4, 01), 4550][new Date(2013, 5, 01), 3749.3][new
Date(2013, 6, 01), 3749.3][new Date(2013, 7, 01), 3749.3][new Date(2013, 8,
01), 3749.3][new Date(2013, 9, 01), 3749.3][new Date(2013, 10, 01),
3749.3][new Date(2013, 11, 01), 3749.3][new Date(2014, 0, 01), 3749.3]
]);
var options2 = {
title: 'Rate the Day on a Scale of 1 to 10',
width: 900,
height: 500,
hAxis: {
format: 'Y/m/d',
gridlines: {count: 15}
},
vAxis: {
gridlines: {color: 'none'},
minValue: 0
}
};
var chart2 = new
google.visualization.LineChart(document.getElementById('chart_div'));
chart2.draw(data2, options2);
}
--
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/5dac4752-68c1-46dd-9163-8ee00234732b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.