Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要一个面积图,当它是负数时,它可以用不同的颜色(例如红色)填充图表。
如何在 JavaFX 中做到这一点?
http://i.stack.imgur.com/SSl5a.png
http://i.stack.imgur.com/nzag3.png
我认为实现这一目标的最简单方法是XYCHartSeries为您的图表创建两个。一个用于负值,一个用于正值。然后您可以使用 CSS 设置 ChartSeries 的颜色,如下所示: positiveChart.setId("positiveValues"); positiveChart.setStyle("#positiveValues {-fx-bar-fill: #4CAF50 }");
XYCHartSeries
positiveChart.setId("positiveValues"); positiveChart.setStyle("#positiveValues {-fx-bar-fill: #4CAF50 }");