Okai now I'm able to be back to this code I'll answer, thanks for all your
answers but I think we didn't find the correct mistake.
Look I'll put some of my code in order to be able to resolve it easier:
google.charts.load('current', {'packages': ['corechart']}, {'packages': [
'table','line']});
function Watts() {
var jsonData = $.ajax({
url: "GetWattsData.php",
dataType: "json",
async: false
}).responseText;
var data = new google.visualization.DataTable(jsonData);
var options = {title: 'Average Watts SC1 Datacenter',
width: 500,
height: 400,
vAxis: {
title: 'Power in Watts'
},
hAxis: {
title: 'Day of month'
}
}
var chart = new google.visualization.LineChart(document.
getElementById('chart_div'));
chart.draw(data, options);
}
function Amps() {
var jsonData = $.ajax({
url: "GetAmpsData.php",
dataType: "json",
async: false
}).responseText;
var data = new google.visualization.DataTable(jsonData);
var options = {title: 'Average Ampers SC1 Datacenter',
width: 500,
height: 400,
vAxis: {
title: 'Current in Ampers'
},
hAxis: {
title: 'Day of month'
}
}
var chart = new google.visualization.LineChart(document.
getElementById('Amps'));
chart.draw(data, options);
}
function Temps() {
var jsonData = $.ajax({
url: "GetTempData.php",
dataType: "json",
async: false
}).responseText;
var data = new google.visualization.DataTable(jsonData);
var options = {title: 'Average Temperatures SC1 Datacenter',
width: 500,
height: 400,
vAxis: {
title: 'Temperatures Celsius'
},
hAxis: {
title: 'Day of month'
}
}
var chart = new google.visualization.LineChart(document.
getElementById('Temps'));
chart.draw(data, options);
}
function TableWatts() {
var jsonData = $.ajax({
url: "GetWattsData.php",
dataType: "json",
async: false
}).responseText;
var data = new google.visualization.DataTable(jsonData);
var options = {title: 'Average Watts SC1 Datacenter',
width: 150,
height: 200,
}
var chart = new google.visualization.Table(document.
getElementById('TableWatts'));
chart.draw(data, options);
}
function TableAmps() {
var jsonData = $.ajax({
url: "GetAmpsData.php",
dataType: "json",
async: false
}).responseText;
var data = new google.visualization.DataTable(jsonData);
var options = {title: 'Average Ampers SC1 Datacenter',
width: 150,
height: 200,
}
var chart = new google.visualization.Table(document.
getElementById('TableAmps'));
chart.draw(data, options);
}
function TableTemps() {
var jsonData = $.ajax({
url: "GetTempData.php",
dataType: "json",
async: false
}).responseText;
var data = new google.visualization.DataTable(jsonData);
var options = {title: 'Average Temperatures SC1 Datacenter',
width: 150,
height: 200,
}
var chart = new google.visualization.Table(document.
getElementById('TableTemps'));
chart.draw(data, options);
}
El dimarts, 24 maig de 2016 17:03:47 UTC+2, Javi Vendrell va escriure:
>
> Hi everybody,
>
> I'm trying to display 6 charts, 3 charts should be displayed using line
> charts and 3 otherones using tables. Both groups have the same data.
>
> The point is that I can't charge both libraries at same time.
>
> Table charts uses:
> google.charts.load('current', {'packages': ['table']});
>
>
> Line charts uses:
> google.charts.load('current', {'packages': ['corechart']});
>
>
> The issue comes when I'm trying to get both, seems like once one is
> charged in the page the other one can't be charged. I tried in some methods
> like:
>
> google.charts.load('current', {'packages': ['table']});
>
> google.charts.load('current', {'packages': ['corechart']});
>
> OR
>
> google.charts.load('current', {'packages': ['corechart']}, {'packages': [
> 'table']});
>
>
>
> How that does not look to work I just tryied to use jQuery to display one
> type or other one depending of a selection on a radio button like this:
>
>
> $(document).ready(function () {
> $('#option-2').change(function () {
> if ($(this).is(':checked')) {
> alert("Table");
>
> google.charts.load('current', {'packages': [
> 'table']});
>
>
> google.charts.setOnLoadCallback(TableTemps);
> google.charts.setOnLoadCallback(TableWatts);
> google.charts.setOnLoadCallback(TableAmps);
>
> }
> });
> $('#option-1').change(function () {
> if ($(this).is(':checked')) {
> alert("line");
>
> google.charts.load('current', {'packages': [
> 'corechart']}, {'packages': ['table']});
>
>
> google.charts.setOnLoadCallback(Temps);
> google.charts.setOnLoadCallback(Watts);
> google.charts.setOnLoadCallback(Amps);
>
> }
> });
> });
>
> But as I said, once one of the libraries is charged the other one can't be
> charged so neither used.
>
> Does anyone know how could I display both types of charts at the same time
> or at least use the second solution I did to just select a kind of chart?
>
> Appreciate your help.
>
> Javier Vendrell
>
--
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/f6baf9cc-3ce9-411d-bf88-9ee570ef1f80%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.