Sha256: 2578bc1f01d2c1ef21803da81ddbbf831d4d7993d754ed83c084fd43cb8a6cff

Contents?: true

Size: 1.11 KB

Versions: 15

Compression:

Stored size: 1.11 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}]
        }
      ]
      padding: {top: 0.02, left: 0.02, right: 0.02, bottom: 0.02}
    )

    @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

15 entries across 15 versions & 4 rubygems

Version Path
smashing-1.1.0 templates/project/widgets/graph/graph.coffee
dashing-rails-2.6.2 vendor/assets/javascripts/dashing/default_widgets/graph.coffee
dashing-rails-2.6.1 vendor/assets/javascripts/dashing/default_widgets/graph.coffee
dashing-rails-2.6.0 vendor/assets/javascripts/dashing/default_widgets/graph.coffee
smashing-1.0.0 templates/project/widgets/graph/graph.coffee
dashing-1.3.7 templates/project/widgets/graph/graph.coffee
dashing-1.3.6 templates/project/widgets/graph/graph.coffee
dashing-rails-2.5.0 vendor/assets/javascripts/dashing/default_widgets/graph.coffee
dashing-rails-2.4.5 vendor/assets/javascripts/dashing/default_widgets/graph.coffee
dashing-rails-2.4.4 vendor/assets/javascripts/dashing/default_widgets/graph.coffee
baseboard-1.0.2 templates/project/widgets/graph/graph.coffee
baseboard-1.0.1 templates/project/widgets/graph/graph.coffee
dashing-rails-2.4.3 vendor/assets/javascripts/dashing/default_widgets/graph.coffee
dashing-rails-2.4.2 vendor/assets/javascripts/dashing/default_widgets/graph.coffee
dashing-rails-2.4.1 vendor/assets/javascripts/dashing/default_widgets/graph.coffee