简体   繁体   中英

JavaFx PieChart boundary colors

When i build a pie chart in javafx, the boundary lines are always white.( I can set default slice colors with css). how can i set custom colors to boundary lines?

Applying some css to the standard chart sample :

.chart-pie {
    -fx-border-color: derive(-fx-pie-color, -40%);
    -fx-border-width: 3px;
}

You can play around with other css settings to get the different effects you want.

I won't answer further questions on this, but instead read the Region specification in the JavaFX CSS Reference Guide (as chart pies are styled regions) and review the modena.css stylesheet to learn how this can be done.

Here is the output with the css above applied:

圆润的

Compared to the standard output with no additional CSS (using the default JavaFX 8 modena style):

boringfruit

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM