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 2018/08/03 14:04:12 UTC

[kibble] 01/02: tweak: if we get an array instead of a hash, work around it

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 96a8514aea1872740519dacc3e4a3887727f4015
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Fri Aug 3 16:03:57 2018 +0200

    tweak: if we get an array instead of a hash, work around it
---
 ui/js/coffee/charts_linechart.coffee | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/ui/js/coffee/charts_linechart.coffee b/ui/js/coffee/charts_linechart.coffee
index 69ecb7f..3a6fe8d 100644
--- a/ui/js/coffee/charts_linechart.coffee
+++ b/ui/js/coffee/charts_linechart.coffee
@@ -80,6 +80,10 @@ charts_linechart = (obj, data, options) ->
         asDataArray = ts
     else
         for k, v of (data.counts||data.phrases)
+            # If we have an array of objects with a .count sub:
+            if isHash(v) and v.count
+              k = v.phrase||v.value
+              v = v.count
             asList.push(k)
             asTypes[k] = 'bar'
             tmpArray = [k]