diff options
author | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2015-12-12 15:13:23 +0200 |
---|---|---|
committer | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2015-12-12 15:13:23 +0200 |
commit | f20882de434d05a662acca4b38385c34d47c06fc (patch) | |
tree | 1a39182b64ef2991eaf064666b38cb96fd5693ff /src | |
parent | 286b7d218d019de87a6e021935491fe149be9c18 (diff) |
made all charts update the legend on chart update; added easy-pie-chart (not active yet); fixed javascript == to ===; added nanoscroller (not active yet); fixed legend re-generation
Diffstat (limited to 'src')
-rwxr-xr-x | src/rrd2json.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/rrd2json.c b/src/rrd2json.c index bbf132b2c3..64a39838a3 100755 --- a/src/rrd2json.c +++ b/src/rrd2json.c @@ -495,6 +495,45 @@ void rrdr_json_wrapper_begin(RRDR *r, BUFFER *wb, uint32_t format, uint32_t opti i++; } buffer_sprintf(wb, "],\n" + " %slatest_values%s: [" + , kq, kq); + + for(c = 0, i = 0, rd = r->st->dimensions; rd ;c++, rd = rd->next) { + if(unlikely(r->od[c] & RRDR_HIDDEN)) continue; + if(unlikely((options & RRDR_OPTION_NONZERO) && !(r->od[c] & RRDR_NONZERO))) continue; + + if(i) buffer_strcat(wb, ", "); + i++; + + storage_number n = rd->values[rrdset_last_slot(r->st)]; + + if(!does_storage_number_exist(n)) + buffer_strcat(wb, "null"); + else + buffer_rrd_value(wb, unpack_storage_number(n)); + } + buffer_sprintf(wb, "],\n" + " %sresult_latest_values%s: [" + , kq, kq); + + if(rrdr_rows(r)) { + for(c = 0, i = 0, rd = r->st->dimensions; rd ;c++, rd = rd->next) { + if(unlikely(r->od[c] & RRDR_HIDDEN)) continue; + if(unlikely((options & RRDR_OPTION_NONZERO) && !(r->od[c] & RRDR_NONZERO))) continue; + + if(i) buffer_strcat(wb, ", "); + i++; + + calculated_number *cn = &r->v[ (0) * r->d ]; + uint8_t *co = &r->o[ (0) * r->d ]; + + if(co[c] & RRDR_EMPTY) + buffer_strcat(wb, "null"); + else + buffer_rrd_value(wb, cn[c]); + } + } + buffer_sprintf(wb, "],\n" " %sdimensions%s: %d,\n" " %spoints%s: %d,\n" " %sformat%s: %s" |