Package org.thechiselgroup.choosel.protovis.client.jsutil

Examples of org.thechiselgroup.choosel.protovis.client.jsutil.JsStringFunction


            }
        }).layer().add(PV.Area);

        /* Y-axis and ticks. */
        vis.add(PV.Rule).data(y.ticks(3)).bottom(y)
                .strokeStyle(new JsStringFunction() {
                    public String f(JsArgs args) {
                        double d = args.getDouble(0);
                        return d != 0 ? "rgba(128,128,128,.2)" : "#000";
                    }
                }).anchor(LEFT).add(PV.Label).text(y.tickFormat());
View Full Code Here


                }).visible(new JsBooleanFunction() {
                    public boolean f(JsArgs args) {
                        PVDomNode d = args.getObject();
                        return d.parentNode() != null;
                    }
                }).title(new JsStringFunction() {
                    public String f(JsArgs args) {
                        PVDomNode d = args.getObject();
                        return d.nodeName() + ": "
                                + format.format(d.nodeValueDouble());
                    }
                }).anchor(CENTER).add(PV.Label).text(new JsStringFunction() {
                    public String f(JsArgs args) {
                        PVDomNode d = args.getObject();
                        ClassData nodeObject = d.nodeObject();
                        return nodeObject.className.substring(0, Math.min(
                                ((int) Math.sqrt(d.nodeValueDouble())) >> 4,
View Full Code Here

        PVPanel vis = getPVPanel().width(w).height(h).bottom(20).left(20)
                .right(10).top(5);

        /* Y-axis and ticks. */
        vis.add(PV.Rule).data(y.ticks()).bottom(y)
                .strokeStyle(new JsStringFunction() {
                    public String f(JsArgs args) {
                        double d = args.getDouble(0);
                        return d != 0 ? "#eee" : "#000";
                    }
                }).anchor(LEFT).add(PV.Label).visible(new JsBooleanFunction() {
                    public boolean f(JsArgs args) {
                        double d = args.getDouble(0);
                        return d > 0 && d < 1;
                    }
                }).text(y.tickFormat());

        /* X-axis and ticks. */
        vis.add(PV.Rule).data(x.ticks()).left(x)
                .strokeStyle(new JsStringFunction() {
                    public String f(JsArgs args) {
                        double d = args.getDouble(0);
                        return d != 0 ? "#eee" : "#000";
                    }
                }).anchor(BOTTOM).add(PV.Label)
                .visible(new JsBooleanFunction() {
                    public boolean f(JsArgs args) {
                        double d = args.getDouble(0);
                        return d > 0 && d < 100;
                    }
                }).text(x.tickFormat());

        /* The dot plot! */
        vis.add(PV.Panel).data(data).add(PV.Dot).left(new JsDoubleFunction() {
            public double f(JsArgs args) {
                Triple d = args.getObject();
                return x.fd(d.x);
            }
        }).bottom(new JsDoubleFunction() {
            public double f(JsArgs args) {
                Triple d = args.getObject();
                return y.fd(d.y);
            }
        }).strokeStyle(new JsFunction<PVColor>() {
            public PVColor f(JsArgs args) {
                Triple d = args.getObject();
                return c.fcolor(d.z);
            }
        }).fillStyle(new JsFunction<PVColor>() {
            public PVColor f(JsArgs args) {
                Triple d = args.getObject();
                return c.fcolor(d.z).alpha(0.2d);
            }
        }).size(new JsDoubleFunction() {
            public double f(JsArgs args) {
                Triple d = args.getObject();
                return d.z;
            }
        }).title(new JsStringFunction() {
            public String f(JsArgs args) {
                Triple d = args.getObject();
                return JsUtils.toFixed(d.z, 1);
            }
        });
View Full Code Here

        }).strokeStyle(new JsFunction<PVColor>() {
            public PVColor f(JsArgs args) {
                PVDot _this = args.getThis();
                return _this.fillStyle().darker();
            }
        }).lineWidth(1).title(new JsStringFunction() {
            public String f(JsArgs args) {
                PVNode d = args.getObject();
                return d.nodeName();
            }
        }).event(PV.Event.MOUSEDOWN, PV.Behavior.drag())
View Full Code Here

                }).links(PV.Layout.HierarchyLinks());

        layout.link().add(PV.Line);
        layout.node()
                .add(PV.Dot)
                .title(new JsStringFunction() {
                    public String f(JsArgs args) {
                        PVDomNode d = args.getObject();
                        return d.nodeName();
                    }
                })
                .size(new JsDoubleFunction() {
                    public double f(JsArgs args) {
                        PVDomNode d = args.getObject();
                        return d.hasNodeValue() ? Math.max(
                                d.nodeValueInt() / 100, 10) : 10;
                    }
                })
                .fillStyle(new JsStringFunction() {
                    public String f(JsArgs args) {
                        PVDomNode n = args.getObject();
                        return n.toggled() ? "#1f77b4"
                                : (n.firstChild() != null ? "#aec7e8"
                                        : "#ff7f0e");
View Full Code Here

                    public boolean f(JsArgs args) {
                        PVLabel _this = args.getThis();
                        return _this.parent().index() == 0
                                && _this.index() % 3 == 0;
                    }
                }).textBaseline(TOP).textMargin(5).text(new JsStringFunction() {
                    public String f(JsArgs args) {
                        CrimeanWarData d = args.getObject();
                        return format.format(d.getDate());
                    }
                });

        vis.add(PV.Rule).data(y.ticks(5)).bottom(y)
                .strokeStyle(new JsStringFunction() {
                    public String f(JsArgs args) {
                        double d = args.getDouble();
                        return d != 0 ? "rgba(255, 255, 255, .7)" : "black";
                    }
                }).anchor(RIGHT).add(PV.Label).textMargin(6);
View Full Code Here

                    }
                });

        /* The value label. */
        bar.anchor(RIGHT).add(PV.Label).textStyle("white")
                .text(new JsStringFunction() {
                    public String f(JsArgs args) {
                        double d = args.getDouble();
                        return JsUtils.toFixed(d, 1);
                    }
                });

        /* The variable label. */
        bar.anchor(LEFT).add(PV.Label).textMargin(5).textAlign(RIGHT)
                .text(new JsStringFunction() {
                    public String f(JsArgs args) {
                        PVMark _this = args.getThis();
                        return "ABCDEFGHIJK".substring(_this.index(),
                                _this.index() + 1);
                    }
                });

        /* X-axis ticks. */
        vis.add(PV.Rule).data(x.ticks(5)).left(x)
                .strokeStyle(new JsStringFunction() {
                    public String f(JsArgs args) {
                        double d = args.getDouble();
                        return d != 0 ? "rgba(255,255,255,.3)" : "#000";
                    }
                }).add(PV.Rule).bottom(0).height(5).strokeStyle("#000")
View Full Code Here

                .add(PV.Label).visible(new JsBooleanFunction() {
                    public boolean f(JsArgs args) {
                        PVMark _this = args.getThis();
                        return _this.index() % 2 == 0;
                    }
                }).text(new JsStringFunction() {
                    public String f(JsArgs args) {
                        int s = args.getInt();
                        return s + (s != 0 ? "" : " shillings");
                    }
                });

        /* X-axis. */
        vis.add(PV.Rule).data(PV.range(1560, 1830, 10)).bottom(0).left(x)
                .height(-4).add(PV.Rule).data(PV.range(1600, 1850, 50))
                .bottom(0).height(h).strokeStyle("rgba(0, 0, 0, .2)")
                .anchor(BOTTOM).add(PV.Label).textMargin(8);

        /* Monarchs. */
        vis.add(PV.Bar).data(monarch).height(5).top(new JsDoubleFunction() {
            public double f(JsArgs args) {
                PVMark _this = args.getThis();
                Monarch d = args.getObject();
                return (!d.commonwealth && (_this.index() % 2 == 1)) ? 15 : 10;
            }
        }).fillStyle(new JsStringFunction() {
            public String f(JsArgs args) {
                Monarch d = args.getObject();
                return d.commonwealth ? null : "#000";
            }
        }).strokeStyle("#000").left(new JsDoubleFunction() {
            public double f(JsArgs args) {
                Monarch d = args.getObject();
                return x.fd(d.start);
            }
        }).width(new JsDoubleFunction() {
            public double f(JsArgs args) {
                Monarch d = args.getObject();
                return x.fd(d.end) - x.fd(d.start);
            }
        }).anchor(CENTER).add(PV.Label).textBaseline(TOP).textMargin(6)
                .font("italic 10px serif").text(new JsStringFunction() {
                    public String f(JsArgs args) {
                        Monarch d = args.getObject();
                        return d.name;
                    }
                });
View Full Code Here

        PVPanel vis = getPVPanel().width(w).height(h).bottom(20).left(20)
                .right(10).top(5);

        /* Y-axis and ticks. */
        vis.add(PV.Rule).data(y.ticks(5)).bottom(y)
                .strokeStyle(new JsStringFunction() {
                    public String f(JsArgs args) {
                        double d = args.getDouble();
                        return d != 0 ? "#eee" : "#000";
                    }
                }).anchor(LEFT).add(PV.Label).text(y.tickFormat());
View Full Code Here

                .strokeStyle("#000").anchor(BOTTOM).add(PV.Label)
                .text(x.tickFormat());

        /* Y-axis ticks. */
        vis.add(PV.Rule).data(y.ticks(5)).bottom(y)
                .strokeStyle(new JsStringFunction() {
                    public String f(JsArgs args) {
                        double d = args.getDouble(0);
                        return d != 0 ? "#eee" : "#000";
                    }
                }).anchor(LEFT).add(PV.Label).text(y.tickFormat());
View Full Code Here

TOP

Related Classes of org.thechiselgroup.choosel.protovis.client.jsutil.JsStringFunction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.