vl.markBar({filled:true})
.data(df)
.transform(
vl.filter('datum.weight_class !="Catch Weight" & datum.Winner==1 & datum.finish!=null'),
vl.calculate('datum.reach_cms/datum.weight_lbs').as('reach-to-weight-ratio'),
vl.calculate('datum.wins/(datum.wins + datum.losses)').as('winrate'),
vl.calculate('(datum.win_by_submission + datum.win_by_ko)/(datum.wins)').as('finish_rate'),
vl.calculate('(datum.win_by_submission)/(datum.wins)').as('sub_rate')
)
.encode(
vl.y().fieldN('weight_class').scale({domain:
['Flyweight','Bantamweight', 'Featherweight','Lightweight','Welterweight','Middleweight','Light Heavyweight','Heavyweight', 'Women\'s Strawweight','Women\'s Flyweight','Women\'s Bantamweight', 'Women\'s Featherweight']}).title('Weight Class'),
vl.x().count('finish'),
vl.color().fieldN('finish').title('Method of Victory'),
).title('Weight Class vs Method of Victory').height(500)
.render()