public double f(JsArgs args) {
PVMark _this = args.getThis();
return _this.index() * bigAngle + bigAngle / 2
- Math.PI / 2;
}
}).fillStyle(new JsStringFunction() {
public String f(JsArgs args) {
Antibiotics d = args.getObject(0);
return gramColor.get(d.gram);
}
});
/* Antibiotics. */
bg.add(PV.Wedge).angle(smallAngle).startAngle(new JsDoubleFunction() {
public double f(JsArgs args) {
PVWedge _this = args.getThis();
return _this.proto().startAngle() + smallAngle;
}
}).outerRadius(new JsDoubleFunction() {
public double f(JsArgs args) {
Antibiotics d = args.getObject();
return radius(d.penicillin, a, b);
}
}).fillStyle(drugColor.get("Penicillin")).add(PV.Wedge)
.startAngle(new JsDoubleFunction() {
public double f(JsArgs args) {
PVWedge _this = args.getThis();
return _this.proto().startAngle() + 2 * smallAngle;
}
}).outerRadius(new JsDoubleFunction() {
public double f(JsArgs args) {
Antibiotics d = args.getObject();
return radius(d.streptomycin, a, b);
}
}).fillStyle(drugColor.get("Streptomycin")).add(PV.Wedge)
.outerRadius(new JsDoubleFunction() {
public double f(JsArgs args) {
Antibiotics d = args.getObject();
return radius(d.neomycin, a, b);
}
}).fillStyle(drugColor.get("Neomycin"));
/* Circular grid lines. */
bg.add(PV.Dot).data(PV.range(-3, 4)).fillStyle((String) null)
.strokeStyle("#eee").lineWidth(1).size(new JsDoubleFunction() {
public double f(JsArgs args) {
int i = args.getInt();
return Math.pow(radius(Math.pow(10, i), a, b), 2);
}
}).anchor(TOP).add(PV.Label).visible(new JsBooleanFunction() {
public boolean f(JsArgs args) {
int i = args.getInt();
return i < 3;
}
}).textBaseline(MIDDLE).text(new JsStringFunction() {
public String f(JsArgs args) {
int i = args.getInt();
return JsUtils.toFixed(Math.pow(10, i), (i > 0) ? 0
: -i);
}
});
/* Radial grid lines. */
bg.add(PV.Wedge).data(PV.range(antibiotics.length + 1))
.innerRadius(innerRadius - 10).outerRadius(outerRadius + 10)
.fillStyle((String) null).strokeStyle("black").angle(0);
/* Labels. */
bg.anchor(OUTER).add(PV.Label).textAlign(CENTER)
.text(new JsStringFunction() {
public String f(JsArgs args) {
Antibiotics d = args.getObject();
return d.bacteria;
}
});
/* Antibiotic legend. */
vis.add(PV.Bar).data(drugColor.keySet()).right(width / 2 + 3)
.top(new JsDoubleFunction() {
public double f(JsArgs args) {
PVMark _this = args.getThis();
return height / 2 - 28 + _this.index() * 18;
}
}).fillStyle(new JsStringFunction() {
public String f(JsArgs args) {
String d = args.getObject();
return drugColor.get(d);
}
}).width(36).height(12).anchor(RIGHT).add(PV.Label)
.textMargin(6).textAlign(LEFT);
/* Gram-stain legend. */
vis.add(PV.Dot).data(gramColor.keySet()).left(width / 2 - 20)
.bottom(new JsDoubleFunction() {
public double f(JsArgs args) {
PVMark _this = args.getThis();
return -60 + _this.index() * 18;
}
}).fillStyle(new JsStringFunction() {
public String f(JsArgs args) {
String d = args.getObject();
return gramColor.get(d);
}
}).strokeStyle((String) null).size(30).anchor(RIGHT)
.add(PV.Label).textMargin(6).textAlign(LEFT)
.text(new JsStringFunction() {
public String f(JsArgs args) {
String d = args.getObject();
return "Gram-" + d;
}
});