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/25 10:51:09 UTC
[kibble] 04/08: make a gauge widget
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 e3bca3c8a7c40c9c6b044fade013a81187d25833
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Wed Oct 25 12:50:09 2017 +0200
make a gauge widget
---
ui/js/coffee/charts_gauge.coffee | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/ui/js/coffee/charts_gauge.coffee b/ui/js/coffee/charts_gauge.coffee
new file mode 100644
index 0000000..868d67c
--- /dev/null
+++ b/ui/js/coffee/charts_gauge.coffee
@@ -0,0 +1,37 @@
+charts_gaugechart = (obj, data) ->
+ if data.gauge
+ data = data.gauge
+
+ config = {
+ bindto: obj,
+ data: {
+ columns: [[data.key or 'value', data.value or data]],
+ type: 'gauge'
+ },
+ gauge: {
+ min: 0,
+ max: 100
+ },
+ color: {
+ pattern: ['#FF0000', '#F97600', '#F6C600', '#60B044'],
+ threshold: {
+ values: [30, 60, 90, 100]
+ }
+ },
+ tooltip: {
+ format: {
+ value: (val) => d3.format(',')(val)
+ }
+ }
+ }
+ c = c3.generate(config)
+ return [c, config]
+
+
+gauge = (json, state) ->
+
+ lmain = new HTML('div')
+ state.widget.inject(lmain, true)
+
+ gaugeChart = new Chart(lmain, 'gauge', json)
+
--
To stop receiving notification emails like this one, please contact
"commits@kibble.apache.org" <co...@kibble.apache.org>.