display ajax information under input field - php

I tried to develop an ajax to display some information.
My ajax works fine but it do not display the information under the input field.
Do you have any idea to resolve that ?
thank you.
$content .= HTML::inputField('suppliers_id', $suppliers_id . ' ' . $suppliers_name, 'id="ajax_suppliers_id" list="supplier_list" class="form-control"', null, null, null);
$content .= '<datalist id="supplier_list"></datalist>';
$suppliers_ajax = this->link('ajax/suppliers.php');
<script>
window.addEventListener("load", function(){
// Add a keyup event listener to our input element
document.getElementById('ajax_suppliers_id').addEventListener("keyup", function(event){hinter(event)});
// create one global XHR object
// so we can abort old requests when a new one is make
window.hinterXHR = new XMLHttpRequest();
});
// Autocomplete for form
function hinter(event) {
var input = event.target;
var ajax_suppliers_id = document.getElementById('ajax_suppliers_id');
// minimum number of characters before we start to generate suggestions
var min_characters = 0;
if (!isNaN(input.value) || input.value.length < min_characters ) {
return;
} else {
window.hinterXHR.abort();
window.hinterXHR.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var response = JSON.parse( this.responseText );
ajax_suppliers_id.innerHTML = "";
response.forEach(function(item) {
// Create a new <option> element.
var option = document.createElement('option');
option.value = item;
ajax_suppliers_id.appendChild(option);
});
}
};
window.hinterXHR.open("GET", "{$suppliers_ajax}?q=" + input.value, true);
window.hinterXHR.send()
}
}
</script>
my ajax request called across the input field, I use to display information:
if (isset($_GET['q'])) {
$terms = HTML::sanitize(strtolower($_GET['q']));
$Qcheck = $this->Db->prepare('select distinct suppliers_id as id,
suppliers_name as name
from :table_suppliers
where suppliers_name LIKE :terms
limit 10;
');
$Qcheck->bindValue(':terms', '%' . $terms . '%');
$Qcheck->execute();
$list = $Qcheck->rowCount();
if ($list > 0) {
$array = [];
while ($value = $Qcheck->fetch()) {
$array[] = $value;
}
# JSON-encode the response
$json_response = json_encode($array); //Return the JSON Array
# Return the response
echo $json_response;
}
example of response I can see on sa keywords:
[{"id":"3","name":"Samsug"}]

You are appending new options inside input but you need to append it inside datalist .Also , option.value = item.name will give you result has [Object object] that's why you need to specify field i.e : id ,name to access same elements . i.e : item.name .
Demo Code :
var ajax_suppliers_id = document.getElementById('supplier_list');//daatlist id
var response = [{
"id": "3",
"name": "Samsug"
},{
"id": "3",
"name": "Samsug1"
},{
"id": "3",
"name": "Samsug2"
}];
ajax_suppliers_id.innerHTML = "";
response.forEach(function(item) {
// Create a new <option> element.
var option = document.createElement('option');
option.value = item.name;//get name
ajax_suppliers_id.appendChild(option);
});
<input list="supplier_list" class="form-control" id="ajax_suppliers_id">
<datalist id="supplier_list"></datalist>

Related

Ajax JSON.parse JSONarray

I am trying populate a form from a mysqli database when an option is selected from a drop down. I am trying to do this with an ajax 'get' call to a PHP page. The PHP page does the SQL query and returns the results, then I do a json_encode of the data. This puts the JSON into an array. Then the ajax function attempts to parse the JSON. However this is where the problem lies. The JSON data comes in as an array and the JSON.parse(xhr.response) fails to parse.
[{"id":"12","accountnum":"2148","name":"Blah","address":"123 Dan Hwy","city":"ANY Town","state":"IA","zip":"11111","phonenumber":"555-555-5555","brand":"Dan","create_date":"2021-06-14 15:47:36"}]
//////////////////////////////////////////////////
<script>
const selectElement = document.querySelector('.accountnum');
selectElement.addEventListener('change', (event) =>{
const result = document.querySelector('.result');
var eventResponse = `${event.target.value}`;
result.textContent = 'the account num is ' +eventResponse;
loadAccounts(eventResponse);
});
</script>
///////////////////////////////////////
function loadAccounts(eventResponse){
var xhr = new XMLHttpRequest();
var url = "users.php";
var geturl = xhr.open('GET', url+"?accountnum="+eventResponse, true);
xhr.onreadystatechange = function(){
if(xhr.readyState === XMLHttpRequest.DONE) {
if(this.status == 200){
console.log(xhr.response);
var accounts = JSON.parse(xhr.response);
console.log(accounts.id);
console.log(accounts.name);
var output = '';
for(var i in accounts){
output += '<div class="form-group">' +
'<label for="accountname">AccountNum*</label>' +
'<input type="text" class="form-control" id="accountnum" name="accountnum" value= '+accounts[i].accountnum+ '>' +
'</div>'
}
document.getElementById('accounts').innerHTML = output;
}
}
}
xhr.send()
}
</script>
////////////////////////////////////////////////
<?php
$accountnum = $_GET['accountnum'];
$query = "SELECT * FROM accounts WHERE accountnum = $accountnum";
$result = mysqli_query($conn, $query);
$accounts = mysqli_fetch_all($result, MYSQLI_ASSOC);
echo json_encode($accounts);
?>
Your response is an array, not an object. Try reassigning the accounts variable like accounts = accounts[0];. Or make your php script extract the first element from the result set and json encode it loke echo $accounts[0] ?? null;

How to check the condition in the jquery?

I am create the js tree to show the folder path name, and my problem is how to check the condition if database table status is 0(inactive) then will show the line-through in the js tree. Else table status is 1(active) just back to normal. Below is my coding:
<?php
$folderData = mysqli_query($mysql_con,"SELECT * FROM filing_code_management");
$folders_arr = array();
while($row = mysqli_fetch_assoc($folderData)){
$parentid = $row['parentid'];
if($parentid == '0') $parentid = "#";
$selected = false;$opened = false;
if($row['id'] == 2){
$selected = true;$opened = true;
}
$folders_arr[] = array(
"id" => $row['id'],
"parent" => $parentid,
"text" => $row['name'] . ' ' . "<span id='category'>". $row['category']."</span>",
"category" => $row['category'],
"status" => $row['status'], // status 0 is inactive, status 1 is active
"state" => array("selected" => $selected,"opened"=>$opened)
);
}
?>
<script style="text/javascript">
var StrikeNodes = function(nodelist) {
var tree = $('#folder_jstree').jstree(true);
nodelist.forEach(function(n) {
tree.get_node(n.id).a_attr.style = "text-decoration:" + getStrike(parseInt(n.text.substr(0, 3), 10));
tree.redraw_node(n.id); //Redraw tree
StrikeNodes(n.children); //Update leaf nodes
});
};
var getStrike = function(i) {
if (status = '0' ) {
return "line-through;";
} else {
return "";
}
};
$('#folder_jstree').bind('load_node.jstree', function(e, data) {
var tree = $('#folder_jstree').jstree(true);
StrikeNodes(tree.get_json());
});
</script>
Now my output show all the all the line-through in the js tree, not detect which is active or inactive.
My working JSFiddle code here: https://jsfiddle.net/ason5861_cs/9x0dsotz/3/
Hope someone can guide me which part I am getting wrong.
looking at your code. you are not comparing the status it should be status == '0' instead of status = '0'
also there is available option that jstree provided. data option this can be anything you want. it is metadata you want attached to the nod. you will be able to access and modify it any time later - it has no effect on the visuals of the node.
[{
"id": "1",
"parent": "#",
"text": "100 PENTADBIRAN <span id='category'>JTM<\/span>",
"category": "JTM",
"data": { "status": 0 },
"state": {
"selected": false,
"opened": false
}
}]
var StrikeNodes = function(nodelist) {
var tree = $('#folder_jstree').jstree(true);
nodelist.forEach(function(n) {
tree.get_node(n.id).a_attr.style = "text-decoration:" + getStrike(n.data.status);
tree.redraw_node(n.id); //Redraw tree
StrikeNodes(n.children); //Update leaf nodes
});
};
var getStrike = function(status) {
if (status == 0) {
return "line-through;";
}
return "";
};
here's i've edited your fiddle https://jsfiddle.net/Hafizu/1xt7bhem/11/

Getting a JSON from a Ajax request and creating a polygon layer in Leaflet

I need some help with a script, i have an ajax request that returns a GeoJSON
Images:
JSON Format
"id_map": "2",
"description": "AC1",
"geojson": {a GeoJSON coordinate }
"file": "AC1.geojson"
I can use AJAX JSON Leaflet (plugin( to create a polygon layer using the JSON value file ex (ac1.geojson) and point it up to a folder with the GeoJSON files (ex. geojson), but i have the same GeoJSON saved as a text variable in a database and i want to use it besides the file because of the risk of losing the files, so i recover it (i use GeoJson.io to validate the geojson and copy paste it in a column in my database) using a database connection and then i JSON encode it, but i am unable to use it. And I'm having problems with the format that comes out from the PHP.
$(document).ready(function() {
document.body.onload = function() {
var tiles = L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 20,
minZoom: 13,
attribution: 'x'
}),
latlng = L.latLng(-32.0312422, -52.0917713);
var mymap = L.map('mapid', {
center: latlng,
zoom: 18,
layers: [tiles]
});
L.marker([-32.0312422, -52.0917713]).addTo(mymap);
function popUp(f, l) {
var out = [];
if (f.properties) {
for (key in f.properties) {
out.push(key + ": " + f.properties[key]);
}
l.bindPopup(out.join("<br />"));
}
}
var j_url = "somephp.php";
var results = $.ajax({
url: j_url,
dataType: 'json',
cache: false,
success: AjaxSucceeded,
error: AjaxFailed
});
function AjaxSucceeded(results) {
console.log("Data successfully loaded.");
alert("OK");
$.each(results, function(index, value) {
var geojsonTESTE = {
"type": "FeatureCollection",
"features": [{
"type": "Feature",
"properties": {},
"geometry": {
"type": "Polygon",
"coordinates": [
[
[-52.101760, -32.031909],
[-52.102275, -32.028598],
[-52.100794, -32.028435],
[-52.099206, -32.029053],
[-52.097554, -32.029362],
[-52.097511, -32.029672],
[-52.096760, -32.029672],
[-52.096696, -32.029544],
[-52.095795, -32.029617],
[-52.094142, -32.029835],
[-52.088585, -32.030672],
[-52.088392, -32.030763],
[-52.088027, -32.034656],
[-52.101631, -32.032145],
[-52.101760, -32.031909]
]
]
}
}]
};
var geoObject = JSON.parse(value.geojson);
L.geoJSON(geojsonTESTE).addTo(mymap);
L.geoJSON(features).addTo(mymap);
//With Leaflet Ajax e Files
//j_url = "json/"+value.file;
//var jsonTest = new L.GeoJSON.AJAX([j_url]{onEachFeature:popUp}).addTo(mymap);
});
}
function AjaxFailed(results) {
console.log("ERROR AJAX");
alert("ERRO");
}
$.when(results).done(function() {
});
};
});
<?php
header('Content-Type: application/json');
$connStr = { database connection string }
$conn = pg_connect($connStr);
$result = pg_query($conn, "select * from mapas");
$qtd = pg_num_rows($result);
$res = "[";
if($qtd > 0){
$i = 0;
foreach(pg_fetch_all($result) as $row)
{
$x = $row['geojson'];
$patterns = array ('/[^A-Za-z0-9\-\,\"\:\{\}\[\]]/');
$replace = array ('');
$desc = preg_replace($patterns, $replace,$x);
$desc = str_replace('\"', '"', $desc, $count);
$data['id_map'] = $row['id_map'];
$data['description'] = $row['description'];
$data['geojson'] = $desc;
$data['file'] = $row['file'];
$map = json_readable_encode($data,null,true);
$res .= $map;
if($i < $qtd -1 ){
$res .= ",";
}
$i++;
}
}
$res .= "]";
echo trim($res);
pg_free_result($result);
pg_close();
?>

Algolia Geo Search Not Working

I am having some trouble with Algolia's geo search feature which was working properly before. Here is the record of interest.
I also had that indexed as described by the doc in order for me to sort it by the nearest distance:
'attributesToIndex' => ['name', 'description', 'geo']
In my client script:
let settings = {
aroundLatLng: '10.309813,123.893154',
getRankingInfo: true,
aroundRadius: 2000
};
index.search(keyword, settings, (err, data) => {
console.log(data);
});
But this gives me 0 hit. Notice the aroundLatLng value -- its the same value from the record of interest.
Am I missing something here?
I have implemented same requirement in node.js as per given in document and its working fine.
Here i am copying my whole code. Hopefully it may help you.
Code
/*
I have used async.water model to create the setting of the index and then searching data as per given parameter. few function is custom so no need to bother about that. read each line patently.
*/
try {
var self = this;
var post = req.body;
var user_id = post.user_id;
var created_mode = post.user_mode == 'requester' ? 'provider' : 'requester';
var kword = post.kword;
var geo = post.geo_loc;
var aroundLatLng = post.aroundLatLng;
var aroundRadius = !cmnFn.empty(post.radious) ? post.radious : 4500;
var hitsPerPage = !cmnFn.empty(post.hitsPerPage) ? post.hitsPerPage : 20;
var offset = !cmnFn.empty(post.offset) ? post.offset : 0;
var length = !cmnFn.empty(post.length) ? post.length : 50;
var budget_from = !cmnFn.empty(post.budget_from) ? post.budget_from : 0;
var budget_to = !cmnFn.empty(post.budget_to) ? post.budget_to : 0;
var day_preference = !cmnFn.empty(post.day_preference) ? post.day_preference : '';
var time_preference = !cmnFn.empty(post.time_preference) ? post.time_preference : '';
var start_date = !cmnFn.empty(post.start_date) ? post.start_date : '';
job_index is index created on Algolia
var job_index = algClient.initIndex('jobs');
var cond = {};
If you are using facet & filter then you need to use filter key to execute your condition same as you may have done in sql using where clouse
cond.filters = 'created_mode:"' + created_mode + '" AND (NOT user_id:"' + user_id + '")';
// Query which need to be search
if (!cmnFn.empty(kword)) {
cond.query = !cmnFn.empty(post.kword) ? post.kword : '';
}
if ((!cmnFn.empty(budget_from) && !cmnFn.empty(budget_to)) && budget_from > 0) {
cond.filters += ' AND min_charge: ' + budget_from + ' TO ' + budget_to;
}
if (!cmnFn.empty(day_preference)) {
cond.filters += ' AND day_preference:"' + day_preference + '"';
}
if (!cmnFn.empty(time_preference)) {
cond.filters += ' AND time_preference:"' + time_preference + '"';
}
if (!cmnFn.empty(start_date) && (new Date(start_date)).getTime() > 0) {
cond.filters += ' AND start_date:"' + start_date + '"';
}
Here i am setting aroundLatLng to get data nearest to far
/*
Do not fogot one thing, before using geo search, your records must have _geoloc key having following format
"_geoloc": {
"lat": 40.639751,
"lng": -73.778925
}
*/
// Around geo search by given lat lng
if (!cmnFn.empty(aroundLatLng) && !cmnFn.empty(aroundLatLng.lat)) {
cond.aroundLatLng = aroundLatLng.lat + ', ' + aroundLatLng.lng;
if (!cmnFn.empty(aroundRadius) && cond.aroundRadius > 0) {
cond.aroundRadius = aroundRadius;
}
}
// total number of searched record
if (!cmnFn.empty(hitsPerPage)) {
cond.hitsPerPage = hitsPerPage;
}
// Record starting position
if (!cmnFn.empty(offset)) {
cond.offset = offset;
}
// Page Limitation
if (!cmnFn.empty(length)) {
cond.length = length;
}
// Don't show attributesToHighlight in result set
cond.attributesToHighlight = false;
/*
restrictSearchableAttributes: List of object key, where to search in given list defined in searchableAttributes
*/
cond.restrictSearchableAttributes = [
'user_id',
'title',
'description',
'_geoloc'
];
/*
It will return raning info of result when search come under geo search
Following output will return
"_rankingInfo": {
"nbTypos": 0,
"firstMatchedWord": 0,
"proximityDistance": 0,
"userScore": 31,
"geoDistance": 9, // Calculated distance between data geolocation given in _geoloc and search criteria in aroundLatLng
"geoPrecision": 1,
"nbExactWords": 0,
"words": 1,
"filters": 0,
"matchedGeoLocation": {
"lat": 28.5503,
"lng": 77.2501,
"distance": 9
}
}
*/
cond.getRankingInfo = true;
async.waterfall([
function (callback) {
job_index.setSettings({
'attributesForFaceting': ['user_id', 'created_mode', 'min_charge', 'day_preference', 'time_preference', 'start_date'],
/*
searchableAttributes: List of object key , where to search
eg: ['title', 'description']
Like in sql: Where title='your searched text' AND description='your searched text'
_geoloc is reserved keyword of algolia which will used to search geo location
*/
searchableAttributes: [
'title',
'description',
'user_id',
'_geoloc'
],
/*
attributesToRetrieve: Here you can specify list of key name which you want to retrive
eg: ['name','address','age']
Like in sql: Select name, address, age
*/
attributesToRetrieve: [
'*'
]
}).then(() => {
return callback(null, 'success');
});
}
], function (err, results) {
if (err) {
console.log('error: ' + err);
}
job_index.search(cond).then(results => {
if (results.nbHits > 0) {
var rows = new Array();
for (i in results.hits) {
var row = {};
var item = results.hits[i];
var user_info = {};
user_info = item.user_info;
// Get distance and calculate
if (!cmnFn.empty(item._rankingInfo)) {
item.distance = cmnFn.meterToKM(item._rankingInfo['geoDistance']);
} else {
let loc = {
geoLoc_1: { latitude: aroundLatLng.lat, longitude: aroundLatLng.lng },
geoLoc_2: { latitude: item._geoloc.lat, longitude: item._geoloc.lng }
}
cmnFn.getDistance(loc, function (distance) {
item.distance = distance
})
}
/* self.isFav({ user_id: item.user_id, job_id: item.job_id }), function (err, flag) {
item.is_favorite = flag;
}; */
self.isFav({ user_id: item.user_id, job_id: item.job_id }).then(function (flag) {
item.is_favorite = flag;
}, function (err) {
item.is_favorite = false;
});
if (cmnFn.empty(item.currency)) {
item.currency = "₹";
}
//Delete few key from object which does not need to send in response
delete item['user_info'];
delete item['objectID'];
delete item['_geoloc'];
delete item['_rankingInfo'];
row.job_info = item;
row.user_info = user_info;
rows.push(row);
}
info = { status: 1, message: util.format(lang.TOTAL_RECORD_FOUND, results.nbHits), data: rows };
cmnFn.showMsg(res, info);
} else {
info = { status: 0, message: lang.RECORD_NOT_FOUND, data: null };
cmnFn.showMsg(res, info);
}
}).catch(err => {
console.log(err);
info = { status: 0, message: lang.RECORD_NOT_FOUND, data: null };
cmnFn.showMsg(res, info);
});
//res.end('' + JSON.stringify(results));
});
} catch (error) {
info = { status: 0, message: lang.RECORD_NOT_FOUND, data: null };
cmnFn.showMsg(res, info);
}
My bad. Malformed indexed data for _geoloc. Should be keyed with lat and lng

PHP jQuery JSON format

I have the following code in PHP which returns this JSON code. I can't return the values for "OK" because of the format, I must do some jQuery trick to get it, but I don't want it... Some advice will be appreciated.
PHP
while($row = sqlsrv_fetch_array($datBS)) {
$ahora = $row['servicio'];
if($ahora != $antes && $n == 1) {
$ok = array();$ko = array(); $rt = array(); $horas = array();
}
if($row['peticion_id'] == 0) {$ok[] = round($row['valor'], 3); $horas[] = $row['hora'];}
if($row['peticion_id'] == 1) $ko[] = round($row['valor'], 3);
if($row['peticion_id'] == 2) $rt[] = round($row['valor'], 3);
$datosBS[$ahora] = array(
"OK" => $ok,
"KO" => $ko,
"RT" => $rt,
"HORAS" => $horas
);
$antes = $ahora;
$n = 1;
}
while($row = sqlsrv_fetch_array($sqlTotalsBS)) {
$bs[$row['servicio']] = array(
"SUMOK" => intval($row["OK"]),
"SUMKO" => intval($row["KO"])
);
}
$banksphere = array_merge_recursive((array)$bs, (array)$datosBS);
$json = array_merge((array)$banksphere);
echo json_encode($json);
JSON
{"Servicing":{"SUMOK":923391,"SUMKO":1048,"OK":[184,69,28,14,15,15,0,11,13,0,14,21,19,3,8,0,5,17,13,0,8,30,5,3,13,18,26,24,46,116,342,790,2828,9795,15647,21394,23710,26214,27522,27038,26603,28939,29149,29222,28020,30061,29967,20139,21436,31416,31354,32472,32659,32435,33767,33623,33394,27204,28830,32562,34844,20197,11903,6923,6855,6133,6051,7456,7842,8366,9271,10127,10301,9845,9616,8391],"KO":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,4,9,17,20,11,29,30,35,65,89,56,52,59,26,35,70,39,39,60,28,15,12,27,20,37,20,20,12,8,5,3,8,10,5,12,4,11,9,9,10,11,4],"RT":[0.139,0.171,0.73,0.187,3.667,3.126,0,3.629,7.227,0,4.279,5.967,3.195,2.862,0.883,0,5.441,6.495,0.883,0,1.835,1.656,2.09,0.111,0.35,1.015,1.457,0.829,0.635,0.767,0.534,0.325,0.202,0.172,0.142,0.129,0.125,0.127,0.123,0.125,0.124,0.12,0.122,0.116,0.121,0.114,0.116,0.115,0.116,0.127,0.118,0.128,0.123,0.119,0.12,0.115,0.113,0.114,0.119,0.11,0.104,0.142,0.112,0.139,0.107,0.131,0.149,0.139,0.139,0.133,0.131,0.116,0.109,0.122,0.116,0.113],"HORAS":["00:00","00:15","00:30","00:45","01:00","01:15","01:30","01:45","02:00","02:15","02:30","02:45","03:00","03:15","03:30","03:45","04:00","04:15","04:30","04:45","05:00","05:15","05:30","05:45","06:00","06:15","06:30","06:45","07:00","07:15","07:30","07:45","08:00","08:15","08:30","08:45","09:00","09:15","09:30","09:45","10:00","10:15","10:30","10:45","11:00","11:15","11:30","11:45","12:00","12:15","12:30","12:45","13:00","13:15","13:30","13:45","14:00","14:15","14:30","14:45","15:00","15:15","15:30","15:45","16:00","16:15","16:30","16:45","17:00","17:15","17:30","17:45","18:00","18:15","18:30","18:45"]},"Estructurales":{"SUMOK":58088,"SUMKO":453,"OK":[25,12,10,2,16,12,5,11,4,6,10,14,11,7,10,4,7,16,9,6,10,13,9,4,14,10,14,20,33,81,144,366,1562,5956,3671,2251,1976,1960,1600,1656,1475,1396,1473,1567,1412,1486,1553,1198,1046,1655,1636,1743,1711,1550,1417,1340,1562,1312,993,1285,925,790,377,311,286,324,378,486,602,461,542,491,474,450,401,433],"KO":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,2,2,5,11,11,14,10,9,17,10,9,21,10,10,5,8,14,18,16,33,22,18,19,27,21,29,16,13,11,3,2,1,5,5,1,2,3,3,3,2,4,7],"RT":[0.072,0.888,0.085,0.055,0.063,0.065,0.044,0.113,0.046,0.139,0.08,0.215,0.089,0.134,0.083,0.51,0.242,0.224,0.255,0.126,0.125,0.206,0.343,0.062,0.06,0.229,0.074,0.334,0.08,0.186,0.098,0.113,0.141,0.056,0.091,0.165,0.189,0.187,0.211,0.288,0.248,0.267,0.263,0.279,0.296,0.263,0.257,0.266,0.269,0.303,0.294,0.274,0.275,0.284,0.289,0.287,0.297,0.256,0.591,0.25,0.31,0.382,0.25,0.265,0.1,0.115,0.125,0.123,0.132,0.561,0.172,0.254,0.14,0.106,0.193,0.187],"HORAS":["00:00","00:15","00:30","00:45","01:00","01:15","01:30","01:45","02:00","02:15","02:30","02:45","03:00","03:15","03:30","03:45","04:00","04:15","04:30","04:45","05:00","05:15","05:30","05:45","06:00","06:15","06:30","06:45","07:00","07:15","07:30","07:45","08:00","08:15","08:30","08:45","09:00","09:15","09:30","09:45","10:00","10:15","10:30","10:45","11:00","11:15","11:30","11:45","12:00","12:15","12:30","12:45","13:00","13:15","13:30","13:45","14:00","14:15","14:30","14:45","15:00","15:15","15:30","15:45","16:00","16:15","16:30","16:45","17:00","17:15","17:30","17:45","18:00","18:15","18:30","18:45"]},"Movilidad":{"SUMOK":96919,"SUMKO":27,"OK":[1563,1396,1250,1082,825,652,427,416,305,266,205,233,149,203,141,118,148,132,101,86,111,141,205,136,285,405,445,584,736,1159,1047,1333,1406,1627,1828,1978,2393,2533,2351,2445,2182,2346,2068,2067,1900,2187,2161,1380,1093,1891,2060,1877,1825,1806,1896,1854,1748,1613,1789,1795,1939,1963,2123,1704,1864,1693,1862,1706,1461,1488,1608,1367,1419,1516,1347,1475],"KO":[1,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,0,1,1,0,0,0,0,1,0,2,1,0,0,1,0,2,0,1,2,2,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,4],"RT":[0.361,0.462,0.42,0.417,0.379,0.583,0.43,0.377,0.449,0.505,0.428,0.591,0.466,0.459,0.595,0.441,0.481,0.462,0.65,0.674,0.668,0.519,0.562,0.547,0.52,0.546,0.474,0.481,0.484,0.457,0.449,0.503,0.432,0.425,0.438,0.422,0.441,0.426,0.395,0.397,0.4,0.385,0.408,0.469,0.416,0.45,0.386,0.414,0.413,0.413,0.395,0.373,0.418,0.386,0.387,0.376,0.386,0.398,0.405,0.406,0.399,0.407,0.395,0.385,0.421,0.397,0.372,0.351,0.39,0.384,0.359,0.401,0.403,0.435,0.395,0.355],"HORAS":["00:00","00:15","00:30","00:45","01:00","01:15","01:30","01:45","02:00","02:15","02:30","02:45","03:00","03:15","03:30","03:45","04:00","04:15","04:30","04:45","05:00","05:15","05:30","05:45","06:00","06:15","06:30","06:45","07:00","07:15","07:30","07:45","08:00","08:15","08:30","08:45","09:00","09:15","09:30","09:45","10:00","10:15","10:30","10:45","11:00","11:15","11:30","11:45","12:00","12:15","12:30","12:45","13:00","13:15","13:30","13:45","14:00","14:15","14:30","14:45","15:00","15:15","15:30","15:45","16:00","16:15","16:30","16:45","17:00","17:15","17:30","17:45","18:00","18:15","18:30","18:45"]},"Riesgos":{"SUMOK":200875,"SUMKO":1409,"OK":[50,61,31,55,28,26,5,60,20,0,15,0,15,15,0,0,15,0,15,15,0,15,15,0,13,2,0,30,2,44,146,268,510,1265,2425,2955,3841,4581,5321,5587,5944,6327,5300,5337,5291,5679,5805,3869,3708,6929,7262,6740,6493,6381,6789,6080,5504,6053,5190,5224,4327,2092,1426,1499,2065,2972,3495,3766,4504,4265,4429,5289,4926,4524,3760,4185],"KO":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,5,5,7,5,17,18,24,24,53,36,47,40,41,43,24,26,53,54,62,58,41,46,51,33,29,26,18,10,13,14,16,21,23,48,53,45,49,34,34,43,38,36,43],"RT":[0.065,0.083,0.13,0.707,0.099,0.084,2.82,0.194,0.22,0,0.492,0,0.433,0.161,0,0,0.298,0,0.537,0.446,0,0.52,0.728,0,0.287,0.345,0,0.082,1.316,1.136,0.352,0.576,0.38,0.27,0.256,0.176,0.179,0.136,0.143,0.152,0.126,0.144,0.13,0.154,0.139,0.151,0.134,0.142,0.153,0.166,0.156,0.147,0.137,0.141,0.129,0.142,0.148,0.132,0.128,0.18,0.124,0.159,0.183,0.154,0.147,0.128,0.135,0.141,0.131,0.175,0.141,0.114,0.14,0.139,0.172,0.162],"HORAS":["00:00","00:15","00:30","00:45","01:00","01:15","01:30","01:45","02:00","02:15","02:30","02:45","03:00","03:15","03:30","03:45","04:00","04:15","04:30","04:45","05:00","05:15","05:30","05:45","06:00","06:15","06:30","06:45","07:00","07:15","07:30","07:45","08:00","08:15","08:30","08:45","09:00","09:15","09:30","09:45","10:00","10:15","10:30","10:45","11:00","11:15","11:30","11:45","12:00","12:15","12:30","12:45","13:00","13:15","13:30","13:45","14:00","14:15","14:30","14:45","15:00","15:15","15:30","15:45","16:00","16:15","16:30","16:45","17:00","17:15","17:30","17:45","18:00","18:15","18:30","18:45"]},"Particulares":{"SUMOK":709540,"SUMKO":534,"OK":[5794,5284,4816,3580,3018,2283,2006,1486,1186,1311,918,794,607,677,671,600,412,584,454,506,457,672,665,649,932,894,1412,1727,2158,3063,4326,5923,7038,10129,13647,14923,15905,19339,21463,22762,21936,22069,21976,21072,19951,19413,19256,13127,12318,18637,17980,18297,17357,16708,16401,15354,14515,12789,11771,10628,11232,10458,11007,11007,11753,11383,11922,11604,11120,10776,11697,11471,11463,12479,11531,12011],"KO":[7,8,3,1,7,4,3,1,2,4,2,1,3,0,3,0,0,0,1,1,0,0,2,0,0,0,0,0,0,4,1,5,4,5,7,6,5,5,11,12,17,14,12,13,20,13,12,9,8,21,13,12,15,17,7,13,11,6,9,9,5,12,11,8,10,8,13,8,8,11,7,8,13,20,11,12],"RT":[0.197,0.241,0.204,0.205,0.247,0.241,0.315,0.302,0.178,0.433,0.505,0.181,0.191,0.183,0.228,0.226,0.219,0.326,0.337,0.535,0.273,0.229,0.267,0.218,0.223,0.202,0.219,0.212,0.241,0.191,0.187,0.169,0.2,0.152,0.158,0.171,0.14,0.159,0.149,0.143,0.156,0.146,0.145,0.137,0.141,0.159,0.142,0.158,0.149,0.136,0.133,0.124,0.16,0.145,0.141,0.139,0.143,0.149,0.126,0.132,0.163,0.192,0.181,0.172,0.186,0.147,0.132,0.167,0.138,0.18,0.153,0.146,0.143,0.166,0.142,0.144],"HORAS":["00:00","00:15","00:30","00:45","01:00","01:15","01:30","01:45","02:00","02:15","02:30","02:45","03:00","03:15","03:30","03:45","04:00","04:15","04:30","04:45","05:00","05:15","05:30","05:45","06:00","06:15","06:30","06:45","07:00","07:15","07:30","07:45","08:00","08:15","08:30","08:45","09:00","09:15","09:30","09:45","10:00","10:15","10:30","10:45","11:00","11:15","11:30","11:45","12:00","12:15","12:30","12:45","13:00","13:15","13:30","13:45","14:00","14:15","14:30","14:45","15:00","15:15","15:30","15:45","16:00","16:15","16:30","16:45","17:00","17:15","17:30","17:45","18:00","18:15","18:30","18:45"]},"Particulares BKS3":{"SUMOK":799461,"SUMKO":731,"OK":[6917,6108,5726,4223,3433,2683,2391,1693,1304,1253,921,800,688,693,715,634,493,505,426,418,446,743,735,691,1073,984,1672,1881,2260,3230,4607,6421,7692,11239,14628,16550,18563,20975,23237,25076,24469,24579,24123,23419,22116,21400,21976,14099,13843,21162,20687,21039,19535,18668,18566,17750,16300,14561,13380,12424,12500,11909,12463,12460,13241,12829,13668,13038,12602,12539,13516,13739,13601,14415,13847,14271],"KO":[10,6,8,2,2,2,2,7,1,1,0,0,4,0,0,1,0,0,1,0,0,0,0,0,0,0,5,5,3,6,4,8,6,7,7,7,10,14,19,16,17,16,12,18,17,28,23,15,18,18,28,21,23,19,13,11,16,9,15,11,17,10,8,15,23,17,15,8,7,13,15,12,10,18,18,13],"RT":[0.152,0.197,0.156,0.153,0.151,0.199,0.201,0.144,0.149,0.198,0.176,0.34,0.445,0.346,0.406,0.522,0.505,0.405,0.458,0.363,0.297,0.349,0.345,0.216,0.218,0.193,0.2,0.202,0.261,0.525,0.225,0.266,0.17,0.153,0.146,0.148,0.148,0.15,0.154,0.151,0.152,0.155,0.151,0.152,0.142,0.147,0.143,0.142,0.143,0.152,0.148,0.148,0.147,0.151,0.149,0.147,0.141,0.141,0.14,0.144,0.138,0.152,0.141,0.145,0.142,0.144,0.136,0.135,0.136,0.138,0.14,0.144,0.138,0.143,0.143,0.143],"HORAS":["00:00","00:15","00:30","00:45","01:00","01:15","01:30","01:45","02:00","02:15","02:30","02:45","03:00","03:15","03:30","03:45","04:00","04:15","04:30","04:45","05:00","05:15","05:30","05:45","06:00","06:15","06:30","06:45","07:00","07:15","07:30","07:45","08:00","08:15","08:30","08:45","09:00","09:15","09:30","09:45","10:00","10:15","10:30","10:45","11:00","11:15","11:30","11:45","12:00","12:15","12:30","12:45","13:00","13:15","13:30","13:45","14:00","14:15","14:30","14:45","15:00","15:15","15:30","15:45","16:00","16:15","16:30","16:45","17:00","17:15","17:30","17:45","18:00","18:15","18:30","18:45"]},"Empresas":{"SUMOK":183051,"SUMKO":658,"OK":[405,389,293,222,254,175,150,182,129,85,78,96,71,85,78,70,70,77,121,77,74,76,102,94,138,149,202,205,371,392,662,958,1269,2478,3425,4178,4458,5982,6565,6905,6723,6242,5983,5989,6005,5467,5452,3187,3855,6037,4980,5874,5682,5283,5166,4975,3949,3239,2753,2354,1884,1819,2065,2305,2645,2640,2954,2835,3068,3017,3068,2997,2682,2849,2599,2639],"KO":[5,0,1,0,6,1,0,1,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,1,0,3,0,0,0,1,5,7,12,9,13,9,15,21,22,22,21,17,24,13,17,20,13,17,23,21,13,22,10,13,19,15,6,11,9,8,5,9,7,21,19,9,5,14,27,7,18,10,13,11,15],"RT":[0.145,0.43,0.128,0.141,0.13,0.138,0.087,0.105,0.093,0.219,0.073,0.203,0.158,0.117,0.178,0.109,0.247,0.259,0.472,0.261,0.375,0.159,0.163,0.21,0.252,0.201,0.222,0.707,0.72,0.303,0.341,0.46,0.195,0.132,0.11,0.102,0.104,0.116,0.121,0.102,0.122,0.128,0.131,0.129,0.105,0.102,0.111,0.111,0.11,0.12,0.101,0.112,0.108,0.106,0.112,0.098,0.105,0.141,0.113,0.096,0.089,0.099,0.114,0.12,0.105,0.112,0.1,0.093,0.099,0.138,0.103,0.095,0.108,0.106,0.112,0.098],"HORAS":["00:00","00:15","00:30","00:45","01:00","01:15","01:30","01:45","02:00","02:15","02:30","02:45","03:00","03:15","03:30","03:45","04:00","04:15","04:30","04:45","05:00","05:15","05:30","05:45","06:00","06:15","06:30","06:45","07:00","07:15","07:30","07:45","08:00","08:15","08:30","08:45","09:00","09:15","09:30","09:45","10:00","10:15","10:30","10:45","11:00","11:15","11:30","11:45","12:00","12:15","12:30","12:45","13:00","13:15","13:30","13:45","14:00","14:15","14:30","14:45","15:00","15:15","15:30","15:45","16:00","16:15","16:30","16:45","17:00","17:15","17:30","17:45","18:00","18:15","18:30","18:45"]},"Juzgados":{"SUMOK":333138,"SUMKO":102,"OK":[87,59,33,49,59,73,45,63,67,39,46,31,41,58,21,53,32,31,45,30,41,37,21,68,44,138,211,174,47,62,110,393,710,1359,2868,3914,5416,7705,9541,10509,11443,11403,11296,11986,12718,13056,12457,7840,8102,12545,14057,14422,13735,14547,14024,14292,13172,14054,12174,9538,8052,5539,4256,3502,2772,2498,2164,1823,1420,1154,1533,1671,1602,1420,1399,1142],"KO":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,2,0,7,12,13,13,1,2,6,4,3,13,1,8,4,2,0,0,0,1,1,4,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0],"RT":[0.304,0.211,0.108,0.096,0.119,0.101,0.071,0.088,0.085,0.146,0.098,0.093,0.141,0.087,0.082,0.134,0.488,0.141,0.294,0.413,0.116,0.109,0.091,0.191,0.082,0.142,0.104,0.086,0.088,0.149,0.142,0.15,0.146,0.143,0.113,0.114,0.113,0.11,0.11,0.113,0.15,0.176,0.17,0.178,0.118,0.123,0.12,0.129,0.135,0.162,0.111,0.12,0.13,0.111,0.104,0.107,0.105,0.105,0.104,0.102,0.102,0.107,0.097,0.1,0.093,0.112,0.083,0.111,0.086,0.104,0.105,0.114,0.118,0.095,0.115,0.126],"HORAS":["00:00","00:15","00:30","00:45","01:00","01:15","01:30","01:45","02:00","02:15","02:30","02:45","03:00","03:15","03:30","03:45","04:00","04:15","04:30","04:45","05:00","05:15","05:30","05:45","06:00","06:15","06:30","06:45","07:00","07:15","07:30","07:45","08:00","08:15","08:30","08:45","09:00","09:15","09:30","09:45","10:00","10:15","10:30","10:45","11:00","11:15","11:30","11:45","12:00","12:15","12:30","12:45","13:00","13:15","13:30","13:45","14:00","14:15","14:30","14:45","15:00","15:15","15:30","15:45","16:00","16:15","16:30","16:45","17:00","17:15","17:30","17:45","18:00","18:15","18:30","18:45"]},"Broker":{"SUMOK":28224,"SUMKO":84,"OK":[71,74,68,78,32,52,39,17,16,11,16,19,1,9,21,17,6,8,1,6,2,69,41,36,59,34,49,37,16,28,42,18,57,75,70,250,413,1222,987,1045,1109,1110,919,926,873,689,876,426,399,529,576,494,531,462,716,681,527,498,475,386,541,619,451,656,608,831,734,791,715,794,1134,1060,334,242,175,225],"KO":[2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,1,0,0,0,0,0,0,0,0,0,1,0,0,1,1,2,9,5,0,2,5,0,1,0,0,4,4,2,1,1,5,1,2,3,0,3,3,1,1,0,3,5,2,3,2,1,0,0,0,3,0],"RT":[0.293,0.716,9.363,0.348,0.363,0.272,0.262,0.213,0.397,1.622,1.954,0.391,4.974,0.728,0.362,1.751,0.501,1.809,0.606,1.114,4.113,0.554,0.418,0.332,0.487,0.244,0.544,0.214,0.23,0.295,0.336,0.242,0.457,0.321,0.457,0.452,0.383,0.439,0.431,0.44,0.469,0.448,0.508,0.463,0.398,0.555,0.46,0.362,0.408,0.426,0.368,0.313,0.316,0.263,0.334,0.318,0.298,0.324,0.493,0.301,0.383,0.345,0.34,0.445,0.313,0.38,0.348,0.324,0.402,0.401,0.476,0.41,0.224,0.22,0.184,0.32],"HORAS":["00:00","00:15","00:30","00:45","01:00","01:15","01:30","01:45","02:00","02:15","02:30","02:45","03:00","03:15","03:30","03:45","04:00","04:15","04:30","04:45","05:00","05:15","05:30","05:45","06:00","06:15","06:30","06:45","07:00","07:15","07:30","07:45","08:00","08:15","08:30","08:45","09:00","09:15","09:30","09:45","10:00","10:15","10:30","10:45","11:00","11:15","11:30","11:45","12:00","12:15","12:30","12:45","13:00","13:15","13:30","13:45","14:00","14:15","14:30","14:45","15:00","15:15","15:30","15:45","16:00","16:15","16:30","16:45","17:00","17:15","17:30","17:45","18:00","18:15","18:30","18:45"]},"Sistemas Informacion":{"SUMOK":84657,"SUMKO":282,"OK":[19,19,11,0,6,3,0,6,0,0,6,0,3,3,3,0,3,3,3,3,0,6,3,0,3,6,0,10,70,263,420,872,2529,7961,7513,5454,4559,3310,2970,2652,2740,2444,1807,1600,1960,1825,1666,1188,1299,1429,1684,1668,1291,1213,1438,1347,1324,1385,1355,1377,1344,618,450,347,449,690,972,1157,1200,872,1099,972,1049,969,824,913],"KO":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,3,0,2,4,0,1,6,6,0,1,1,12,0,5,3,4,1,22,3,2,4,0,1,0,0,24,101,0,0,2,2,0,1,0,0,2,1,1,33,29,3,1],"RT":[0.437,0.251,0.219,0,2.79,0.3,0,1.323,0,0,1.056,0,1.174,0.659,4.83,0,4.483,4.197,1.64,3.05,0,2.981,0.496,0,0.408,1.601,0,0.662,1.121,1.179,0.325,0.382,0.186,0.222,0.153,0.132,0.133,0.168,0.151,0.15,0.169,0.231,0.16,0.154,0.167,0.182,0.167,0.157,0.152,0.16,0.151,0.192,0.175,0.153,0.199,0.156,0.165,0.158,0.149,0.15,0.136,0.159,0.181,0.205,0.226,0.22,0.253,0.248,0.171,0.212,0.141,0.135,0.153,0.153,0.139,0.152],"HORAS":["00:00","00:15","00:30","00:45","01:00","01:15","01:30","01:45","02:00","02:15","02:30","02:45","03:00","03:15","03:30","03:45","04:00","04:15","04:30","04:45","05:00","05:15","05:30","05:45","06:00","06:15","06:30","06:45","07:00","07:15","07:30","07:45","08:00","08:15","08:30","08:45","09:00","09:15","09:30","09:45","10:00","10:15","10:30","10:45","11:00","11:15","11:30","11:45","12:00","12:15","12:30","12:45","13:00","13:15","13:30","13:45","14:00","14:15","14:30","14:45","15:00","15:15","15:30","15:45","16:00","16:15","16:30","16:45","17:00","17:15","17:30","17:45","18:00","18:15","18:30","18:45"]},"Contact Center":{"SUMOK":158998,"SUMKO":216,"OK":[173,44,9,38,63,0,47,6,0,89,19,46,60,11,5,51,2,53,41,13,45,46,11,0,254,65,51,44,9,14,67,52,159,1421,1744,2741,3682,3418,7080,4342,3749,5957,3858,5085,4840,5412,5017,3080,3838,5769,5799,5220,4719,4668,4535,3613,4538,4016,3403,3951,3735,3245,2529,2366,2708,2495,2322,2336,2405,2249,2311,4426,2360,1910,2406,2113],"KO":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,4,2,4,2,4,4,7,4,5,15,12,8,3,5,13,14,12,3,5,7,2,9,5,3,4,0,4,6,1,0,3,8,2,1,7,4,2,3,7,4,4],"RT":[0.083,0.128,0.035,0.131,0.085,0,0.174,0.04,0,0.135,0.035,0.134,0.104,0.061,0.642,0.478,0.046,0.135,0.519,0.524,0.129,0.524,0.256,0,0.255,0.08,0.211,0.145,0.066,0.25,0.092,0.146,0.197,0.181,0.176,0.128,0.15,0.134,0.109,0.128,0.113,0.116,0.12,0.114,0.109,0.112,0.101,0.114,0.102,0.181,0.124,0.119,0.101,0.102,0.108,0.106,0.132,0.105,0.111,0.107,0.104,0.1,0.113,0.09,0.091,0.098,0.094,0.098,0.098,0.103,0.085,0.091,0.102,0.084,0.102,0.087],"HORAS":["00:00","00:15","00:30","00:45","01:00","01:15","01:30","01:45","02:00","02:15","02:30","02:45","03:00","03:15","03:30","03:45","04:00","04:15","04:30","04:45","05:00","05:15","05:30","05:45","06:00","06:15","06:30","06:45","07:00","07:15","07:30","07:45","08:00","08:15","08:30","08:45","09:00","09:15","09:30","09:45","10:00","10:15","10:30","10:45","11:00","11:15","11:30","11:45","12:00","12:15","12:30","12:45","13:00","13:15","13:30","13:45","14:00","14:15","14:30","14:45","15:00","15:15","15:30","15:45","16:00","16:15","16:30","16:45","17:00","17:15","17:30","17:45","18:00","18:15","18:30","18:45"]},"Cuentas Personales":{"SUMOK":110273,"SUMKO":73,"OK":[173,135,103,98,141,136,150,102,152,136,108,121,164,101,159,137,130,92,128,102,128,141,103,172,134,134,122,122,122,182,160,244,257,345,498,1170,1843,2355,2500,2503,2646,3045,3609,3141,3232,3720,3167,1809,2320,3944,3653,4718,3772,4470,5061,4953,5029,4992,5265,4342,4523,3027,1672,779,373,548,397,476,557,829,1028,519,420,1041,844,549],"KO":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,3,1,4,1,2,1,0,5,0,1,2,4,0,2,1,0,5,2,7,1,2,6,2,3,1,0,2,0,1,2,0,4,0,0,0,1,1,1],"RT":[0.419,0.439,0.481,2.572,0.854,0.831,0.547,0.426,0.424,1.022,1.369,0.541,0.523,0.528,0.596,0.5,0.563,1.319,2.444,0.764,2.516,0.506,0.478,0.431,0.452,0.437,0.407,0.482,0.415,0.453,0.95,0.845,0.51,1.378,0.528,0.436,0.486,0.357,0.454,0.45,0.373,0.363,0.421,0.401,0.36,0.388,0.414,0.399,0.375,0.388,0.387,0.393,0.383,0.372,0.395,0.394,0.426,0.421,0.517,0.398,0.478,0.581,0.372,0.463,0.346,0.423,0.436,0.429,0.306,0.41,0.336,0.483,0.379,0.365,0.408,0.412],"HORAS":["00:00","00:15","00:30","00:45","01:00","01:15","01:30","01:45","02:00","02:15","02:30","02:45","03:00","03:15","03:30","03:45","04:00","04:15","04:30","04:45","05:00","05:15","05:30","05:45","06:00","06:15","06:30","06:45","07:00","07:15","07:30","07:45","08:00","08:15","08:30","08:45","09:00","09:15","09:30","09:45","10:00","10:15","10:30","10:45","11:00","11:15","11:30","11:45","12:00","12:15","12:30","12:45","13:00","13:15","13:30","13:45","14:00","14:15","14:30","14:45","15:00","15:15","15:30","15:45","16:00","16:15","16:30","16:45","17:00","17:15","17:30","17:45","18:00","18:15","18:30","18:45"]},"Intervinientes":{"SUMOK":6490,"SUMKO":6,"OK":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,43,79,53,1,251,162,173,265,303,205,342,306,241,482,208,124,170,360,56,294,287,276,354,320,97,140,208,207,114,17,38,4,10,23,6,18,47,18,153,0,16,15,4],"KO":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0],"RT":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4.772,1.275,1.027,0.304,0.59,0.327,0.484,0.404,0.361,0.657,0.278,0.264,0.283,0.3,0.284,0.341,0.438,0.283,0.4,0.258,0.312,0.365,0.396,0.336,0.363,1.252,0.377,0.311,0.251,0.827,0.927,2.164,0.388,1.25,0.277,1.239,0.253,1.013,0.639,0,1.085,0.283,0.035],"HORAS":["00:00","00:15","00:30","00:45","01:00","01:15","01:30","01:45","02:00","02:15","02:30","02:45","03:00","03:15","03:30","03:45","04:00","04:15","04:30","04:45","05:00","05:15","05:30","05:45","06:00","06:15","06:30","06:45","07:00","07:15","07:30","07:45","08:00","08:15","08:30","08:45","09:00","09:15","09:30","09:45","10:00","10:15","10:30","10:45","11:00","11:15","11:30","11:45","12:00","12:15","12:30","12:45","13:00","13:15","13:30","13:45","14:00","14:15","14:30","14:45","15:00","15:15","15:30","15:45","16:00","16:15","16:30","16:45","17:00","17:15","17:30","17:45","18:00","18:15","18:30","18:45"]},"T4B":{"OK":142975,"KO":2293},"PCAS":{"OK":176,"KO":20}}
jQuery Trick
var OK = [];
$.each(value.OK, function(tipo, valor) {
OK = valor;
});
// Now if i return OK, it returns me the values... Same for OK, RT ...
My question is, I'm missing something on PHP? Because Do the trick on every $datosBS key is a code mess...
I think the problem is that "OK" for example, has subarray with the numbers, and JSON doesn't recognize it like "SUMOK" for example, which is plain number instead an array...
FULL JQUERY CODE
$.getJSON('test.php?entidad_id=2', function(data) {
$.each(data, function(key, value) {
var pies = {
name: key,
type: 'pie',
data: [],
center: [100, 80],
size: 100,
showInLegend: false,
dataLabels: {
enabled: false
}
};
var lineas = {
name: "Valores",
data: []
};
var renderId = "pie-" + key;
$('#charts').append('<div id="'+ renderId +'" class="pieChart"></div>');
lineas.data.push(value.OK); // <------ THIS ISN'T WORKING, EVEN IF I DO ([value.OK])
var OK = [];
$.each(value.OK, function(tipo, valor) {
OK = valor;
});
lineas.data.push(OK); // <----- THIS IS WORKING
pies.data.push(["OK", value.SUMOK], ["KO", value.SUMKO]);
if(key == "CAM") {
pies.data.push(["REJ_OTHERS", value.REJ_OTHERS]);
pies.data.push(["REJ_FORMAT", value.REJ_FORMAT]);
pies.data.push(["PENDING", value.PENDING]);
}
options.series.push(pies, lineas);
options.chart.renderTo = renderId;
options.title.text = key;
var chart = new Highcharts.Chart(options);
pies.data = null; lineas.data = null;
});
});
OK, data in line charts is 2 values [x, y] so the data array is like: [[x1, y1], [x2, y2]], [[1, 2, 3, 4, 5]] doesn't really make sense on a line chart.
If you just want to have the index across the x axis and the values along the y axis then you can build your array like:
$.each(value.OK, function(i, v) {
lineas.data.push([i, v]);
});
and just get rid of:
lineas.data.push(value.OK); // <------ THIS ISN'T WORKING, EVEN IF I DO ([value.OK])
var OK = [];
$.each(value.OK, function(tipo, valor) {
OK = valor;
});
lineas.data.push(OK); // <----- THIS IS WORKING
But without knowing what each data point in OK corresponds to, that is the best I got.
Here is a jsFiddle of some working code.
Hope this helps!
Edit
Looks like HORAS may be the time that corrosponds to the OK element, if that is the case you could do:
$.each(value.OK, function(i, v) {
lineas.data.push([value.HORAS[i], v]);
});

Categories