*I wish to create a query to groupby data of a single datatable which a
controller manages two charts based on the date column. I employ Piechart
and Linechart and Dashboards. I want to have a piece of query let Piechart
extracts data; how to create a query from "arrayToDataTable" applying
"groupby" command to filter the content based on date column.*
*
<-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------->
*
*!function($) {*
* google.load('visualization', '1.1', {packages: ['controls']});*
* function drawVisualization() {*
* // Prepare the data*
* var data = google.visualization.arrayToDataTable([*
* ['Name', 'Age', 'date', 'ville'],*
* ['Michael' , 12, 2012, 'A'],*
* ['Elisa', 20, 2013, 'B'],*
* ['Robert', 7, 2014, 'A'],*
* ['John', 54, 2015, 'A'],*
* ['Jessica', 22, 2016, 'E'],*
* ['Aaron', 3, 2017, 'F'],*
* ['Margareth', 42, 2018, 'G'],*
* ['Miranda', 33, 2019, 'H']*
* ]);*
* var control = new google.visualization.ControlWrapper({*
* 'controlType': 'ChartRangeFilter',*
* 'containerId': 'control',*
* 'options': {*
* // Filter by the date axis.*
* 'filterColumnIndex': 2,*
* 'ui': {*
* 'chartType': 'LineChart',*
* 'chartOptions': {*
* 'chartArea': {'width': '90%'},*
* 'hAxis': {'baselineColor': 'none'}*
* },*
* // Display a single series that shows the closing value of
the stock.*
* // Thus, this view has two columns: the date (axis) and the
stock value (line series).*
* 'chartView': {*
* 'columns': [2,1]*
* },*
* *
* }*
* },*
* //Initial range: 2010 to 2021*
* 'state': {'range': {'start': new Date(2012), 'end': new
Date(2019)}}*
* })*
* // Define a bar chart*
* var barChart = new google.visualization.ChartWrapper({*
* 'chartType': 'BarChart',*
* 'containerId': 'chart1',*
* 'options': {*
* 'width': 400,*
* 'height': 300,*
* 'hAxis': {'minValue': 0, 'maxValue': 60},*
* 'chartArea': {top: 0, right: 0, bottom: 0},*
* },*
* 'view': {'columns': [0, 1]}*
* });*
* // Define a pie chart*
* var pieChart = new google.visualization.ChartWrapper({*
* 'chartType': 'PieChart',*
* 'containerId': 'chart2',*
* 'options': {*
* 'width': 600,*
* 'height': 300,*
* //'legend': 'bottom',*
* 'chartArea': {'left': 5, 'top': 5, 'right': 5, 'bottom': 5},*
* 'pieSliceText': 'value'*
* },*
* 'view': {'columns': [3, 1]}*
* });*
* // Create the dashboard.*
* var dashboard = new
google.visualization.Dashboard(document.getElementById('dashboard')).*
* // Configure the slider to affect the bar chart*
* *
* *
* bind(control, barChart).*
* bind(control, pieChart).*
* *
* // Draw the dashboard*
* draw(data);*
* }*
* google.setOnLoadCallback(drawVisualization); *
**
*}(jQuery);*
--
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/groups/opt_out.