我正在尝试使用 Medusa 中的这个Gauge
JavaFX 库:
但是当我尝试构建它时,我得到了这个结果:
正如您所看到的,仪表不显示阈值。这是为什么?
这是我用来创建仪表的代码:
public static Gauge e(String name, int value, int maxValue ) {
Gauge gauge = new Gauge();
//gauge.setSectionIconsVisible(false);
gauge.setPrefSize(300, 300);
gauge.setSkin(new TileKpiSkin(gauge));
gauge.setMaxValue(100);
gauge.setThreshold(60);
gauge.setTitle("this is it");
gauge.setValue(25);
gauge.setValueColor(Color.WHITE);
gauge.setTitleColor(Color.WHITE);
gauge.setThresholdVisible(true);
gauge.setThresholdColor(Color.RED);
//gauge.setSectionIconsVisible(false);
//gauge.setSectionsVisible(false);
return gauge;
}
任何帮助都会很棒。
最佳答案
您应该查看您正在使用的皮肤的源代码,文本设置为透明,这就是为什么您在矩形中看不到任何内容:
thresholdRect = new Rectangle();
thresholdRect.setFill(sectionsVisible ? GRAY : gauge.getThresholdColor());
enableNode(thresholdRect, gauge.isThresholdVisible());
thresholdText = new Text(String.format(locale, "%." + gauge.getTickLabelDecimals() + "f", gauge.getThreshold()));
thresholdText.setFill(sectionsVisible ? Color.TRANSPARENT : gauge.getBackgroundPaint());
enableNode(thresholdText, gauge.isThresholdVisible());
关于JavaFX Medusa Gauges 显示阈值 TileKpiSkin,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54744349/