forked from community/product-iots
parent
e86d6e43ab
commit
b631810d79
@ -1,9 +0,0 @@
|
||||
{{authorized}}
|
||||
{{layout "fluid"}}
|
||||
{{#zone "title"}}
|
||||
WSO2 DC | FireAlarm
|
||||
{{/zone}}
|
||||
{{#zone "body"}}
|
||||
{{unit "appbar" link="analytics" title="Device Analytics"}}
|
||||
{{unit "analytics"}}
|
||||
{{/zone}}
|
@ -1,3 +1,3 @@
|
||||
{
|
||||
"predicate": "urlMatch('/devices/analytics')"
|
||||
"predicate": "urlMatch('/analytics')"
|
||||
}
|
@ -0,0 +1,105 @@
|
||||
.rickshaw_graph .detail {
|
||||
pointer-events: none;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
z-index: 2;
|
||||
background: rgba(0, 0, 0, 0.1);
|
||||
bottom: 0;
|
||||
width: 1px;
|
||||
transition: opacity 0.25s linear;
|
||||
-moz-transition: opacity 0.25s linear;
|
||||
-o-transition: opacity 0.25s linear;
|
||||
-webkit-transition: opacity 0.25s linear;
|
||||
}
|
||||
.rickshaw_graph .detail.inactive {
|
||||
opacity: 0;
|
||||
}
|
||||
.rickshaw_graph .detail .item.active {
|
||||
opacity: 1;
|
||||
}
|
||||
.rickshaw_graph .detail .x_label {
|
||||
font-family: Arial, sans-serif;
|
||||
border-radius: 3px;
|
||||
padding: 6px;
|
||||
opacity: 0.5;
|
||||
border: 1px solid #e0e0e0;
|
||||
font-size: 12px;
|
||||
position: absolute;
|
||||
background: white;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.rickshaw_graph .detail .x_label.left {
|
||||
left: 0;
|
||||
}
|
||||
.rickshaw_graph .detail .x_label.right {
|
||||
right: 0;
|
||||
}
|
||||
.rickshaw_graph .detail .item {
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
border-radius: 3px;
|
||||
padding: 0.25em;
|
||||
font-size: 12px;
|
||||
font-family: Arial, sans-serif;
|
||||
opacity: 0;
|
||||
background: rgba(0, 0, 0, 0.4);
|
||||
color: white;
|
||||
border: 1px solid rgba(0, 0, 0, 0.4);
|
||||
margin-left: 1em;
|
||||
margin-right: 1em;
|
||||
margin-top: -1em;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.rickshaw_graph .detail .item.left {
|
||||
left: 0;
|
||||
}
|
||||
.rickshaw_graph .detail .item.right {
|
||||
right: 0;
|
||||
}
|
||||
.rickshaw_graph .detail .item.active {
|
||||
opacity: 1;
|
||||
background: rgba(0, 0, 0, 0.8);
|
||||
}
|
||||
.rickshaw_graph .detail .item:after {
|
||||
position: absolute;
|
||||
display: block;
|
||||
width: 0;
|
||||
height: 0;
|
||||
|
||||
content: "";
|
||||
|
||||
border: 5px solid transparent;
|
||||
}
|
||||
.rickshaw_graph .detail .item.left:after {
|
||||
top: 1em;
|
||||
left: -5px;
|
||||
margin-top: -5px;
|
||||
border-right-color: rgba(0, 0, 0, 0.8);
|
||||
border-left-width: 0;
|
||||
}
|
||||
.rickshaw_graph .detail .item.right:after {
|
||||
top: 1em;
|
||||
right: -5px;
|
||||
margin-top: -5px;
|
||||
border-left-color: rgba(0, 0, 0, 0.8);
|
||||
border-right-width: 0;
|
||||
}
|
||||
.rickshaw_graph .detail .dot {
|
||||
width: 4px;
|
||||
height: 4px;
|
||||
margin-left: -3px;
|
||||
margin-top: -3.5px;
|
||||
border-radius: 5px;
|
||||
position: absolute;
|
||||
box-shadow: 0 0 2px rgba(0, 0, 0, 0.6);
|
||||
box-sizing: content-box;
|
||||
-moz-box-sizing: content-box;
|
||||
background: white;
|
||||
border-width: 2px;
|
||||
border-style: solid;
|
||||
display: none;
|
||||
background-clip: padding-box;
|
||||
}
|
||||
.rickshaw_graph .detail .dot.active {
|
||||
display: block;
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
.rickshaw_legend {
|
||||
font-family: Arial;
|
||||
font-size: 12px;
|
||||
color: white;
|
||||
background: #404040;
|
||||
display: inline-block;
|
||||
padding: 12px 5px;
|
||||
border-radius: 2px;
|
||||
position: relative;
|
||||
}
|
||||
.rickshaw_legend:hover {
|
||||
z-index: 10;
|
||||
}
|
||||
.rickshaw_legend .swatch {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border: 1px solid rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
.rickshaw_legend .line {
|
||||
clear: both;
|
||||
line-height: 140%;
|
||||
padding-right: 15px;
|
||||
}
|
||||
.rickshaw_legend .line .swatch {
|
||||
display: inline-block;
|
||||
margin-right: 3px;
|
||||
border-radius: 2px;
|
||||
}
|
||||
.rickshaw_legend .label {
|
||||
margin: 0;
|
||||
white-space: nowrap;
|
||||
display: inline;
|
||||
font-size: inherit;
|
||||
background-color: transparent;
|
||||
color: inherit;
|
||||
font-weight: normal;
|
||||
line-height: normal;
|
||||
padding: 0px;
|
||||
text-shadow: none;
|
||||
}
|
||||
.rickshaw_legend .action:hover {
|
||||
opacity: 0.6;
|
||||
}
|
||||
.rickshaw_legend .action {
|
||||
margin-right: 0.2em;
|
||||
font-size: 10px;
|
||||
opacity: 0.2;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
}
|
||||
.rickshaw_legend .line.disabled {
|
||||
opacity: 0.4;
|
||||
}
|
||||
.rickshaw_legend ul {
|
||||
list-style-type: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
margin: 2px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.rickshaw_legend li {
|
||||
padding: 0 0 0 2px;
|
||||
min-width: 80px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.rickshaw_legend li:hover {
|
||||
background: rgba(255, 255, 255, 0.08);
|
||||
border-radius: 3px;
|
||||
}
|
||||
.rickshaw_legend li:active {
|
||||
background: rgba(255, 255, 255, 0.2);
|
||||
border-radius: 3px;
|
||||
}
|
File diff suppressed because one or more lines are too long
@ -1,10 +0,0 @@
|
||||
function changeImage() {
|
||||
var image = document.getElementById('myImage');
|
||||
if (image.src.match("bulb-on")) {
|
||||
|
||||
image.src = "/iot/public/mydevice/images/bulb-off.png";
|
||||
} else {
|
||||
|
||||
image.src = "/iot/public/mydevice/images/bulb-on.png";
|
||||
}
|
||||
}
|
@ -1,85 +0,0 @@
|
||||
function updateBulbGraph(bulbData) {
|
||||
renderBulbChart(bulbData);
|
||||
}
|
||||
|
||||
|
||||
function renderBulbChart(chartDataRaw){
|
||||
var chartWrapperElmId = "#canvas-wrapper6";
|
||||
var graphWidth = $(chartWrapperElmId).width() - 50;
|
||||
if (chartDataRaw.length == 0) {
|
||||
$(chartWrapperElmId).html("No data available...");
|
||||
return;
|
||||
}
|
||||
|
||||
var chartData = [[], []];
|
||||
for (var i = 0; i < chartDataRaw.length; i++){
|
||||
chartData[0].push({x:parseInt(chartDataRaw[i].x), y:parseInt(chartDataRaw[i].y)});
|
||||
chartData[1].push({x:parseInt(chartDataRaw[i].x), y:Math.abs(parseInt(chartDataRaw[i].y) - 1)});
|
||||
}
|
||||
|
||||
//var i = parseInt(fromDate);
|
||||
//while (i < parseInt(toDate)) {
|
||||
// var rnd = Math.round(Math.random());
|
||||
// chartData[0].push({x: i * 1000, y: rnd});
|
||||
// chartData[1].push({x: i * 1000, y: Math.abs(rnd - 1)});
|
||||
// i += 60 * 5;
|
||||
//}
|
||||
|
||||
var chartDiv = "chart6";
|
||||
var sliderDiv = "slider6";
|
||||
var x_axis = "x_axis6";
|
||||
var y_axis = "y_axis6";
|
||||
$(chartWrapperElmId).html("").html('<div id="' + y_axis + '" class="custom_y_axis"></div><div id="' + chartDiv + '" class="custom_rickshaw_graph"></div><div id="' + x_axis + '" class="custom_x_axis"></div><div id="' + sliderDiv + '" class="custom_slider"></div>');
|
||||
|
||||
var graph = new Rickshaw.Graph({
|
||||
element: document.getElementById(chartDiv),
|
||||
width: graphWidth,
|
||||
height: 150,
|
||||
strokeWidth: 0.5,
|
||||
renderer: 'bar_no_gap',
|
||||
xScale: d3.time.scale(),
|
||||
padding: {top: 0.2, left: 0.02, right: 0.02, bottom: 0},
|
||||
series: [
|
||||
{color: '#5E610B', data: chartData[0]},
|
||||
{color: 'white', data: chartData[1]}
|
||||
]
|
||||
});
|
||||
|
||||
graph.registerRenderer(new Rickshaw.Graph.Renderer.BarNoGap({graph: graph}));
|
||||
|
||||
graph.render();
|
||||
|
||||
var xAxis = new Rickshaw.Graph.Axis.X({
|
||||
graph: graph,
|
||||
orientation: 'bottom',
|
||||
element: document.getElementById(x_axis),
|
||||
tickFormat: graph.x.tickFormat()
|
||||
});
|
||||
|
||||
xAxis.render();
|
||||
|
||||
var yAxis = new Rickshaw.Graph.Axis.Y({
|
||||
graph: graph,
|
||||
orientation: 'left',
|
||||
element: document.getElementById(y_axis),
|
||||
width: 40,
|
||||
height: 160,
|
||||
tickFormat: function (y) {
|
||||
switch (y) {
|
||||
case 1:
|
||||
return 'ON';
|
||||
case 0:
|
||||
return 'OFF';
|
||||
default :
|
||||
return '';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
yAxis.render();
|
||||
|
||||
var slider = new Rickshaw.Graph.RangeSlider.Preview({
|
||||
graph: graph,
|
||||
element: document.getElementById(sliderDiv)
|
||||
});
|
||||
}
|
@ -1,69 +0,0 @@
|
||||
function updateCPUGraph(CPUData) {
|
||||
renderCPUChart(CPUData);
|
||||
}
|
||||
|
||||
function renderCPUChart(chartDataRaw){
|
||||
var chartWrapperElmId = "#canvas-wrapper7";
|
||||
var graphWidth = $(chartWrapperElmId).width() - 50;
|
||||
if (chartDataRaw.length == 0) {
|
||||
$(chartWrapperElmId).html("No data available...");
|
||||
return;
|
||||
}
|
||||
|
||||
var chartData = [];
|
||||
for (var i = 0; i < chartDataRaw.length; i++){
|
||||
chartData.push({x:parseInt(chartDataRaw[i].x), y:parseInt(chartDataRaw[i].y)});
|
||||
}
|
||||
|
||||
//var i = parseInt(fromDate);
|
||||
//while (i < parseInt(toDate)){
|
||||
// var rnd = Math.random() * (30 - 20) + 20;
|
||||
// chartData.push({x:i * 1000, y:rnd});
|
||||
// i += 60 * 5;
|
||||
//}
|
||||
|
||||
var chartDiv = "chart7";
|
||||
var sliderDiv = "slider7";
|
||||
var x_axis = "x_axis7";
|
||||
var y_axis = "y_axis7";
|
||||
$(chartWrapperElmId).html("").html('<div id="' + y_axis + '" class="custom_y_axis"></div><div id="' + chartDiv + '" class="custom_rickshaw_graph"></div><div id="' + x_axis + '" class="custom_x_axis"></div><div id="' + sliderDiv + '" class="custom_slider"></div>');
|
||||
|
||||
var graph = new Rickshaw.Graph({
|
||||
element: document.getElementById(chartDiv),
|
||||
width: graphWidth,
|
||||
height: 400,
|
||||
strokeWidth: 1,
|
||||
renderer: 'line',
|
||||
xScale: d3.time.scale(),
|
||||
padding: {top: 0.2, left: 0.02, right: 0.02, bottom: 0},
|
||||
series:[
|
||||
{ color: '#2F0B3A', data: chartData }
|
||||
]
|
||||
});
|
||||
|
||||
graph.render();
|
||||
|
||||
var xAxis = new Rickshaw.Graph.Axis.X({
|
||||
graph: graph,
|
||||
orientation: 'bottom',
|
||||
element: document.getElementById(x_axis),
|
||||
tickFormat: graph.x.tickFormat()
|
||||
});
|
||||
|
||||
xAxis.render();
|
||||
|
||||
var yAxis = new Rickshaw.Graph.Axis.Y({
|
||||
graph: graph,
|
||||
orientation: 'left',
|
||||
element: document.getElementById(y_axis),
|
||||
width: 40,
|
||||
height: 410
|
||||
});
|
||||
|
||||
yAxis.render();
|
||||
|
||||
var slider = new Rickshaw.Graph.RangeSlider.Preview({
|
||||
graph: graph,
|
||||
element: document.getElementById(sliderDiv)
|
||||
});
|
||||
}
|
@ -1,70 +0,0 @@
|
||||
function updateCPUTemperatureGraph(temperatureData) {
|
||||
console.log("cpuTemperatureData");
|
||||
renderCPUTemperatureChart(temperatureData);
|
||||
}
|
||||
|
||||
function renderCPUTemperatureChart(chartDataRaw) {
|
||||
var chartWrapperElmId = "#canvas-wrapper9";
|
||||
var graphWidth = $(chartWrapperElmId).width() - 50;
|
||||
if (chartDataRaw.length == 0) {
|
||||
$(chartWrapperElmId).html("No data available...");
|
||||
return;
|
||||
}
|
||||
|
||||
var chartData = [];
|
||||
for (var i = 0; i < chartDataRaw.length; i++) {
|
||||
chartData.push({x: parseInt(chartDataRaw[i].x), y: parseInt(chartDataRaw[i].y)});
|
||||
}
|
||||
|
||||
//var i = parseInt(fromDate);
|
||||
//while (i < parseInt(toDate)){
|
||||
// var rnd = Math.random() * (30 - 20) + 20;
|
||||
// chartData.push({x:i * 1000, y:rnd});
|
||||
// i += 60 * 5;
|
||||
//}
|
||||
|
||||
var chartDiv = "chart9";
|
||||
var sliderDiv = "slider9";
|
||||
var x_axis = "x_axis9";
|
||||
var y_axis = "y_axis9";
|
||||
$(chartWrapperElmId).html("").html('<div id="' + y_axis + '" class="custom_y_axis"></div><div id="' + chartDiv + '" class="custom_rickshaw_graph"></div><div id="' + x_axis + '" class="custom_x_axis"></div><div id="' + sliderDiv + '" class="custom_slider"></div>');
|
||||
|
||||
var graph = new Rickshaw.Graph({
|
||||
element: document.getElementById(chartDiv),
|
||||
width: graphWidth,
|
||||
height: 400,
|
||||
strokeWidth: 1,
|
||||
renderer: 'line',
|
||||
xScale: d3.time.scale(),
|
||||
padding: {top: 0.2, left: 0.02, right: 0.02, bottom: 0},
|
||||
series: [
|
||||
{color: '#FF4000', data: chartData}
|
||||
]
|
||||
});
|
||||
|
||||
graph.render();
|
||||
|
||||
var xAxis = new Rickshaw.Graph.Axis.X({
|
||||
graph: graph,
|
||||
orientation: 'bottom',
|
||||
element: document.getElementById(x_axis),
|
||||
tickFormat: graph.x.tickFormat()
|
||||
});
|
||||
|
||||
xAxis.render();
|
||||
|
||||
var yAxis = new Rickshaw.Graph.Axis.Y({
|
||||
graph: graph,
|
||||
orientation: 'left',
|
||||
element: document.getElementById(y_axis),
|
||||
width: 40,
|
||||
height: 410
|
||||
});
|
||||
|
||||
yAxis.render();
|
||||
|
||||
var slider = new Rickshaw.Graph.RangeSlider.Preview({
|
||||
graph: graph,
|
||||
element: document.getElementById(sliderDiv)
|
||||
});
|
||||
}
|
@ -1,84 +0,0 @@
|
||||
function updateFanGraph(fanData) {
|
||||
renderFanChart(fanData);
|
||||
}
|
||||
|
||||
function renderFanChart(chartDataRaw) {
|
||||
var chartWrapperElmId = "#canvas-wrapper5";
|
||||
var graphWidth = $(chartWrapperElmId).width() - 50;
|
||||
if (chartDataRaw.length == 0) {
|
||||
$(chartWrapperElmId).html("No data available...");
|
||||
return;
|
||||
}
|
||||
|
||||
var chartData = [[], []];
|
||||
for (var i = 0; i < chartDataRaw.length; i++){
|
||||
chartData[0].push({x:parseInt(chartDataRaw[i].x), y:parseInt(chartDataRaw[i].y)});
|
||||
chartData[1].push({x:parseInt(chartDataRaw[i].x), y:Math.abs(parseInt(chartDataRaw[i].y) - 1)});
|
||||
}
|
||||
|
||||
//var i = parseInt(fromDate);
|
||||
//while (i < parseInt(toDate)) {
|
||||
// var rnd = Math.round(Math.random());
|
||||
// chartData[0].push({x: i * 1000, y: rnd});
|
||||
// chartData[1].push({x: i * 1000, y: Math.abs(rnd - 1)});
|
||||
// i += 60 * 5;
|
||||
//}
|
||||
|
||||
var chartDiv = "chart5";
|
||||
var sliderDiv = "slider5";
|
||||
var x_axis = "x_axis5";
|
||||
var y_axis = "y_axis5";
|
||||
$(chartWrapperElmId).html("").html('<div id="' + y_axis + '" class="custom_y_axis"></div><div id="' + chartDiv + '" class="custom_rickshaw_graph"></div><div id="' + x_axis + '" class="custom_x_axis"></div><div id="' + sliderDiv + '" class="custom_slider"></div>');
|
||||
|
||||
var graph = new Rickshaw.Graph({
|
||||
element: document.getElementById(chartDiv),
|
||||
width: graphWidth,
|
||||
height: 150,
|
||||
strokeWidth: 0.5,
|
||||
renderer: 'bar_no_gap',
|
||||
xScale: d3.time.scale(),
|
||||
padding: {top: 0.2, left: 0.02, right: 0.02, bottom: 0},
|
||||
series: [
|
||||
{color: '#2F0B3A', data: chartData[0]},
|
||||
{color: 'white', data: chartData[1]}
|
||||
]
|
||||
});
|
||||
|
||||
graph.registerRenderer(new Rickshaw.Graph.Renderer.BarNoGap({graph: graph}));
|
||||
|
||||
graph.render();
|
||||
|
||||
var xAxis = new Rickshaw.Graph.Axis.X({
|
||||
graph: graph,
|
||||
orientation: 'bottom',
|
||||
element: document.getElementById(x_axis),
|
||||
tickFormat: graph.x.tickFormat()
|
||||
});
|
||||
|
||||
xAxis.render();
|
||||
|
||||
var yAxis = new Rickshaw.Graph.Axis.Y({
|
||||
graph: graph,
|
||||
orientation: 'left',
|
||||
element: document.getElementById(y_axis),
|
||||
width: 40,
|
||||
height: 160,
|
||||
tickFormat: function (y) {
|
||||
switch (y) {
|
||||
case 1:
|
||||
return 'ON';
|
||||
case 0:
|
||||
return 'OFF';
|
||||
default :
|
||||
return '';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
yAxis.render();
|
||||
|
||||
var slider = new Rickshaw.Graph.RangeSlider.Preview({
|
||||
graph: graph,
|
||||
element: document.getElementById(sliderDiv)
|
||||
});
|
||||
}
|
@ -1,85 +0,0 @@
|
||||
function updateLightGraph(lightData) {
|
||||
renderLightChart(lightData);
|
||||
}
|
||||
|
||||
|
||||
function renderLightChart(chartDataRaw){
|
||||
var chartWrapperElmId = "#canvas-wrapper2";
|
||||
var graphWidth = $(chartWrapperElmId).width() - 50;
|
||||
if (chartDataRaw.length == 0) {
|
||||
$(chartWrapperElmId).html("No data available...");
|
||||
return;
|
||||
}
|
||||
|
||||
var chartData = [[], []];
|
||||
for (var i = 0; i < chartDataRaw.length; i++){
|
||||
chartData[0].push({x:parseInt(chartDataRaw[i].x), y:parseInt(chartDataRaw[i].y)});
|
||||
chartData[1].push({x:parseInt(chartDataRaw[i].x), y:Math.abs(parseInt(chartDataRaw[i].y) - 1)});
|
||||
}
|
||||
|
||||
//var i = parseInt(fromDate);
|
||||
//while (i < parseInt(toDate)) {
|
||||
// var rnd = Math.round(Math.random());
|
||||
// chartData[0].push({x: i * 1000, y: rnd});
|
||||
// chartData[1].push({x: i * 1000, y: Math.abs(rnd - 1)});
|
||||
// i += 60 * 5;
|
||||
//}
|
||||
|
||||
var chartDiv = "chart2";
|
||||
var sliderDiv = "slider2";
|
||||
var x_axis = "x_axis2";
|
||||
var y_axis = "y_axis2";
|
||||
$(chartWrapperElmId).html("").html('<div id="' + y_axis + '" class="custom_y_axis"></div><div id="' + chartDiv + '" class="custom_rickshaw_graph"></div><div id="' + x_axis + '" class="custom_x_axis"></div><div id="' + sliderDiv + '" class="custom_slider"></div>');
|
||||
|
||||
var graph = new Rickshaw.Graph({
|
||||
element: document.getElementById(chartDiv),
|
||||
width: graphWidth,
|
||||
height: 150,
|
||||
strokeWidth: 0.5,
|
||||
renderer: 'bar_no_gap',
|
||||
xScale: d3.time.scale(),
|
||||
padding: {top: 0.2, left: 0.02, right: 0.02, bottom: 0},
|
||||
series: [
|
||||
{color: 'steelblue', data: chartData[0]},
|
||||
{color: 'white', data: chartData[1]}
|
||||
]
|
||||
});
|
||||
|
||||
graph.registerRenderer(new Rickshaw.Graph.Renderer.BarNoGap({graph: graph}));
|
||||
|
||||
graph.render();
|
||||
|
||||
var xAxis = new Rickshaw.Graph.Axis.X({
|
||||
graph: graph,
|
||||
orientation: 'bottom',
|
||||
element: document.getElementById(x_axis),
|
||||
tickFormat: graph.x.tickFormat()
|
||||
});
|
||||
|
||||
xAxis.render();
|
||||
|
||||
var yAxis = new Rickshaw.Graph.Axis.Y({
|
||||
graph: graph,
|
||||
orientation: 'left',
|
||||
element: document.getElementById(y_axis),
|
||||
width: 40,
|
||||
height: 160,
|
||||
tickFormat: function (y) {
|
||||
switch (y) {
|
||||
case 1:
|
||||
return 'ON';
|
||||
case 0:
|
||||
return 'OFF';
|
||||
default :
|
||||
return '';
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
yAxis.render();
|
||||
|
||||
var slider = new Rickshaw.Graph.RangeSlider.Preview({
|
||||
graph: graph,
|
||||
element: document.getElementById(sliderDiv)
|
||||
});
|
||||
}
|
@ -1,70 +0,0 @@
|
||||
function updateMotionGraph(motionData) {
|
||||
renderMotionChart(motionData);
|
||||
}
|
||||
|
||||
|
||||
function renderMotionChart(chartDataRaw){
|
||||
var chartWrapperElmId = "#canvas-wrapper3";
|
||||
var graphWidth = $(chartWrapperElmId).width() - 50;
|
||||
if (chartDataRaw.length == 0) {
|
||||
$(chartWrapperElmId).html("No data available...");
|
||||
return;
|
||||
}
|
||||
|
||||
var chartData = [];
|
||||
for (var i = 0; i < chartDataRaw.length; i++){
|
||||
chartData.push({x:parseInt(chartDataRaw[i].x), y:parseInt(chartDataRaw[i].y)});
|
||||
}
|
||||
|
||||
//var i = parseInt(fromDate);
|
||||
//while (i < parseInt(toDate)){
|
||||
// var rnd = Math.random() * (30 - 20) + 20;
|
||||
// chartData.push({x:i * 1000, y:rnd});
|
||||
// i += 60 * 5;
|
||||
//}
|
||||
|
||||
var chartDiv = "chart3";
|
||||
var sliderDiv = "slider3";
|
||||
var x_axis = "x_axis3";
|
||||
var y_axis = "y_axis3";
|
||||
$(chartWrapperElmId).html("").html('<div id="' + y_axis + '" class="custom_y_axis"></div><div id="' + chartDiv + '" class="custom_rickshaw_graph"></div><div id="' + x_axis + '" class="custom_x_axis"></div><div id="' + sliderDiv + '" class="custom_slider"></div>');
|
||||
|
||||
var graph = new Rickshaw.Graph({
|
||||
element: document.getElementById(chartDiv),
|
||||
width: graphWidth,
|
||||
height: 400,
|
||||
strokeWidth: 0.5,
|
||||
renderer: 'line',
|
||||
xScale: d3.time.scale(),
|
||||
padding: {top: 0.2, left: 0.02, right: 0.02, bottom: 0},
|
||||
series:[
|
||||
{ color: '#2F0B3A', data: chartData }
|
||||
]
|
||||
});
|
||||
|
||||
graph.render();
|
||||
|
||||
var xAxis = new Rickshaw.Graph.Axis.X({
|
||||
graph: graph,
|
||||
orientation: 'bottom',
|
||||
element: document.getElementById(x_axis),
|
||||
tickFormat: graph.x.tickFormat()
|
||||
});
|
||||
|
||||
xAxis.render();
|
||||
|
||||
var yAxis = new Rickshaw.Graph.Axis.Y({
|
||||
graph: graph,
|
||||
orientation: 'left',
|
||||
element: document.getElementById(y_axis),
|
||||
width: 40,
|
||||
height: 410
|
||||
});
|
||||
|
||||
yAxis.render();
|
||||
|
||||
var slider = new Rickshaw.Graph.RangeSlider.Preview({
|
||||
graph: graph,
|
||||
element: document.getElementById(sliderDiv)
|
||||
});
|
||||
}
|
@ -1,69 +0,0 @@
|
||||
function updateRAMGraph(RAMData) {
|
||||
renderRAMChart(RAMData);
|
||||
}
|
||||
|
||||
function renderRAMChart(chartDataRaw){
|
||||
var chartWrapperElmId = "#canvas-wrapper8";
|
||||
var graphWidth = $(chartWrapperElmId).width() - 50;
|
||||
if (chartDataRaw.length == 0) {
|
||||
$(chartWrapperElmId).html("No data available...");
|
||||
return;
|
||||
}
|
||||
|
||||
var chartData = [];
|
||||
for (var i = 0; i < chartDataRaw.length; i++){
|
||||
chartData.push({x:parseInt(chartDataRaw[i].x), y:parseInt(chartDataRaw[i].y)});
|
||||
}
|
||||
|
||||
//var i = parseInt(fromDate);
|
||||
//while (i < parseInt(toDate)){
|
||||
// var rnd = Math.random() * (30 - 20) + 20;
|
||||
// chartData.push({x:i * 1000, y:rnd});
|
||||
// i += 60 * 5;
|
||||
//}
|
||||
|
||||
var chartDiv = "chart8";
|
||||
var sliderDiv = "slider8";
|
||||
var x_axis = "x_axis8";
|
||||
var y_axis = "y_axis8";
|
||||
$(chartWrapperElmId).html("").html('<div id="' + y_axis + '" class="custom_y_axis"></div><div id="' + chartDiv + '" class="custom_rickshaw_graph"></div><div id="' + x_axis + '" class="custom_x_axis"></div><div id="' + sliderDiv + '" class="custom_slider"></div>');
|
||||
|
||||
var graph = new Rickshaw.Graph({
|
||||
element: document.getElementById(chartDiv),
|
||||
width: graphWidth,
|
||||
height: 400,
|
||||
strokeWidth: 1,
|
||||
renderer: 'line',
|
||||
xScale: d3.time.scale(),
|
||||
padding: {top: 0.2, left: 0.02, right: 0.02, bottom: 0},
|
||||
series:[
|
||||
{ color: '#170B3B', data: chartData }
|
||||
]
|
||||
});
|
||||
|
||||
graph.render();
|
||||
|
||||
var xAxis = new Rickshaw.Graph.Axis.X({
|
||||
graph: graph,
|
||||
orientation: 'bottom',
|
||||
element: document.getElementById(x_axis),
|
||||
tickFormat: graph.x.tickFormat()
|
||||
});
|
||||
|
||||
xAxis.render();
|
||||
|
||||
var yAxis = new Rickshaw.Graph.Axis.Y({
|
||||
graph: graph,
|
||||
orientation: 'left',
|
||||
element: document.getElementById(y_axis),
|
||||
width: 40,
|
||||
height: 410
|
||||
});
|
||||
|
||||
yAxis.render();
|
||||
|
||||
var slider = new Rickshaw.Graph.RangeSlider.Preview({
|
||||
graph: graph,
|
||||
element: document.getElementById(sliderDiv)
|
||||
});
|
||||
}
|
@ -1,69 +0,0 @@
|
||||
function updateSonarGraph(sonarData) {
|
||||
renderSonarChart(sonarData);
|
||||
}
|
||||
|
||||
function renderSonarChart(chartDataRaw){
|
||||
var chartWrapperElmId = "#canvas-wrapper4";
|
||||
var graphWidth = $(chartWrapperElmId).width() - 50;
|
||||
if (chartDataRaw.length == 0) {
|
||||
$(chartWrapperElmId).html("No data available...");
|
||||
return;
|
||||
}
|
||||
|
||||
var chartData = [];
|
||||
for (var i = 0; i < chartDataRaw.length; i++){
|
||||
chartData.push({x:parseInt(chartDataRaw[i].x), y:parseInt(chartDataRaw[i].y)});
|
||||
}
|
||||
|
||||
//var i = parseInt(fromDate);
|
||||
//while (i < parseInt(toDate)){
|
||||
// var rnd = Math.random() * (30 - 20) + 20;
|
||||
// chartData.push({x:i * 1000, y:rnd});
|
||||
// i += 60 * 5;
|
||||
//}
|
||||
|
||||
var chartDiv = "chart4";
|
||||
var sliderDiv = "slider4";
|
||||
var x_axis = "x_axis4";
|
||||
var y_axis = "y_axis4";
|
||||
$(chartWrapperElmId).html("").html('<div id="' + y_axis + '" class="custom_y_axis"></div><div id="' + chartDiv + '" class="custom_rickshaw_graph"></div><div id="' + x_axis + '" class="custom_x_axis"></div><div id="' + sliderDiv + '" class="custom_slider"></div>');
|
||||
|
||||
var graph = new Rickshaw.Graph({
|
||||
element: document.getElementById(chartDiv),
|
||||
width: graphWidth,
|
||||
height: 400,
|
||||
strokeWidth: 1,
|
||||
renderer: 'line',
|
||||
xScale: d3.time.scale(),
|
||||
padding: {top: 0.2, left: 0.02, right: 0.02, bottom: 0},
|
||||
series:[
|
||||
{ color: '#170B3B', data: chartData }
|
||||
]
|
||||
});
|
||||
|
||||
graph.render();
|
||||
|
||||
var xAxis = new Rickshaw.Graph.Axis.X({
|
||||
graph: graph,
|
||||
orientation: 'bottom',
|
||||
element: document.getElementById(x_axis),
|
||||
tickFormat: graph.x.tickFormat()
|
||||
});
|
||||
|
||||
xAxis.render();
|
||||
|
||||
var yAxis = new Rickshaw.Graph.Axis.Y({
|
||||
graph: graph,
|
||||
orientation: 'left',
|
||||
element: document.getElementById(y_axis),
|
||||
width: 40,
|
||||
height: 410
|
||||
});
|
||||
|
||||
yAxis.render();
|
||||
|
||||
var slider = new Rickshaw.Graph.RangeSlider.Preview({
|
||||
graph: graph,
|
||||
element: document.getElementById(sliderDiv)
|
||||
});
|
||||
}
|
@ -1,70 +0,0 @@
|
||||
function updateTemperatureGraph(temperatureData) {
|
||||
console.log("temperatureData");
|
||||
renderTemperatureChart(temperatureData);
|
||||
}
|
||||
|
||||
function renderTemperatureChart(chartDataRaw){
|
||||
var chartWrapperElmId = "#canvas-wrapper1";
|
||||
var graphWidth = $(chartWrapperElmId).width() - 50;
|
||||
if (chartDataRaw.length == 0) {
|
||||
$(chartWrapperElmId).html("No data available...");
|
||||
return;
|
||||
}
|
||||
|
||||
var chartData = [];
|
||||
for (var i = 0; i < chartDataRaw.length; i++){
|
||||
chartData.push({x:parseInt(chartDataRaw[i].x), y:parseInt(chartDataRaw[i].y)});
|
||||
}
|
||||
|
||||
//var i = parseInt(fromDate);
|
||||
//while (i < parseInt(toDate)){
|
||||
// var rnd = Math.random() * (30 - 20) + 20;
|
||||
// chartData.push({x:i * 1000, y:rnd});
|
||||
// i += 60 * 5;
|
||||
//}
|
||||
|
||||
var chartDiv = "chart1";
|
||||
var sliderDiv = "slider1";
|
||||
var x_axis = "x_axis1";
|
||||
var y_axis = "y_axis1";
|
||||
$(chartWrapperElmId).html("").html('<div id="' + y_axis + '" class="custom_y_axis"></div><div id="' + chartDiv + '" class="custom_rickshaw_graph"></div><div id="' + x_axis + '" class="custom_x_axis"></div><div id="' + sliderDiv + '" class="custom_slider"></div>');
|
||||
|
||||
var graph = new Rickshaw.Graph({
|
||||
element: document.getElementById(chartDiv),
|
||||
width: graphWidth,
|
||||
height: 400,
|
||||
strokeWidth: 1,
|
||||
renderer: 'line',
|
||||
xScale: d3.time.scale(),
|
||||
padding: {top: 0.2, left: 0.02, right: 0.02, bottom: 0},
|
||||
series:[
|
||||
{ color: '#FF4000', data: chartData }
|
||||
]
|
||||
});
|
||||
|
||||
graph.render();
|
||||
|
||||
var xAxis = new Rickshaw.Graph.Axis.X({
|
||||
graph: graph,
|
||||
orientation: 'bottom',
|
||||
element: document.getElementById(x_axis),
|
||||
tickFormat: graph.x.tickFormat()
|
||||
});
|
||||
|
||||
xAxis.render();
|
||||
|
||||
var yAxis = new Rickshaw.Graph.Axis.Y({
|
||||
graph: graph,
|
||||
orientation: 'left',
|
||||
element: document.getElementById(y_axis),
|
||||
width: 40,
|
||||
height: 410
|
||||
});
|
||||
|
||||
yAxis.render();
|
||||
|
||||
var slider = new Rickshaw.Graph.RangeSlider.Preview({
|
||||
graph: graph,
|
||||
element: document.getElementById(sliderDiv)
|
||||
});
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,35 +0,0 @@
|
||||
|
||||
/* Inspired by Lee Byron's test data generator. */
|
||||
function stream_layers(n, m, o) {
|
||||
if (arguments.length < 3) o = 0;
|
||||
function bump(a) {
|
||||
var x = 1 / (.1 + Math.random()),
|
||||
y = 2 * Math.random() - .5,
|
||||
z = 10 / (.1 + Math.random());
|
||||
for (var i = 0; i < m; i++) {
|
||||
var w = (i / m - y) * z;
|
||||
a[i] += x * Math.exp(-w * w);
|
||||
}
|
||||
}
|
||||
return d3.range(n).map(function() {
|
||||
var a = [], i;
|
||||
for (i = 0; i < m; i++) a[i] = o + o * Math.random();
|
||||
for (i = 0; i < 5; i++) bump(a);
|
||||
return a.map(stream_index);
|
||||
});
|
||||
}
|
||||
|
||||
/* Another layer generator using gamma distributions. */
|
||||
function stream_waves(n, m) {
|
||||
return d3.range(n).map(function(i) {
|
||||
return d3.range(m).map(function(j) {
|
||||
var x = 20 * j / m - i / 3;
|
||||
return 2 * x * Math.exp(-.5 * x);
|
||||
}).map(stream_index);
|
||||
});
|
||||
}
|
||||
|
||||
function stream_index(d, i) {
|
||||
return {x: i, y: Math.max(0, d)};
|
||||
}
|
||||
|
Loading…
Reference in new issue