Sha256: 6049835f5a0030791b22534568d9cbfbd28a7cc1c7696650e0bb4585c9d94129

Contents?: true

Size: 1.05 KB

Versions: 19

Compression:

Stored size: 1.05 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
      renderer: @get("graphtype")
      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

19 entries across 19 versions & 5 rubygems

Version Path
rtdi-1.0 templates/project/widgets/graph/graph.coffee
dashing-jruby-1.3.4.1 templates/project/widgets/graph/graph.coffee
dashing-jruby-1.3.4 templates/project/widgets/graph/graph.coffee
dashing-rails-2.3.2 vendor/assets/javascripts/dashing/default_widgets/graph.coffee
dashing-1.3.4 templates/project/widgets/graph/graph.coffee
dashing-1.3.3 templates/project/widgets/graph/graph.coffee
dashing-rails-2.3.1 vendor/assets/javascripts/dashing/default_widgets/graph.coffee
dashing-rails-2.3.0 vendor/assets/javascripts/dashing/default_widgets/graph.coffee
dashing-beanstalk-1.3.2 templates/project/widgets/graph/graph.coffee
dashing-rails-2.2.0 vendor/assets/javascripts/dashing/default_widgets/graph.coffee
dashing-1.3.2 templates/project/widgets/graph/graph.coffee
dashing-rails-2.1.1 vendor/assets/javascripts/dashing/default_widgets/graph.coffee
dashing-rails-2.1.0 vendor/assets/javascripts/dashing/default_widgets/graph.coffee
dashing-rails-2.0.2 vendor/assets/javascripts/dashing/default_widgets/graph.coffee
dashing-rails-2.0.1 vendor/assets/javascripts/dashing/default_widgets/graph.coffee
dashing-rails-2.0.0 vendor/assets/javascripts/dashing/widgets/graph.coffee
dashing-rails-1.0.3 app/views/dashing/default_widgets/graph/graph.coffee
dashing-1.3.1 templates/project/widgets/graph/graph.coffee
dashing-1.3.0 templates/project/widgets/graph/graph.coffee