this code
require 'rubyvis' vis = Rubyvis::Panel.new.width(150).height(150); vis.add(pv.Bar).data([1, 1.2, 1.7, 1.5, 0.7, 0.3]). width(20). height(lambda {|d| d * 80}). bottom(0). left(lambda {self.index * 25}) vis.render()
Returns this svg code
<svg fill="none" font-family="sans-serif" font-size="10px" height="150.0" stroke="none" stroke-width="1.5" width="150.0"> <g transform="translate(0.0,0.0)"> <rect fill="rgb(31,119,180)" height="80" width="20" y="70"/> <rect fill="rgb(31,119,180)" height="96.0" width="20" x="25" y="54.0"/> <rect fill="rgb(31,119,180)" height="136.0" width="20" x="50" y="14.0"/> <rect fill="rgb(31,119,180)" height="120.0" width="20" x="75" y="30.0"/> <rect fill="rgb(31,119,180)" height="56.0" width="20" x="100" y="94.0"/> <rect fill="rgb(31,119,180)" height="24.0" width="20" x="125" y="126.0"/> </g> </svg>
Which renders