gpt4 book ai didi

java - 如何在 JavaFX 中将 (0,0) 处的水平线和垂直线着色得更深

转载 作者:行者123 更新时间:2023-11-30 08:29:07 27 4
gpt4 key购买 nike

所以,我觉得这不是一个可怕的难题,但我找不到可以挽救我生命的属性(property)。我正在构建一个不错的 Javafx XYChart(我应该说是构建的)并且一切都很顺利,在 Oracle CSS styling guide 的帮助下,我找到了大部分我可能需要的所有帮助。并制作了一个漂亮的图表(如果我有 10 个声誉,我会发布 >_> )。现在,忽略它上面的随机抛物线,以及其他所有东西,因为我知道如何处理这些,我遇到的问题是红色 x 指向的位置,我需要那些轴线像深黑色,但是我在任何地方都找不到正确的 CSS 属性 您可能认为该属性是 fx-axis-stroke,但 javafx 2.0 无法识别该参数。 (我提供的链接来自 1.3,我相信,较新的链接没有列出其中的大部分?O_o)。我的 CSS 文件如下:

    /* This css file holds all of the styling for the XY chart produced in the calculator.*/
.chart-plot-background {
-fx-background-image: url("chart-background 2.png"), url("graph-gridlines.png");
-fx-background-size: cover, auto;
-fx-background-repeat: no-repeat, repeat;
-fx-background-position: 0% 0%, 0% 100%;
-fx-border-color: black black transparent transparent;
}
.chart {

-fx-background-image: url("background.png");
-fx-padding: 15 25 15 15;
-fx-border-color: black;
-fx-effect: dropshadow( gaussian , rgba(0,0,0,0.8) , 10, 0.0 , 0 , 2 );
}
.axis Text{
-fx-fill: white;
}
.tick-mark {
-fx-font-size: 10px;
-fx-effect: dropshadow( one-pass-box , rgba(0,0,0,0.8) , 0, 0.0 , 0 , 1 );
}
.chart-legend{
-fx-background-color: transparent;
}
.chart-legend-item{
-fx-text-fill: white;

}

.chart-series-area-line {
-fx-stroke: white;
-fx-stroke-width: 2px;
}
.axis-label {
-fx-text-fill: azure;
}
.default-color0.chart-series-line { -fx-stroke: azure; }
.default-color1.chart-series-line { -fx-stroke: azure; }
.default-color2.chart-series-line { -fx-stroke: azure; }

.default-color0.chart-line-symbol { -fx-background-color: azure; }
.default-color1.chart-line-symbol { -fx-background-color: azure; }
.default-color2.chart-line-symbol { -fx-background-color: azure; }
.chart-area-symbol {
-fx-background-color: white;
}
.axis {
-fx-stroke: black;
-fx-tick-mark-visible: false;
-fx-minor-tick-visible: false;
-fx-tick-length: 3;
-fx-minor-tick-length: 0;
-fx-border-color: transparent;
}
.axis:bottom {
-fx-border-color: black transparent transparent transparent;
}
.axis:left {
-fx-border-color: transparent black transparent transparent;
}
.chart-series-area-fill {
-fx-fill: linear-gradient(to right, white, rgba(255,255,255,0));
-fx-blend-mode: OVERLAY;
}

root {
display: block;
}

如果您能提供任何帮助或见解,我们将不胜感激。对我来说很明显该属性必须存在,但我似乎无法找到它。

编辑:我知道你看不到我上面提到的红色箭头,因为我无法发布图片,但如果你能想象两个红色箭头指向图表的 x 和 y 轴线(不是一定在图表的边界上),那么这就是您真正需要知道的。

最佳答案

所以,这在大约 5 分钟前已经解决了。正如我猜想的那样,解决方案非常简单。实现它的神奇 CSS:

.chart-vertical-zero-line{
-fx-stroke: black;
-fx-stroke-width: 5px;
}
.chart-horizontal-zero-line{
-fx-stroke: black;
-fx-stroke-width: 5px;
}

至此,垂直和水平零线的单独着色/CSS 格式选项。惊人的。

关于java - 如何在 JavaFX 中将 (0,0) 处的水平线和垂直线着色得更深,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19693894/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com