0

I want to create line chart with XYlinechart but i have a problem with create a Y-axis range. My "Y-Axis" range is start with 0 80 85 90 95 100

This is my code:

// for x-axis
    final NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
    domainAxis.setRange(0, 90); 
    domainAxis.setTickUnit(new NumberTickUnit(10)); 
    domainAxis.setVerticalTickLabels(true); 
// for y-axis
    final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); 
    rangeAxis.setRange(0, 100); 
    rangeAxis.setTickUnit(new NumberTickUnit(......)); 

    return chart;

Please guide me with your valuable suggestions. Thanks in advance!!!

Jame
  • 89
  • 1
  • 2
  • 6
  • what do you mean by difference(20)? the NumberTickUnit? – Adel Boutros Feb 22 '12 at 10:03
  • yes,difference(20) is the NumberTickUnit, but i want the NumberTickUnit is 5 but at my rang should start at 0,80,85,90,95,100.Do you have any suggestion? – Jame Feb 22 '12 at 10:13

1 Answers1

1

Calling setTickUnit(new NumberTickUnit(0.5)) works as expected in this example, illustrated below. Please edit your question to include an sscce that exhibits the problem you describe.

image]

Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045
  • Hello, sir. I want to create a line chart, but i don't know how i create Y-axis range that have values from 0 and then jump to 80 85 90 95 100. Can you advince me more? – Jame Feb 22 '12 at 17:50
  • Yes, please edit your question to include an [sscce](http://sscce.org/) that exhibits the problem you describe. – trashgod Feb 22 '12 at 17:57