barColor = getSkinnable().getBarColor();
barGradient = new ConicalGradient(new Stop(0.0, Color.TRANSPARENT),
new Stop(1.0, Color.TRANSPARENT));
valueBlendBottomShadow = new DropShadow();
valueBlendBottomShadow.setBlurType(BlurType.TWO_PASS_BOX);
valueBlendBottomShadow.setColor(Color.rgb(255, 255, 255, 0.5));
valueBlendBottomShadow.setOffsetX(0);
valueBlendBottomShadow.setOffsetY(0.005 * PREFERRED_WIDTH);
valueBlendBottomShadow.setRadius(0);
valueBlendTopShadow = new InnerShadow();
valueBlendTopShadow.setBlurType(BlurType.TWO_PASS_BOX);
valueBlendTopShadow.setColor(Color.rgb(0, 0, 0, 0.7));
valueBlendTopShadow.setOffsetX(0);
valueBlendTopShadow.setOffsetY(0.005 * PREFERRED_WIDTH);
valueBlendTopShadow.setRadius(0.005 * PREFERRED_WIDTH);
blend = new Blend();
blend.setMode(BlendMode.MULTIPLY);
blend.setBottomInput(valueBlendBottomShadow);
blend.setTopInput(valueBlendTopShadow);
background = new Region();
background.getStyleClass().setAll("background");
ticksAndSectionsCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
ticksAndSections = ticksAndSectionsCanvas.getGraphicsContext2D();
minMeasuredValue = new Region();
minMeasuredValue.getStyleClass().setAll("min-measured-value");
minMeasuredValueRotate = new Rotate(180 - getSkinnable().getStartAngle());
minMeasuredValue.getTransforms().setAll(minMeasuredValueRotate);
minMeasuredValue.setOpacity(getSkinnable().isMinMeasuredValueVisible() ? 1 : 0);
minMeasuredValue.setManaged(getSkinnable().isMinMeasuredValueVisible());
maxMeasuredValue = new Region();
maxMeasuredValue.getStyleClass().setAll("max-measured-value");
maxMeasuredValueRotate = new Rotate(180 - getSkinnable().getStartAngle());
maxMeasuredValue.getTransforms().setAll(maxMeasuredValueRotate);
maxMeasuredValue.setOpacity(getSkinnable().isMaxMeasuredValueVisible() ? 1 : 0);
maxMeasuredValue.setManaged(getSkinnable().isMaxMeasuredValueVisible());
threshold = new Region();
threshold.getStyleClass().setAll("threshold");
thresholdRotate = new Rotate(180 - getSkinnable().getStartAngle());
threshold.getTransforms().setAll(thresholdRotate);
threshold.setOpacity(getSkinnable().isThresholdVisible() ? 1 : 0);
threshold.setManaged(getSkinnable().isThresholdVisible());
thresholdExceeded = false;
bar = new Arc();
bar.setType(ArcType.ROUND);
bar.setCenterX(PREFERRED_WIDTH * 0.5);
bar.setCenterY(PREFERRED_HEIGHT * 0.5);
bar.setRadiusX(PREFERRED_WIDTH * 0.5 - 4);
bar.setRadiusY(PREFERRED_HEIGHT * 0.5 - 4);
bar.setStartAngle(getSkinnable().getStartAngle() - 90);
bar.setLength(0);
bar.setStrokeType(StrokeType.CENTERED);
bar.setStroke(null);
bar.setFill(new RadialGradient(0, 0,
PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5,
PREFERRED_WIDTH * 0.45, false, CycleMethod.NO_CYCLE,
new Stop(0.0, barColor),
new Stop(0.76, barColor.deriveColor(-5, 1, 1, 1)), // -5 for on the barColorHue)
new Stop(0.79, barColor),
new Stop(0.97, barColor),
new Stop(1.0, barColor.deriveColor(-5, 1, 1, 1)))); // -5 for on the barColorHue)
knob = new Region();
knob.setPickOnBounds(false);
knob.getStyleClass().setAll("knob");
dropShadow = new DropShadow();
dropShadow.setColor(Color.rgb(0, 0, 0, 0.25));
dropShadow.setBlurType(BlurType.TWO_PASS_BOX);
dropShadow.setRadius(0.015 * PREFERRED_WIDTH);
dropShadow.setOffsetY(0.015 * PREFERRED_WIDTH);