summaryrefslogtreecommitdiff
path: root/templates/project/widgets/graph
diff options
context:
space:
mode:
Diffstat (limited to 'templates/project/widgets/graph')
-rw-r--r--templates/project/widgets/graph/graph.coffee26
-rw-r--r--templates/project/widgets/graph/graph.html5
-rw-r--r--templates/project/widgets/graph/graph.scss51
3 files changed, 82 insertions, 0 deletions
diff --git a/templates/project/widgets/graph/graph.coffee b/templates/project/widgets/graph/graph.coffee
new file mode 100644
index 0000000..3a149db
--- /dev/null
+++ b/templates/project/widgets/graph/graph.coffee
@@ -0,0 +1,26 @@
+class Dashing.Graph extends Dashing.Widget
+
+ @accessor 'current', ->
+ points = @get('points')
+ if points
+ points[points.length - 1].y
+
+ ready: ->
+ @graph = new Rickshaw.Graph(
+ element: @node
+ width: $(@node).parent().width()
+ series: [
+ {
+ color: "#fff",
+ data: [{ x: 0, y: 0}]
+ }
+ ]
+ )
+ x_axis = new Rickshaw.Graph.Axis.Time(graph: @graph)
+ @graph.render()
+
+ onData: (data) ->
+ super
+ if @graph
+ @graph.series[0].data = data.points
+ @graph.render()
diff --git a/templates/project/widgets/graph/graph.html b/templates/project/widgets/graph/graph.html
new file mode 100644
index 0000000..8680efb
--- /dev/null
+++ b/templates/project/widgets/graph/graph.html
@@ -0,0 +1,5 @@
+<h1 class="title" data-bind="title"></h1>
+
+<h2 class="value" data-bind="current | prettyNumber"></h2>
+
+<p class="text-moreinfo" data-bind="moreinfo"></p> \ No newline at end of file
diff --git a/templates/project/widgets/graph/graph.scss b/templates/project/widgets/graph/graph.scss
new file mode 100644
index 0000000..f2a1e21
--- /dev/null
+++ b/templates/project/widgets/graph/graph.scss
@@ -0,0 +1,51 @@
+// ----------------------------------------------------------------------------
+// Sass declarations
+// ----------------------------------------------------------------------------
+$background-color: #2e864f;
+$value-color: #fff;
+
+$title-color: lighten($background-color, 75%);
+$moreinfo-color: lighten($background-color, 45%);
+
+$graph_color: lighten($background-color, 75%);
+
+// ----------------------------------------------------------------------------
+// Widget-graph styles
+// ----------------------------------------------------------------------------
+.widget-graph {
+
+ background-color: $background-color;
+ position: relative;
+
+ svg {
+ color: $graph_color;
+ opacity: 0.4;
+ fill-opacity: 0.4;
+ position: absolute;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ }
+
+ .title, .value {
+ position: relative;
+ z-index: 99;
+ }
+
+ .title {
+ color: $title-color;
+ }
+
+ .text-moreinfo {
+ color: $moreinfo-color;
+ font-weight: 600;
+ font-size: 20px;
+ margin-top: 0;
+ }
+
+ .x_tick {
+ position: absolute;
+ bottom: 0;
+ }
+
+} \ No newline at end of file