1 /*******************************************************************************
2 * Copyright (c) 2017 Rajesh Kudaka <4k.rajesh@gmail.com>
3 * Copyright (c) 2018 Intel Corporation.
5 * All rights reserved. This program and the accompanying materials
6 * are made available under the terms of the Apache License, Version 2.0
7 * which accompanies this distribution, and is available at
8 * http://www.apache.org/licenses/LICENSE-2.0
9 ******************************************************************************/
13 function create_tree(jstree_data)
15 $('#data_selector').jstree({
16 plugins: ['checkbox'],
32 // may need to pass timestamps too...
33 function create_table(table_data)
35 var tab, tr, td, tn, tbody, keys, key, curr_data, val;
37 tab = document.getElementsByTagName('table')[0];
38 tbody = document.createElement('tbody');
40 keys = Object.keys(table_data);
41 for (var i = 0; i < keys.length; i++) {
43 tr = document.createElement('tr');
44 td = document.createElement('td');
45 tn = document.createTextNode(key);
48 // add each piece of data as its own column
49 curr_data = table_data[key];
50 for (var j = 0; j < curr_data.length; j++) {
52 td = document.createElement('td');
53 tn = document.createTextNode(val === None ? '' : val);
57 tbody.appendChild(tr);
59 tab.appendChild(tbody);
62 function create_graph(cnvGraph, timestamps)
64 return new Chart(cnvGraph, {
105 responsiveAnimationDuration: 0,
106 maintainAspectRatio: false,
111 function update_graph(objGraph, datasets)
115 '#228B22', // ForestGreen
116 '#FF8C00', // DarkOrange
117 '#00008B', // DarkBlue
118 '#FF00FF', // Fuchsia
119 '#9ACD32', // YellowGreen
121 '#4169E1', // RoyalBlue
123 '#20B2AA', // LightSeaGreen
124 '#8A2BE2', // BlueViolet
130 {s: 'triangle', r: 4},
132 {s: 'rectRot', r: 5},
135 datasets.forEach(function(d, i) {
136 var color = colors[i % colors.length];
137 var point = points[i % points.length];
138 d.borderColor = color;
139 d.backgroundColor = color;
140 d.pointStyle = point.s;
141 d.pointRadius = point.r;
142 d.pointHoverRadius = point.r + 1;
144 objGraph.data.datasets = datasets;