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