Displaying javafx 2 linechart values on hover -


i have been using this example project, , works nice.

my question: possible offset hovered node such not overlay underlying data point. example centers hovered node right on "normal" node. kind of gets in way on chart lot of data points.

enter image description here

a simple solution set custom translation displayed label. following code extracted example.

  private label createdatathresholdlabel(int priorvalue, int value)     {         final label label = new label(value + "");         label.settranslatey(-25); //move label 25 pixels         label.getstyleclass().addall("default-color0", "chart-line-symbol", "chart-series-line");         label.setstyle("-fx-font-size: 20; -fx-font-weight: bold;");          if (priorvalue == 0)         {             label.settextfill(color.darkgray);         }         else if (value > priorvalue)         {             label.settextfill(color.forestgreen);         }         else         {             label.settextfill(color.firebrick);         }          label.setminsize(label.use_pref_size, label.use_pref_size);         return label;     } 

Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -