Sha256: 0bac9d4253b4298259fc75baf6b54f2fda4884619388b6ad61f7a1598c1d5180

Contents?: true

Size: 1.01 KB

Versions: 13

Compression:

Stored size: 1.01 KB

Contents

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: width
      height: height
      series: [
        {
        color: "#fff",
        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) ->
    if @graph
      @graph.series[0].data = data.points
      @graph.render()

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
dashing-rails-1.0.2 app/views/dashing/default_widgets/graph/graph.coffee
dashing-rails-1.0.1 app/views/dashing/default_widgets/graph/graph.coffee
dashing-rails-1.0.0 app/views/dashing/default_widgets/graph/graph.coffee
dashing-1.2.0 templates/project/widgets/graph/graph.coffee
dashing-1.1.0 templates/project/widgets/graph/graph.coffee
dashing-1.0.6 templates/project/widgets/graph/graph.coffee
dashing-1.0.5 templates/project/widgets/graph/graph.coffee
dashing-1.0.4 templates/project/widgets/graph/graph.coffee
dashing-1.0.3 templates/project/widgets/graph/graph.coffee
dashing-1.0.2 templates/project/widgets/graph/graph.coffee
dashing-1.0.1 templates/project/widgets/graph/graph.coffee
dashing-1.0 templates/project/widgets/graph/graph.coffee
dashing-0.1.2 templates/project/widgets/graph/graph.coffee