diff options
Diffstat (limited to 'templates/project/widgets/graph/graph.coffee')
-rw-r--r-- | templates/project/widgets/graph/graph.coffee | 26 |
1 files changed, 26 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() |