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 2017/10/22 18:13:48 UTC
[kibble] 02/03: if a chart has distinguishable categories,
enable toggling 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 311e13df111b4a90821afc81f78c7bfbe557e425
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Sun Oct 22 20:13:29 2017 +0200
if a chart has distinguishable categories, enable toggling it
---
ui/js/coffee/charts_wrapper.coffee | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/ui/js/coffee/charts_wrapper.coffee b/ui/js/coffee/charts_wrapper.coffee
index 84f1775..cc929b7 100644
--- a/ui/js/coffee/charts_wrapper.coffee
+++ b/ui/js/coffee/charts_wrapper.coffee
@@ -297,5 +297,33 @@ class Chart
if type == 'relationship'
[@chartobj, @config] = charts_linked(@chartdiv, data.nodes, data.links, options)
+ # If this data source has distinguishable categories
+ # show a checkbox to toggle it.
+ if data.distinguishable
+ id = Math.floor(Math.random() * 987654321).toString(16)
+ chk = document.createElement('input')
+ chk.setAttribute("type", "checkbox")
+ chk.setAttribute("id", id)
+ chk.style.marginLeft = '10px'
+ if globArgs.distinguish and globArgs.distinguish == 'true'
+ chk.checked = true
+ chk.addEventListener("change", () ->
+ distinguish = null
+ if this.checked
+ distinguish = 'true'
+ globArgs['distinguish'] = 'true'
+
+ updateWidgets('line', null, { distinguish: distinguish })
+ )
+ @main.inject(mk('br'))
+ @main.inject(chk)
+ label = document.createElement('label')
+ label.setAttribute("for", id)
+ label.setAttribute("title", "Check this box to distinguish between sub-categories in this chart")
+ chk.setAttribute("title", "Check this box to distinguish between sub-categories in this chart")
+ label.style.paddingLeft = '5px'
+ label.appendChild(document.createTextNode('Toggle category breakdown'))
+ @main.inject(label)
+
return @main
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
"commits@kibble.apache.org" <co...@kibble.apache.org>.