ankane / vega-ruby

Interactive charts for Ruby, powered by Vega and Vega-Lite

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add instruction to include to bridgetown

topofocus opened this issue · comments

The gem works wonderful! Thanks for building it.

I just included it into a (static) Bridgetown-page.

Its worth to include the steps in the description

  • include gem 'vega' in Gemfile
  • include require 'vega' in config/initializers. No plugin needed.
  • use the instructions for rails7/esconfig and implement in frontend/javascript/config.js
  • vega-Objects can be defined in frontmatter

Example for the frontmatter-approach

~~~ruby
{ 
  layout:  :home,
  title:  'Übersicht',
  vega:  Vega.lite .data([{city: "A", sales: 28}, {city: "B", sales: 55}, {city: "C", sales: 43}])
                   .mark(type: "bar", tooltip: true)
                   .encoding( x: {field: "city", type: "nominal"},
                   y: {field: "sales", type: "quantitative"}) 
}
~~~

# title
<%=  data.vega %>

In my impression, this is the easiest way to setup an example-page.

Hey @topofocus, thanks for sharing. Bridgetown isn't officially supported, so don't want to include it in the readme, but this issue should be helpful for those who need it.

Perhaps its time to include Bridgetown into the list of supported frameworks. As of Version 1.2 its fresh air in the ruby web-universum. Its based on roda & jekyll and evolves quickly.