From 54c6a04b722663b518bf99b4d98a1c2e86ee5103 Mon Sep 17 00:00:00 2001 From: Daniel Beauchamp Date: Tue, 14 Aug 2012 05:23:57 -0400 Subject: Updated the sample project. --- templates/project/widgets/graph/graph.coffee | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 templates/project/widgets/graph/graph.coffee (limited to 'templates/project/widgets/graph/graph.coffee') 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() -- cgit v1.2.3 From b585121df5976a514c06981de73c611b8a3157d3 Mon Sep 17 00:00:00 2001 From: Daniel Beauchamp Date: Fri, 24 Aug 2012 17:58:16 -0400 Subject: Remove some lingering calls to 'super' from widgets. --- templates/project/widgets/graph/graph.coffee | 1 - 1 file changed, 1 deletion(-) (limited to 'templates/project/widgets/graph/graph.coffee') diff --git a/templates/project/widgets/graph/graph.coffee b/templates/project/widgets/graph/graph.coffee index 3a149db..8b56a87 100644 --- a/templates/project/widgets/graph/graph.coffee +++ b/templates/project/widgets/graph/graph.coffee @@ -20,7 +20,6 @@ class Dashing.Graph extends Dashing.Widget @graph.render() onData: (data) -> - super if @graph @graph.series[0].data = data.points @graph.render() -- cgit v1.2.3 From a4a4564f760bb1bcd541366186cd46488d5a569b Mon Sep 17 00:00:00 2001 From: Daniel Beauchamp Date: Tue, 30 Oct 2012 05:16:35 -0400 Subject: Added new widgets, and made them more flexible. Ready for 0.1.3! --- templates/project/widgets/graph/graph.coffee | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'templates/project/widgets/graph/graph.coffee') diff --git a/templates/project/widgets/graph/graph.coffee b/templates/project/widgets/graph/graph.coffee index 8b56a87..9b2eeec 100644 --- a/templates/project/widgets/graph/graph.coffee +++ b/templates/project/widgets/graph/graph.coffee @@ -1,22 +1,32 @@ class Dashing.Graph extends Dashing.Widget @accessor 'current', -> + return @get('displayedValue') if @get('displayedValue') points = @get('points') if points points[points.length - 1].y ready: -> + container = $(@node).parent() + # Gross hacks. Let's fix this. + width = (Dashing.widget_base_dimensions[0] * container.data("sizex")) + Dashing.widget_margins[0] * 2 * (container.data("sizex") - 1) + height = (Dashing.widget_base_dimensions[1] * container.data("sizey")) @graph = new Rickshaw.Graph( element: @node - width: $(@node).parent().width() + width: width + height: height series: [ { color: "#fff", - data: [{ x: 0, y: 0}] + data: [{x:0, y:0}] } ] ) + + @graph.series[0].data = @get('points') if @get('points') + x_axis = new Rickshaw.Graph.Axis.Time(graph: @graph) + y_axis = new Rickshaw.Graph.Axis.Y(graph: @graph, tickFormat: Rickshaw.Fixtures.Number.formatKMBT) @graph.render() onData: (data) -> -- cgit v1.2.3 From 2b715ac63dd2de5c718142822663dbded44bbecd Mon Sep 17 00:00:00 2001 From: David Underwood Date: Fri, 16 Aug 2013 20:35:32 -0400 Subject: Allow the graph type to be specified when using the graph widget --- templates/project/widgets/graph/graph.coffee | 1 + 1 file changed, 1 insertion(+) (limited to 'templates/project/widgets/graph/graph.coffee') diff --git a/templates/project/widgets/graph/graph.coffee b/templates/project/widgets/graph/graph.coffee index 9b2eeec..28ce88e 100644 --- a/templates/project/widgets/graph/graph.coffee +++ b/templates/project/widgets/graph/graph.coffee @@ -15,6 +15,7 @@ class Dashing.Graph extends Dashing.Widget element: @node width: width height: height + renderer: @get("graphtype") series: [ { color: "#fff", -- cgit v1.2.3 From e16d4741510a674baedb498fa48d4c4971bda0d9 Mon Sep 17 00:00:00 2001 From: Tyler Mauthe Date: Wed, 28 Jan 2015 21:23:08 -0700 Subject: Padding on Graph widget to avoid cropping labels Fixes #484 --- templates/project/widgets/graph/graph.coffee | 1 + 1 file changed, 1 insertion(+) (limited to 'templates/project/widgets/graph/graph.coffee') diff --git a/templates/project/widgets/graph/graph.coffee b/templates/project/widgets/graph/graph.coffee index 28ce88e..5d6b9ab 100644 --- a/templates/project/widgets/graph/graph.coffee +++ b/templates/project/widgets/graph/graph.coffee @@ -22,6 +22,7 @@ class Dashing.Graph extends Dashing.Widget data: [{x:0, y:0}] } ] + padding: {top: 0.02, left: 0.02, right: 0.02, bottom: 0.02} ) @graph.series[0].data = @get('points') if @get('points') -- cgit v1.2.3