Win a copy of Grokking Bitcoin this week in the Cloud/Virtualization 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
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

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: 1170
18
Firefox Browser 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: 1170
18
Firefox Browser 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: 1170
18
Firefox Browser 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):

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!