Sha256: 959f4867be9a839c63fbadf7cfa28e8c1b164ddd8a6f626d7cebab07d31f5a65

Contents?: true

Size: 1.13 KB

Versions: 23

Compression:

Stored size: 1.13 KB

Contents

class MyDashboard.Graph extends MyDashboard.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 = (MyDashboard.widget_base_dimensions[0] * container.data("sizex")) + MyDashboard.widget_margins[0] * 2 * (container.data("sizex") - 1)
    height = (MyDashboard.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

23 entries across 23 versions & 1 rubygems

Version Path
my_dashboard-0.8.6 vendor/assets/javascripts/my_dashboard/default_widgets/graph.coffee
my_dashboard-0.8.5 vendor/assets/javascripts/my_dashboard/default_widgets/graph.coffee
my_dashboard-0.8.4 vendor/assets/javascripts/my_dashboard/default_widgets/graph.coffee
my_dashboard-0.8.3 vendor/assets/javascripts/my_dashboard/default_widgets/graph.coffee
my_dashboard-0.8.1 vendor/assets/javascripts/my_dashboard/default_widgets/graph.coffee
my_dashboard-0.8.0 vendor/assets/javascripts/my_dashboard/default_widgets/graph.coffee
my_dashboard-0.7.2 vendor/assets/javascripts/my_dashboard/default_widgets/graph.coffee
my_dashboard-0.7.1 vendor/assets/javascripts/my_dashboard/default_widgets/graph.coffee
my_dashboard-0.7.0 vendor/assets/javascripts/my_dashboard/default_widgets/graph.coffee
my_dashboard-0.6.0 vendor/assets/javascripts/my_dashboard/default_widgets/graph.coffee
my_dashboard-0.5.10 vendor/assets/javascripts/my_dashboard/default_widgets/graph.coffee
my_dashboard-0.5.9 vendor/assets/javascripts/my_dashboard/default_widgets/graph.coffee
my_dashboard-0.5.8 vendor/assets/javascripts/my_dashboard/default_widgets/graph.coffee
my_dashboard-0.5.7 vendor/assets/javascripts/my_dashboard/default_widgets/graph.coffee
my_dashboard-0.5.6 vendor/assets/javascripts/my_dashboard/default_widgets/graph.coffee
my_dashboard-0.5.5 vendor/assets/javascripts/my_dashboard/default_widgets/graph.coffee
my_dashboard-0.5.4 vendor/assets/javascripts/my_dashboard/default_widgets/graph.coffee
my_dashboard-0.5.3 vendor/assets/javascripts/my_dashboard/default_widgets/graph.coffee
my_dashboard-0.5.2 vendor/assets/javascripts/my_dashboard/default_widgets/graph.coffee
my_dashboard-0.5.1 vendor/assets/javascripts/my_dashboard/default_widgets/graph.coffee