gottfrois / dashing-rails

The exceptionally handsome dashboard framework for Rails.
MIT License
1.45k stars 149 forks source link

hover detail doesn't work. #77

Open veetase opened 9 years ago

veetase commented 9 years ago

my code is as blew.

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: 'line'
      series: [
        {
        color: 'steelblue',
        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')
    hoverDetail = new Rickshaw.Graph.HoverDetail(graph: @graph)
    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()
veetase commented 9 years ago

The line is shown as expected, but hovering on it doesn't show anything.

gottfrois commented 9 years ago

I've updated Rickshaw library to the latest version in 2.4.4, can you try it out?

veetase commented 9 years ago

OK, thanks 2015年7月11日 下午10:22于 "Pierre-Louis Gottfrois" notifications@github.com写道:

I've updated Rickshaw library to the latest version in 2.4.4, can you try it out?

— Reply to this email directly or view it on GitHub https://github.com/gottfrois/dashing-rails/issues/77#issuecomment-120625624 .