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

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


                return category19.fcolor(d.parentNode().nodeName());
            }
        }).strokeStyle("rgba(255,255,255,.5)").lineWidth(1).antialias(false);

        layout.label().add(PV.Label).textAngle(-Math.PI / 2)
                .visible(new JsBooleanFunction() {
                    public boolean f(JsArgs args) {
                        PVPartitionNode d = args.getObject();
                        return d.dx() > 6;
                    }
                });
View Full Code Here


                .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() {
View Full Code Here

                        PVWedge _this = args.getThis();
                        _this.innerRadius(r - 40);
                        _this.render();
                    }
                }).anchor(CENTER).add(PV.Label)
                .visible(new JsBooleanFunction() {
                    public boolean f(JsArgs args) {
                        double d = args.getDouble(0);
                        return d > .15;
                    }
                }).textAngle(0).text(new JsStringFunction() {
View Full Code Here

                        return d + "\u00b0";
                    }
                });

        /* Actual and forecast range. */
        record.add(PV.Bar).visible(new JsBooleanFunction() {
            public boolean f(JsArgs args) {
                WeatherRecord d = args.getObject();
                return d.hasActual();
            }
        }).bottom(new JsDoubleFunction() {
            public double f(JsArgs args) {
                WeatherRecord d = args.getObject();
                return d.actual.low * h;
            }
        }).height(new JsDoubleFunction() {
            public double f(JsArgs args) {
                WeatherRecord d = args.getObject();
                return (d.actual.high - d.actual.low) * h;
            }
        }).left(new JsDoubleFunction() {
            public double f(JsArgs args) {
                PVMark _this = args.getThis();
                return _this.index() * w + 3;
            }
        }).width(w - 8).fillStyle("black").add(PV.Bar)
                .visible(new JsBooleanFunction() {
                    public boolean f(JsArgs args) {
                        WeatherRecord d = args.getObject();
                        return d.hasForecast();
                    }
                }).bottom(new JsDoubleFunction() {
View Full Code Here

                        return c.fcolor(d.year);
                    }
                });

        /* A label showing the variety. */
        dot.anchor(LEFT).add(PV.Label).visible(new JsBooleanFunction() {
            public boolean f(JsArgs args) {
                PVMark _this = args.getThis();
                return _this.parent().index() == 0;
            }
        }).left(-1).text(new JsStringFunction() {
View Full Code Here

                        return result;
                    }
                }).left(panelPosition).width(size);

        /* Framed dot plots not along the diagonal. */
        PVPanel plot = cell.add(PV.Panel).visible(new JsBooleanFunction() {
            public boolean f(JsArgs args) {
                TraitPair d = args.getObject(0);
                return !d.px.equals(d.py);
            }
        }).strokeStyle("#aaa");

        /* X-axis ticks. */
        PVRule xtick = plot.add(PV.Rule)
                .data(new JsFunction<JavaScriptObject>() {
                    public JavaScriptObject f(JsArgs args) {
                        TraitPair t = args.getObject();
                        return position.get(t.px).ticks(5);
                    };
                }).left(new JsDoubleFunction() {
                    public double f(JsArgs args) {
                        double d = args.getDouble();
                        TraitPair t = args.getObject(1);
                        return position.get(t.px).fd(d);
                    };
                }).strokeStyle("#eee");

        /* Bottom label. */
        xtick.anchor(BOTTOM).add(PV.Label).visible(new JsBooleanFunction() {
            public boolean f(JsArgs args) {
                return (cell.parent().index() == traits.length - 1)
                        && (cell.index() % 2 == 0);
            }
        }).text(new JsStringFunction() {
            public String f(JsArgs args) {
                double d = args.getDouble();
                TraitPair t = args.getObject(1);
                return position.get(t.px).tickFormatDouble(d);
            };
        });

        /* Top label. */
        xtick.anchor(TOP).add(PV.Label).visible(new JsBooleanFunction() {
            public boolean f(JsArgs args) {
                return (cell.parent().index() == 0) && (cell.index() % 2 == 1);
            }
        }).text(new JsStringFunction() {
            public String f(JsArgs args) {
                double d = args.getDouble(0);
                TraitPair t = args.getObject(1);
                return position.get(t.px).tickFormatDouble(d);
            };
        });

        /* Y-axis ticks. */
        PVRule ytick = plot.add(PV.Rule)
                .data(new JsFunction<JavaScriptObject>() {
                    public JavaScriptObject f(JsArgs args) {
                        TraitPair t = args.getObject(0);
                        return position.get(t.py).ticks(5);
                    };
                }).bottom(new JsDoubleFunction() {
                    public double f(JsArgs args) {
                        double d = args.getDouble(0);
                        TraitPair t = args.getObject(1);
                        return position.get(t.py).fd(d);
                    };
                }).strokeStyle("#eee");

        /* Left label. */
        ytick.anchor(LEFT).add(PV.Label).visible(new JsBooleanFunction() {
            public boolean f(JsArgs args) {
                return (cell.index() == 0) && (cell.parent().index() % 2 == 1);
            }
        }).text(new JsStringFunction() {
            public String f(JsArgs args) {
                double d = args.getDouble(0);
                TraitPair t = args.getObject(1);
                return position.get(t.py).tickFormatDouble(d);
            };
        });

        /* Right label. */
        ytick.anchor(RIGHT).add(PV.Label).visible(new JsBooleanFunction() {
            public boolean f(JsArgs args) {
                return (cell.index() == traits.length - 1)
                        && (cell.parent().index() % 2 == 0);
            }
        }).text(new JsStringFunction() {
            public String f(JsArgs args) {
                double d = args.getDouble(0);
                TraitPair t = args.getObject(1);
                return position.get(t.py).tickFormatDouble(d);
            };
        });

        /* Frame and dot plot. */
        plot.add(PV.Dot).data(flowers).left(new JsDoubleFunction() {
            public double f(JsArgs args) {
                Flower d = args.getObject(0);
                TraitPair t = args.getObject(1);
                return position.get(t.px).fd(d.getTraitValue(t.px));
            };
        }).bottom(new JsDoubleFunction() {
            public double f(JsArgs args) {
                Flower d = args.getObject(0);
                TraitPair t = args.getObject(1);
                return position.get(t.py).fd(d.getTraitValue(t.py));
            };
        }).size(10).strokeStyle((String) null)
                .fillStyle(new JsFunction<PVColor>() {
                    public PVColor f(JsArgs args) {
                        Flower d = args.getObject(0);
                        return color.fcolor(d.species);
                    }
                });

        /* Labels along the diagonal. */
        cell.anchor(CENTER).add(PV.Label).visible(new JsBooleanFunction() {
            public boolean f(JsArgs args) {
                TraitPair t = args.getObject(0);
                return t.px.equals(t.py);
            }
        }).font("bold 14px sans-serif").text(new JsStringFunction() {
View Full Code Here

                        + (d.firstChild() != null ? "" : ": "
                                + format.format(d.nodeValueDouble()));
            }
        }).lineWidth(1);

        pack.label().add(PV.Label).visible(new JsBooleanFunction() {
            public boolean f(JsArgs args) {
                PVDomNode d = args.getObject();
                return d.firstChild() == null;
            }
        }).text(new JsStringFunction() {
View Full Code Here

                }
                return category19.fcolor(d.parentNode().nodeName());
            }
        }).strokeStyle("#fff").lineWidth(.5);

        partition.label().add(PV.Label).visible(new JsBooleanFunction() {
            public boolean f(JsArgs args) {
                PVRadialNode d = args.getObject();
                return d.angle() * d.outerRadius() >= 6;
            }
        });
View Full Code Here

        /* The root panel. */
        PVPanel vis = getPVPanel().width(w).height(h).bottom(20).left(20)
                .right(10).top(5);

        /* X-axis and ticks. */
        vis.add(PV.Rule).data(x.ticks()).visible(new JsBooleanFunction() {
            public boolean f(JsArgs args) {
                double d = args.getDouble(0);
                return d != 0;
            }
        }).left(x).bottom(-5).height(5).anchor(BOTTOM).add(PV.Label)
View Full Code Here

                }
                return category19.fcolor(d.parentNode().nodeName());
            }
        }).strokeStyle("#fff").lineWidth(.5);

        partition.label().add(PV.Label).visible(new JsBooleanFunction() {
            public boolean f(JsArgs args) {
                PVRadialNode d = args.getObject();
                return d.angle() * d.outerRadius() >= 6;
            }
        });
View Full Code Here

TOP

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

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.