Open alexminnaar opened 10 years ago
I was able to successfully implement this mulit-graph chart https://gist.github.com/swilcox/6695849
However, I tried to modify it for 3 data series and it did not work. The new mgraph.coffee file looked like
class Dashing.Mgraph extends Dashing.Widget
@accessor 'current', -> return @get('displayedValue') if @get('displayedValue') points = @get('points') if points points[0][points[0].length - 1].y + ' / ' + points[1][points[1].length - 1].y
ready: -> container = $(@node).parent()
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: 'area' stroke: false series: [ { color: "#fff", data: [{x:0, y:0}] }, { color: "#222", data: [{x:0, y:0}] }, { color: "#333", 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.renderer.unstack = true @graph.render()
onData: (data) -> if @graph @graph.series[0].data = data.points[0] @graph.series[1].data = data.points[1] @graph.render()
however, when I ran dashing, nothing rendered (including all of my other widgets). Only a blank screen appeared. Can someone tell me how to fix this?
@alexminnaar
You probably forgot to add
@graph.series[2].data = data.points[2]
just before graph rendering
I was able to successfully implement this mulit-graph chart https://gist.github.com/swilcox/6695849
However, I tried to modify it for 3 data series and it did not work. The new mgraph.coffee file looked like
class Dashing.Mgraph extends Dashing.Widget
@accessor 'current', -> return @get('displayedValue') if @get('displayedValue') points = @get('points') if points points[0][points[0].length - 1].y + ' / ' + points[1][points[1].length - 1].y
ready: -> container = $(@node).parent()
Gross hacks. Let's fix this.
onData: (data) -> if @graph @graph.series[0].data = data.points[0] @graph.series[1].data = data.points[1] @graph.render()
however, when I ran dashing, nothing rendered (including all of my other widgets). Only a blank screen appeared. Can someone tell me how to fix this?