playing with gauges
This commit is contained in:
@@ -1,12 +1,23 @@
|
||||
google.charts.load('current', {'packages':['gauge']});
|
||||
google.charts.setOnLoadCallback(drawSPMChart);
|
||||
google.charts.setOnLoadCallback(drawSpeedChart);
|
||||
google.charts.setOnLoadCallback(drawPowerChart);
|
||||
|
||||
var spmdata = [
|
||||
['Label', 'Value'],
|
||||
['SPM', 21.0],
|
||||
|
||||
];
|
||||
|
||||
var speeddata = [
|
||||
['Label', 'Value'],
|
||||
['V m/s', 0.0],
|
||||
];
|
||||
|
||||
var powerdata = [
|
||||
['Label','Value'],
|
||||
['PWR',150],
|
||||
]
|
||||
|
||||
var spmoptions = {
|
||||
min:0, max: 50,
|
||||
width: 400, height: 120,
|
||||
@@ -17,17 +28,42 @@ var spmoptions = {
|
||||
minorTicks: 10
|
||||
};
|
||||
|
||||
var data = null;
|
||||
var speedoptions = {
|
||||
min:0, max: 6,
|
||||
width: 400, height: 120,
|
||||
greenFrom: 2, greenTo: 4,
|
||||
yellowFrom: 4,yellowTo: 5,
|
||||
redFrom: 5, redTo: 6,
|
||||
majorTicks: ['0','1','2','3','4','5','6'],
|
||||
minorTicks: 10
|
||||
};
|
||||
|
||||
var poweroptions = {
|
||||
min: 0, max: 1000,
|
||||
width: 400, height: 120,
|
||||
greenFrom: 100, greenTo: 200,
|
||||
yellowFrom: 200,yellowTo: 400,
|
||||
redFrom: 400, redTo: 1000,
|
||||
majorTicks: ['0','200','400','600','800','1000'],
|
||||
minorTicks: 5
|
||||
};
|
||||
|
||||
|
||||
var dataspm = null;
|
||||
var dataspeed = null;
|
||||
var spmchart = null;
|
||||
var speedchart = null;
|
||||
var powerchart = null;
|
||||
var datapower = null;
|
||||
|
||||
// SPM chart
|
||||
function drawSPMChart() {
|
||||
|
||||
data = new google.visualization.arrayToDataTable(spmdata);
|
||||
dataspm = new google.visualization.arrayToDataTable(spmdata);
|
||||
|
||||
|
||||
|
||||
spmchart = new google.visualization.Gauge(document.getElementById('basic'));
|
||||
spmchart = new google.visualization.Gauge(document.getElementById('basic_spm'));
|
||||
|
||||
// spmchart.draw(data, spmoptions);
|
||||
|
||||
@@ -35,8 +71,37 @@ function drawSPMChart() {
|
||||
|
||||
};
|
||||
|
||||
var spmchart;
|
||||
function set_basic() {
|
||||
data.setCell(0,1,spm_now);
|
||||
spmchart.draw(data, spmoptions)
|
||||
// Speed Chart
|
||||
function drawSpeedChart() {
|
||||
dataspeed = new google.visualization.arrayToDataTable(speeddata);
|
||||
|
||||
speedchart = new google.visualization.Gauge(document.getElementById('basic_boatspeed'));
|
||||
}
|
||||
|
||||
// Power chart
|
||||
function drawPowerChart() {
|
||||
datapower = new google.visualization.arrayToDataTable(powerdata);
|
||||
powerchart = new google.visualization.Gauge(document.getElementById('forcepower_power'));
|
||||
|
||||
}
|
||||
|
||||
function set_basic() {
|
||||
dataspm.setCell(0,1,spm_now);
|
||||
spmchart.draw(dataspm, spmoptions);
|
||||
|
||||
dataspeed.setCell(0,1,boatspeed_now);
|
||||
speedchart.draw(dataspeed,speedoptions);
|
||||
}
|
||||
|
||||
function set_athlete() {
|
||||
|
||||
}
|
||||
|
||||
function set_stroke() {
|
||||
|
||||
}
|
||||
|
||||
function set_forcepower() {
|
||||
datapower.setCell(0,1,power_now);
|
||||
powerchart.draw(datapower,poweroptions);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user