vendor/assets/javascripts/dashing/default_widgets/graph.coffee in dashing-rails-2.3.2 vs vendor/assets/javascripts/dashing/default_widgets/graph.coffee in dashing-rails-2.4.0
- old
+ new
@@ -4,17 +4,19 @@
return @get('displayedValue') if @get('displayedValue')
points = @get('points')
if points
points[points.length - 1].y
- ready: ->
- container = $(@node).parent()
+ loadNode: (_node) ->
+ node = super(_node)
+
+ 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
+ element: node
width: width
height: height
renderer: @get("graphtype")
series: [
{
@@ -27,9 +29,11 @@
@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()
+
+ return node
onData: (data) ->
if @graph
@graph.series[0].data = data.points
@graph.render()