JavaFx PieChart boundary colors

你说的曾经没有我的故事 提交于 2019-12-23 03:04:25

问题


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?


回答1:


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):



来源:https://stackoverflow.com/questions/23736918/javafx-piechart-boundary-colors

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!