This week's book giveaway is in the Web Services forum.
We're giving away four copies of Microservices in Action and have Morgan Bruce & Paulo A. Pereira on-line!
See this thread for details.
Win a copy of Microservices in Action this week in the Web Services forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Change style of some labels on chart axis  RSS feed

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

is it possible to change the style just for some tick labels on a chart axis via css, e.g. use another color for some of the tick labels?
 
Rancher
Posts: 624
11
Hibernate IntelliJ IDE Java MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's uncear to me what you mean, but have a look at this post working with css in javaFx is there explained
 
Dagmar Schlenz
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I mean the following:
a Chart axis has some css tags to style the tick labels:
-fx-tick-label-font-family:
-fx-tick-label-font-size:
-fx-tick-label-fill:

But those tags aplly to all axis labels

I would like to know if there is a way to apply other styles to some tick labels (e.g. using pseudo classes)
 
Daniel Demesmaecker
Rancher
Posts: 624
11
Hibernate IntelliJ IDE Java MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
asign an id to your label for a single label or a class if you want to direct a group.

In you css #id or .class
 
Dagmar Schlenz
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your Input.

In general, your suggestions are working fine, but in this special case, none of the usual ways to style Texts seems to work.

The Axis class creates Text nodes to visualize the tick labels on the axis - they don't have own style classes.
The color is defined by the global property tickLabelFill and set for all text nodes representing the tick labels.

I just wanted to know if anyone actually managed to individually change the label color for some labels on a chart axis.
 
Daniel Demesmaecker
Rancher
Posts: 624
11
Hibernate IntelliJ IDE Java MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
could I see your fxmlfile and your controllerClass?
 
Dagmar Schlenz
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We don't use fxml in our Project.

Here is the snippet from the scss (which is translated to css):



And the Code snippet from my own Axis class that sets the conditional style class (this is working - could see that the style class for the Text node is set using ScenicView):

 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!