title: How to set color, width and draw dashed line simultaneously for javafx line?
body: <p>I have to draw multiple lines using javafx line chart. Since one line can overlap other lines. I want to use dashed line or line with different thickness to represent each line.</p>
  
  <p>Below is my code snippet:-</p>
  
  <pre><code>    for (XYChart.Series&lt;Number, Number&gt; s : chart.getData()) {
  
          // Used for Line color
          if (("Current Threshold").equals(s.getName())) {
              s.getNode().setStyle("   -fx-stroke-width: 10; ");
              s.getNode().setStyle("-fx-stroke: #00FF00; ");
              s.getNode().setStyle("-fx-stroke-dash-array: 2 12 12 2; ");
          } 
          else if(some condition)
          {
          // Some other condition to draw other lines
          }
  }
  </code></pre>
  
  <p>where chart is instance of LineChart.</p>
  
  <p>Node.setStyle() methods override each other. I am unable to set multiple style together. Last style persists and others are overridden. ie for above sequence, dashed line is drawn. I am using css styles in java code.</p>
  
  <p>Is there any way to apply multiple style, without overriding others.</p>
  
  <p>Thanks</p>