Sha256: 43758169f8818872225970900bf212f3a5833a7bae735bd1445a0a22483106ea

Contents?: true

Size: 1.3 KB

Versions: 57

Compression:

Stored size: 1.3 KB

Contents

- resolution = 1
- data_id = "data-" << id
- Open.write(@step.file(data_id), plot_data.to_json)
- x_label = nil unless defined? x_label
- y_label = nil unless defined? y_label

- extra = "" unless defined? extra

- url = @uri

%svg(id=id)

:ruby
  setup ||=<<-EOF
    var graph = nv.models.discreteBarChart()
        .x(function(d) { return d.label })
        .y(function(d) { return d.value })
        .staggerLabels(true)
        .showValues(true)

        graph.tooltip.enabled(true)
  EOF

  setup += "\ngraph.xAxis.axisLabel('#{x_label}')" if x_label
  setup += "\ngraph.yAxis.axisLabel('#{y_label}')" if y_label

:javascript
  

  defer(function(){

    var id = '#{id}';
    var selector = "svg#" + id
    var uri = add_parameter(rbbt.url_add_script_name('#{url}'), '_file', '#{data_id}')

    var resolution = #{resolution}
    var svg = $(selector)
    var figure = svg.parent('.figure')
    var W = figure.innerWidth()
    var H = figure.innerHeight()

    nv.addGraph({
      generate: function(){
        #{setup}

        #{extra}

        $.get(uri, function(data){
          var json = JSON.parse(data)
          console.log(json)

          d3.select(selector)
            .datum(json)
            .call(graph);
        })

        nv.utils.windowResize(graph.update);

        return graph;
      },
    })
  })




Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
rbbt-rest-1.8.92 share/views/tools/nvd3/chart.haml
rbbt-rest-1.8.91 share/views/tools/nvd3/chart.haml
rbbt-rest-1.8.90 share/views/tools/nvd3/chart.haml
rbbt-rest-1.8.89 share/views/tools/nvd3/chart.haml
rbbt-rest-1.8.88 share/views/tools/nvd3/chart.haml
rbbt-rest-1.8.87 share/views/tools/nvd3/chart.haml
rbbt-rest-1.8.86 share/views/tools/nvd3/chart.haml
rbbt-rest-1.8.85 share/views/tools/nvd3/chart.haml
rbbt-rest-1.8.84 share/views/tools/nvd3/chart.haml
rbbt-rest-1.8.83 share/views/tools/nvd3/chart.haml
rbbt-rest-1.8.82 share/views/tools/nvd3/chart.haml
rbbt-rest-1.8.81 share/views/tools/nvd3/chart.haml
rbbt-rest-1.8.80 share/views/tools/nvd3/chart.haml
rbbt-rest-1.8.79 share/views/tools/nvd3/chart.haml
rbbt-rest-1.8.78 share/views/tools/nvd3/chart.haml
rbbt-rest-1.8.77 share/views/tools/nvd3/chart.haml
rbbt-rest-1.8.76 share/views/tools/nvd3/chart.haml