You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kibble.apache.org by hu...@apache.org on 2019/06/11 18:25:46 UTC

[kibble] 01/03: follow specified sort order if any

This is an automated email from the ASF dual-hosted git repository.

humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kibble.git

commit 53fdf881686c800b3d0a4083546947313f42275c
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Tue Jun 11 20:24:52 2019 +0200

    follow specified sort order if any
---
 ui/js/coffee/charts_linechart.coffee | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/ui/js/coffee/charts_linechart.coffee b/ui/js/coffee/charts_linechart.coffee
index 3a6fe8d..441a3a2 100644
--- a/ui/js/coffee/charts_linechart.coffee
+++ b/ui/js/coffee/charts_linechart.coffee
@@ -67,8 +67,15 @@ charts_linechart = (obj, data, options) ->
                     if xts[k] == undefined
                         xts[k] = []
                     xts[k].push(v)
-
-        for key, val of xts
+        # If API specifies sort order in charts, follow it
+        keys = []
+        if data.sortOrder
+            keys = data.sortOrder
+        else
+            keys = Object.keys(xts)
+        
+        for key in keys
+            val = xts[key]
             xx = [key]
             for el in val
                 xx.push(el)
@@ -97,6 +104,7 @@ charts_linechart = (obj, data, options) ->
     config = {
         bindto: obj,
         data: {
+          order: null,
           x: if data.timeseries then 'x' else null,
           #xFormat: '%s',
           columns: asDataArray,