Examples of JsDoubleFunction


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

    /* bullet graph specs */

    private void createVisualization(JsArrayGeneric<Bullet> bullets) {

        PVPanel vis = graphWidget.getPVPanel().data(bullets).width(400).height(30)
                .margin(20).left(120).top(new JsDoubleFunction() {
                    public double f(JsArgs args) {
                        PVMark _this = args.getThis();
                        return 10 + _this.index() * 60;
                    }
                });
View Full Code Here

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

    /* bullet graph specs */

    private PVPanel createVisualization() {

        PVPanel vis = graphWidget.getPVPanel().width(400).height(30)
                .margin(20).left(120).top(new JsDoubleFunction() {
                    public double f(JsArgs args) {
                        PVMark _this = args.getThis();
                        return 10 + _this.index() * 60;
                    }
                });
View Full Code Here

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

    /* bullet graph specs */

    private void createVisualization(JsArrayGeneric<Bullet> bullets) {

        PVPanel vis = graphWidget.getPVPanel().data(bullets).width(400).height(30)
                .margin(20).left(120).top(new JsDoubleFunction() {
                    public double f(JsArgs args) {
                        PVMark _this = args.getThis();
                        return 10 + _this.index() * 60;
                    }
                });
View Full Code Here

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

                        return PV.Format.number().format(d) + " mi";
                    }
                });

        vis.add(PV.Line).data(driving).interpolate(CARDINAL).lineWidth(4)
                .strokeStyle("black").left(new JsDoubleFunction() {
                    public double f(JsArgs args) {
                        DrivingStats d = args.getObject(0);
                        return x.fd(d.miles);
                    }
                }).bottom(new JsDoubleFunction() {
                    public double f(JsArgs args) {
                        DrivingStats d = args.getObject(0);
                        return y.fd(d.gas);
                    }
                }).add(PV.Dot).lineWidth(1).fillStyle("white")
View Full Code Here

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

        PVFillPartitionLayout layout = vis
                .add(PV.Layout.PartitionFill())
                .nodes(PVDom.create(root, new FlareData.UnitDomAdapter())
                        .nodes()).order("descending").orient("top")
                .size(new JsDoubleFunction() {
                    public double f(JsArgs args) {
                        PVDomNode d = args.getObject();
                        return d.nodeValueDouble();
                    }
                });
View Full Code Here

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

                    }
                }).anchor(LEFT).add(PV.Label).text(y.tickFormat());

        /* Add a panel for each data point */
        PVPanel points = vis.add(PV.Panel).data(experiments)
                .left(new JsDoubleFunction() {
                    public double f(JsArgs args) {
                        Experiment d = args.getObject();
                        return x.fd(d.id);
                    }
                }).width(s * 2);

        /* Add the experiment id label */
        points.anchor(BOTTOM).add(PV.Label).textBaseline(TOP)
                .text(new JsStringFunction() {
                    public String f(JsArgs args) {
                        Experiment d = args.getObject();
                        return d.id;
                    }
                });

        /* Add the range line */
        points.add(PV.Rule).left(s).bottom(new JsDoubleFunction() {
            public double f(JsArgs args) {
                Experiment d = args.getObject();
                return y.fd(d.min);
            }
        }).height(new JsDoubleFunction() {
            public double f(JsArgs args) {
                Experiment d = args.getObject();
                return y.fd(d.max) - y.fd(d.min);
            }
        });

        /* Add the min and max indicators */
        points.add(PV.Rule).data(new JsFunction<JsArrayNumber>() {
            public JsArrayNumber f(JsArgs args) {
                Experiment d = args.getObject();
                return JsUtils.toJsArrayNumber(d.min, d.max);
            }
        }).bottom(y).left(s / 2).width(s);

        /* Add the upper/lower quartile ranges */
        points.add(PV.Bar).bottom(new JsDoubleFunction() {
            public double f(JsArgs args) {
                Experiment d = args.getObject();
                return y.fd(d.lq);
            }
        }).height(new JsDoubleFunction() {
            public double f(JsArgs args) {
                Experiment d = args.getObject();
                return y.fd(d.uq) - y.fd(d.lq);
            }
        }).fillStyle(new JsStringFunction() {
            public String f(JsArgs args) {
                Experiment d = args.getObject();
                return d.median > .5 ? "#aec7e8" : "#ffbb78";
            }
        }).strokeStyle("black").lineWidth(1).antialias(false);

        /* Add the median line */
        points.add(PV.Rule).bottom(new JsDoubleFunction() {
            public double f(JsArgs args) {
                Experiment d = args.getObject();
                return y.fd(d.median);
            }
        });
View Full Code Here

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

            public JsDate f(JsArgs args) {
                DaySummary d = args.getObject();
                return d.jsDate;
            }
        }).range(0, w);
        final PVLinearScale y = PV.Scale.linear(days, new JsDoubleFunction() {
            public double f(JsArgs args) {
                DaySummary d = args.getObject();
                return d.low;
            }
        }, new JsDoubleFunction() {
            public double f(JsArgs args) {
                DaySummary d = args.getObject();
                return d.high;
            }
        }).range(0, h).nice();

        PVPanel vis = getPVPanel().width(w).height(h).margin(10).left(30);

        /* Dates. */
        vis.add(PV.Rule).data(x.ticks()).left(x).strokeStyle("#eee")
                .anchor(BOTTOM).add(PV.Label).text(x.tickFormat());

        /* Prices. */
        vis.add(PV.Rule).data(y.ticks(7)).bottom(y).left(-10).right(-10)
                .strokeStyle(new JsStringFunction() {
                    public String f(JsArgs args) {
                        double d = args.getDouble();
                        return d % 10 != 0 ? "#ccc" : "#333";
                    }
                }).anchor(LEFT).add(PV.Label).textStyle(new JsStringFunction() {
                    public String f(JsArgs args) {
                        double d = args.getDouble();
                        return d % 10 != 0 ? "#999" : "#333";
                    }
                }).text(y.tickFormat());

        /* Candlestick. */
        vis.add(PV.Rule).data(days).left(new JsDoubleFunction() {
            public double f(JsArgs args) {
                DaySummary d = args.getObject();
                return x.fd(d.jsDate);
            }
        }).bottom(new JsDoubleFunction() {
            public double f(JsArgs args) {
                DaySummary d = args.getObject();
                return y.fd(Math.min(d.high, d.low));
            }
        }).height(new JsDoubleFunction() {
            public double f(JsArgs args) {
                DaySummary d = args.getObject();
                return Math.abs(y.fd(d.high) - y.fd(d.low));
            }
        }).strokeStyle(new JsStringFunction() {
            public String f(JsArgs args) {
                DaySummary d = args.getObject();
                return d.open < d.close ? "#ae1325" : "#06982d";
            }
        }).add(PV.Rule).bottom(new JsDoubleFunction() {
            public double f(JsArgs args) {
                DaySummary d = args.getObject();
                return y.fd(Math.min(d.open, d.close));
            }
        }).height(new JsDoubleFunction() {
            public double f(JsArgs args) {
                DaySummary d = args.getObject();
                return Math.abs(y.fd(d.open) - y.fd(d.close));
            }
        }).lineWidth(10);
View Full Code Here

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

        final PVColor inactiveNodeColor = PV.color("#AAA");

        arc.node()
                .add(PV.Bar)
                .width(10)
                .left(new JsDoubleFunction() {
                    public double f(JsArgs args) {
                        PVNode d = args.getObject();
                        return d.x() - 4;
                    }
                })
                .height(new JsDoubleFunction() {
                    public double f(JsArgs args) {
                        PVNode d = args.getObject();
                        return d.linkDegree();
                    }
                })
View Full Code Here

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

                    }
                });

        arc.link().add(PV.Line);

        arc.node().add(PV.Dot).size(new JsDoubleFunction() {
            public double f(JsArgs args) {
                PVNode d = args.getObject();
                return d.linkDegree() + 4;
            }
        }).fillStyle(new JsFunction<PVColor>() {
View Full Code Here

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

                .height(regularBarLength).left(barStart).width(barWidth)
                .lineWidth(BAR_STROKE_WIDTH).cursor(POINTER).events(ALL);

        getChart().add(PV.Label).data(viewItemsJsArray)
                .left(baselineLabelStart).textAlign(PVAlignment.CENTER)
                .bottom(new JsDoubleFunction() {
                    @Override
                    public double f(JsArgs args) {
                        PVMark _this = args.getThis();
                        // TODO dynamic positioning depending on label size
                        if (chartWidth / regularValues.length > 60) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.