Package eu.hansolo.enzo.common

Examples of eu.hansolo.enzo.common.Section


        series.getData().add(new XYChart.Data("17:00", 30.05));
        series.getData().add(new XYChart.Data("18:00", 31.25));

        chart = new SimpleLineChart();
        chart.setSections(new Section[]{
            new Section(0, 10),
            new Section(10, 15),
            new Section(15, 25),
            new Section(25, 30),
            new Section(30, 40)
        });
        chart.getStyleClass().addAll(SimpleLineChart.STYLE_CLASS_BLUE_TO_RED_5);
        chart.setSectionRangeVisible(true);
        chart.setUnit("°C");
        chart.setSeries(series);
View Full Code Here


        for (int i = 0 ; i < 100 ; i++) {
            SimpleGauge gauge = SimpleGaugeBuilder.create()
                                                  .prefSize(50, 50)
                                                  .animationDuration(80)
                                                  .animated(false)
                                                  .sections(new Section(0, 100))
                                                  .styleClass(SimpleGauge.STYLE_CLASS_BLUE_TO_RED_6)
                                                  .build();
            gauges[i] = gauge;
        }
View Full Code Here

        final double xy        = (size - 0.87 * size) * 0.5;
        final double wh        = size * 0.87;
        final double MIN_VALUE = getSkinnable().getMinValue();
        final double OFFSET = 90 - getSkinnable().getStartAngle();
        for (int i = 0 ; i < getSkinnable().getSections().size() ; i++) {
            final Section SECTION      = getSkinnable().getSections().get(i);
            final double  ANGLE_START  = (SECTION.getStart() - MIN_VALUE) * angleStep;
            final double  ANGLE_EXTEND = (SECTION.getStop() - SECTION.getStart()) * angleStep;
            CTX.save();
            switch(i) {
                case 0: CTX.setStroke(getSkinnable().getSectionFill0()); break;
                case 1: CTX.setStroke(getSkinnable().getSectionFill1()); break;
                case 2: CTX.setStroke(getSkinnable().getSectionFill2()); break;
View Full Code Here

        final double wh        = size * 0.83;
        final double MIN_VALUE = getSkinnable().getMinValue();
        final double MAX_VALUE = getSkinnable().getMaxValue();
        final double OFFSET = 90 - getSkinnable().getStartAngle();
        for (int i = 0 ; i < getSkinnable().getSections().size() ; i++) {
            final Section SECTION = getSkinnable().getSections().get(i);

            if (SECTION.getStart() > MAX_VALUE || SECTION.getStop() < MIN_VALUE) continue;

            final double SECTION_START_ANGLE;
            if (SECTION.getStart() > MAX_VALUE || SECTION.getStop() < MIN_VALUE) continue;

            if (SECTION.getStart() < MIN_VALUE && SECTION.getStop() < MAX_VALUE) {
                SECTION_START_ANGLE = MIN_VALUE * angleStep;
            } else {
                SECTION_START_ANGLE = (SECTION.getStart() - MIN_VALUE) * angleStep;
            }
            final double SECTION_ANGLE_EXTEND;
            if (SECTION.getStop() > MAX_VALUE) {
                SECTION_ANGLE_EXTEND = MAX_VALUE * angleStep;
            } else {
                SECTION_ANGLE_EXTEND = (SECTION.getStop() - SECTION.getStart()) * angleStep;
            }

            CTX.save();
            switch(i) {
                case 0: CTX.setStroke(getSkinnable().getSectionFill0()); break;
View Full Code Here

        final double SECTIONS_SIZE   = size - (size * 0.03);
        angleStep                    = getSkinnable().getAngleRange() / (getSkinnable().getMaxValue() + getSkinnable().getMinValue());
        double sinValue;
        double cosValue;
        for (int i = 0 ; i < NO_OF_SECTIONS ; i++) {
            final Section SECTION = getSkinnable().getSections().get(i);
            final double SECTION_START_ANGLE;
            if (SECTION.getStart() > MAX_VALUE || SECTION.getStop() < MIN_VALUE) continue;

            if (SECTION.getStart() < MIN_VALUE && SECTION.getStop() < MAX_VALUE) {
                SECTION_START_ANGLE = MIN_VALUE * angleStep;
            } else {
                SECTION_START_ANGLE = (SECTION.getStart() - MIN_VALUE) * angleStep;
            }
            final double SECTION_ANGLE_EXTEND;
            if (SECTION.getStop() > MAX_VALUE) {
                SECTION_ANGLE_EXTEND = MAX_VALUE * angleStep;
            } else {
                SECTION_ANGLE_EXTEND = (SECTION.getStop() - SECTION.getStart()) * angleStep;
            }
            sectionsCtx.save();
            switch(i) {
                case 0: sectionsCtx.setFill(getSkinnable().getSectionFill0()); break;
                case 1: sectionsCtx.setFill(getSkinnable().getSectionFill1()); break;
                case 2: sectionsCtx.setFill(getSkinnable().getSectionFill2()); break;
                case 3: sectionsCtx.setFill(getSkinnable().getSectionFill3()); break;
                case 4: sectionsCtx.setFill(getSkinnable().getSectionFill4()); break;
                case 5: sectionsCtx.setFill(getSkinnable().getSectionFill5()); break;
                case 6: sectionsCtx.setFill(getSkinnable().getSectionFill6()); break;
                case 7: sectionsCtx.setFill(getSkinnable().getSectionFill7()); break;
                case 8: sectionsCtx.setFill(getSkinnable().getSectionFill8()); break;
                case 9: sectionsCtx.setFill(getSkinnable().getSectionFill9()); break;
            }
            sectionsCtx.fillArc(SECTIONS_OFFSET, SECTIONS_OFFSET, SECTIONS_SIZE, SECTIONS_SIZE, (OFFSET - SECTION_START_ANGLE), -SECTION_ANGLE_EXTEND, ArcType.ROUND);

            // Draw Section Text
            if (getSkinnable().isSectionTextVisible()) {
                sinValue = -Math.sin(Math.toRadians(OFFSET - 90 - SECTION_START_ANGLE - SECTION_ANGLE_EXTEND * 0.5));
                cosValue = -Math.cos(Math.toRadians(OFFSET - 90 - SECTION_START_ANGLE - SECTION_ANGLE_EXTEND * 0.5));
                Point2D textPoint = new Point2D(size * 0.5 + size * 0.365 * sinValue, size * 0.5 + size * 0.365 * cosValue);
                sectionsCtx.setFont(Font.font("Open Sans", FontWeight.NORMAL, 0.08 * size));
                sectionsCtx.setTextAlign(TextAlignment.CENTER);
                sectionsCtx.setTextBaseline(VPos.CENTER);
                sectionsCtx.setFill(getSkinnable().getSectionTextColor());
                sectionsCtx.fillText(SECTION.getText(), textPoint.getX(), textPoint.getY());
            }

            // Draw Section Icon
            if (size > 0) {
                if (getSkinnable().isSectionIconVisible() && !getSkinnable().isSectionTextVisible()) {
                    if (null != SECTION.getImage()) {
                        Image icon = SECTION.getImage();
                        sinValue = -Math.sin(Math.toRadians(OFFSET - 90 - SECTION_START_ANGLE - SECTION_ANGLE_EXTEND * 0.5));
                        cosValue = -Math.cos(Math.toRadians(OFFSET - 90 - SECTION_START_ANGLE - SECTION_ANGLE_EXTEND * 0.5));
                        Point2D iconPoint = new Point2D(size * 0.5 + size * 0.365 * sinValue, size * 0.5 + size * 0.365 * cosValue);
                        sectionsCtx.drawImage(icon, iconPoint.getX() - size * 0.06, iconPoint.getY() - size * 0.06, size * 0.12, size * 0.12);
                    }
View Full Code Here

        control = RadialBargraphBuilder.create()
                                       .title("Enzo")
                                       .unit("°C")
                                       .markers(new Marker(40))
                                       .threshold(25)
                                       .sections(new Section(60, 80))
                                       .thresholdVisible(true)
                                       .build();
        control.setBarGradientEnabled(true);

        List<Stop> stops = new ArrayList<>();
View Full Code Here

                              .prefSize(400, 400)
                              .startAngle(330)
                              .angleRange(300)
                              .minValue(0)
                              .maxValue(100)
                              .sections(new Section(0, 60),
                                        new Section(60, 80),
                                        new Section(80, 100))
                              .majorTickSpace(20)
                              .plainValue(false)
                              .tickLabelOrientation(Gauge.TickLabelOrientation.HORIZONTAL)
                              .threshold(70)
                              .thresholdVisible(true)
View Full Code Here

        ctxBkg.save();
        ctxBkg.translate(0, sectionMinimum * heightFactor);

        ctxBkg.setFont(Font.font("Open Sans", FontWeight.NORMAL, (lowestSection * 0.8 * heightFactor)));
        for (int i = 0 ; i < getSkinnable().getSections().size() ; i++) {
            final Section SECTION = getSkinnable().getSections().get(i);
            ctxBkg.save();
            switch(i) {
                case 0: ctxBkg.setFill(getSkinnable().getSectionFill0()); break;
                case 1: ctxBkg.setFill(getSkinnable().getSectionFill1()); break;
                case 2: ctxBkg.setFill(getSkinnable().getSectionFill2()); break;
                case 3: ctxBkg.setFill(getSkinnable().getSectionFill3()); break;
                case 4: ctxBkg.setFill(getSkinnable().getSectionFill4()); break;
                case 5: ctxBkg.setFill(getSkinnable().getSectionFill5()); break;
                case 6: ctxBkg.setFill(getSkinnable().getSectionFill6()); break;
                case 7: ctxBkg.setFill(getSkinnable().getSectionFill7()); break;
                case 8: ctxBkg.setFill(getSkinnable().getSectionFill8()); break;
                case 9: ctxBkg.setFill(getSkinnable().getSectionFill9()); break;
            }
            ctxBkg.fillRect(0, height - SECTION.getStop() * heightFactor, width, Math.abs(SECTION.getStop() - SECTION.getStart()) * heightFactor);
            ctxBkg.restore();
        }
        if (getSkinnable().isSectionRangeVisible()) {
            for (int i = 0 ; i < getSkinnable().getSections().size() - 1 ; i++) {
                final Section SECTION = getSkinnable().getSections().get(i);
                ctxBkg.setFill(getSkinnable().getSeriesStroke());
                ctxBkg.setTextBaseline(VPos.CENTER);
                ctxBkg.fillText(SECTION.getStop() + getSkinnable().getUnit(), 0.02 * height, height - SECTION.getStop() * heightFactor);
            }
        }
        ctxBkg.restore();
    }
View Full Code Here

    private AnimationTimer timer;

    @Override public void init() {
        thermoMeter = SimpleGaugeBuilder.create()
                                        .prefSize(400, 400)
                                        .sections(new Section(0, 16.66666, "0"),
                                            new Section(16.66666, 33.33333, "1"),
                                            new Section(33.33333, 50.0, "2"),
                                            new Section(50.0, 66.66666, "3"),
                                            new Section(66.66666, 83.33333, "4"),
                                            new Section(83.33333, 100.0, "5"))
                                        .title("Temperature")
                                        .unit("C")
                                        .value(20)                                       
                                        .styleClass(SimpleGauge.STYLE_CLASS_GREEN_TO_RED_6)
                                        .build();       

        wattMeter = SimpleGaugeBuilder.create()
                                      .prefSize(400, 400)
                                      .sections(new Section(0, 16.66666, "0"),
                                                new Section(16.66666, 33.33333, "1"),
                                                new Section(33.33333, 50.0, "2"),
                                                new Section(50.0, 66.66666, "3"),
                                                new Section(66.66666, 83.33333, "4"),
                                                new Section(83.33333, 100.0, "5"))
                                      .unit("W")
                                      .measuredRangeVisible(true)
                                      .rangeFill(Color.rgb(0, 0, 200, 0.5))
                                      .styleClass(SimpleGauge.STYLE_CLASS_GREEN_TO_DARKGREEN_6)
                                      .build();
        energyMeter = SimpleGaugeBuilder.create()
                                        .prefSize(400, 400)
                                        .sections(new Section(0, 10, "A++"),
                                                  new Section(10, 20, "A+"),
                                                  new Section(20, 30, "A"),
                                                  new Section(30, 40, "B"),
                                                  new Section(40, 50, "C"),
                                                  new Section(50, 60, "D"),
                                                  new Section(60, 70, "E"),
                                                  new Section(70, 80, "F"),
                                                  new Section(80, 90, "G"),
                                                  new Section(90, 100, "H"))
                                        .sectionTextVisible(true)
                                        .unit("W")
                                        .styleClass(SimpleGauge.STYLE_CLASS_GREEN_TO_RED_10)
                                        .build();
View Full Code Here

        ctxBkg.translate(0, sectionMinimum * heightFactor);
       
        ctxBkg.setFont(Fonts.robotoRegular(lowestSection * 0.8 * heightFactor));
        IntStream.range(0, getSkinnable().getSections().size()).forEach(
            i -> {
                final Section SECTION = getSkinnable().getSections().get(i);
                ctxBkg.save();
                switch(i) {
                    case 0: ctxBkg.setFill(getSkinnable().getSectionFill0()); break;
                    case 1: ctxBkg.setFill(getSkinnable().getSectionFill1()); break;
                    case 2: ctxBkg.setFill(getSkinnable().getSectionFill2()); break;
                    case 3: ctxBkg.setFill(getSkinnable().getSectionFill3()); break;
                    case 4: ctxBkg.setFill(getSkinnable().getSectionFill4()); break;
                    case 5: ctxBkg.setFill(getSkinnable().getSectionFill5()); break;
                    case 6: ctxBkg.setFill(getSkinnable().getSectionFill6()); break;
                    case 7: ctxBkg.setFill(getSkinnable().getSectionFill7()); break;
                    case 8: ctxBkg.setFill(getSkinnable().getSectionFill8()); break;
                    case 9: ctxBkg.setFill(getSkinnable().getSectionFill9()); break;
                }
                ctxBkg.fillRect(0, height - SECTION.getStop() * heightFactor, width, Math.abs(SECTION.getStop() - SECTION.getStart()) * heightFactor);
                ctxBkg.restore();               
            }
        );       
        if (getSkinnable().isSectionRangeVisible()) {
            IntStream.range(0, getSkinnable().getSections().size()).forEach(
                i -> {
                    final Section SECTION = getSkinnable().getSections().get(i);
                    ctxBkg.setFill(getSkinnable().getSeriesStroke());
                    ctxBkg.setTextBaseline(VPos.CENTER);
                    ctxBkg.fillText(SECTION.getStop() + getSkinnable().getUnit(), 0.02 * height, height - SECTION.getStop() * heightFactor);   
                }
            );                       
        }
        ctxBkg.restore();
    }
View Full Code Here

TOP

Related Classes of eu.hansolo.enzo.common.Section

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.