diff options
author | Costa Tsaousis <costa@tsaousis.gr> | 2018-10-31 22:45:02 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-31 22:45:02 +0200 |
commit | fc1544c4d76a614b210a2739cfbcfdef576099c2 (patch) | |
tree | 2c09dbb7c21d1c2202dec851401c34226a3285d1 /web/api | |
parent | 5a84c9c15cb56792924d0b12125bc3f7a319fa3a (diff) |
fixed wrong annotations given to google charts (#4535)
* fixed wrong annotations given to google charts
* added default rrdr dimension flag
Diffstat (limited to 'web/api')
-rw-r--r-- | web/api/formatters/json/json.c | 2 | ||||
-rw-r--r-- | web/api/queries/query.c | 5 | ||||
-rw-r--r-- | web/api/queries/rrdr.c | 2 | ||||
-rw-r--r-- | web/api/queries/rrdr.h | 17 |
4 files changed, 16 insertions, 10 deletions
diff --git a/web/api/formatters/json/json.c b/web/api/formatters/json/json.c index b566d38984..66b3b9c837 100644 --- a/web/api/formatters/json/json.c +++ b/web/api/formatters/json/json.c @@ -155,6 +155,8 @@ void rrdr2json(RRDR *r, BUFFER *wb, RRDR_OPTIONS options, int datatable) { // google supports one annotation per row int annotation_found = 0; for(c = 0, rd = r->st->dimensions; rd ;c++, rd = rd->next) { + if(unlikely(!(r->od[c] & RRDR_DIMENSION_SELECTED))) continue; + if(co[c] & RRDR_VALUE_RESET) { buffer_strcat(wb, overflow_annotation); annotation_found = 1; diff --git a/web/api/queries/query.c b/web/api/queries/query.c index 95ddc125e7..d03b43d3c7 100644 --- a/web/api/queries/query.c +++ b/web/api/queries/query.c @@ -871,8 +871,11 @@ RRDR *rrd2rrdr( for(rd = st->dimensions, c = 0 ; rd && c < dimensions_count ; rd = rd->next, c++) { // if we need a percentage, we need to calculate all dimensions - if(unlikely(!(options & RRDR_OPTION_PERCENTAGE) && (r->od[c] & RRDR_DIMENSION_HIDDEN))) + if(unlikely(!(options & RRDR_OPTION_PERCENTAGE) && (r->od[c] & RRDR_DIMENSION_HIDDEN))) { + if(unlikely(r->od[c] & RRDR_DIMENSION_SELECTED)) r->od[c] &= ~RRDR_DIMENSION_SELECTED; continue; + } + r->od[c] |= RRDR_DIMENSION_SELECTED; // reset the grouping for the new dimension r->internal.grouping_reset(r); diff --git a/web/api/queries/rrdr.c b/web/api/queries/rrdr.c index 2355d2ae68..e727e607e2 100644 --- a/web/api/queries/rrdr.c +++ b/web/api/queries/rrdr.c @@ -126,7 +126,7 @@ RRDR *rrdr_create(RRDSET *st, long n) if(unlikely(rrddim_flag_check(rd, RRDDIM_FLAG_HIDDEN))) r->od[c] = RRDR_DIMENSION_HIDDEN; else - r->od[c] = 0; + r->od[c] = RRDR_DIMENSION_DEFAULT; } r->group = 1; diff --git a/web/api/queries/rrdr.h b/web/api/queries/rrdr.h index c7633f0beb..4f6350389b 100644 --- a/web/api/queries/rrdr.h +++ b/web/api/queries/rrdr.h @@ -25,21 +25,22 @@ typedef enum rrdr_options { } RRDR_OPTIONS; typedef enum rrdr_value_flag { - RRDR_VALUE_NOTHING = 0x00, // no flag set - RRDR_VALUE_EMPTY = 0x01, // the value is empty - RRDR_VALUE_RESET = 0x02, // the value has been reset + RRDR_VALUE_NOTHING = 0x00, // no flag set (a good default) + RRDR_VALUE_EMPTY = 0x01, // the database value is empty + RRDR_VALUE_RESET = 0x02, // the database value is marked as reset (overflown) } RRDR_VALUE_FLAGS; typedef enum rrdr_dimension_flag { - RRDR_DIMENSION_HIDDEN = 0x04, // the dimension is hidden - RRDR_DIMENSION_NONZERO = 0x08, // the dimension non zero - RRDR_DIMENSION_SELECTED = 0x10, // the dimension is selected + RRDR_DIMENSION_DEFAULT = 0x00, + RRDR_DIMENSION_HIDDEN = 0x04, // the dimension is hidden (not to be presented to callers) + RRDR_DIMENSION_NONZERO = 0x08, // the dimension is non zero (contains non-zero values) + RRDR_DIMENSION_SELECTED = 0x10, // the dimension is selected for evaluation in this RRDR } RRDR_DIMENSION_FLAGS; // RRDR result options typedef enum rrdr_result_flags { - RRDR_RESULT_OPTION_ABSOLUTE = 0x00000001, - RRDR_RESULT_OPTION_RELATIVE = 0x00000002, + RRDR_RESULT_OPTION_ABSOLUTE = 0x00000001, // the query uses absolute time-frames (can be cached by browsers and proxies) + RRDR_RESULT_OPTION_RELATIVE = 0x00000002, // the query uses relative time-frames (should not to be cached by browsers and proxies) } RRDR_RESULT_FLAGS; typedef struct rrdresult { |