NumberAxis « Axis « JFreeChart Q&A





1. How can I change the tickLabel on a NumberAxis in JFreeChart?    stackoverflow.com

I am using JFreeChart and want to be able to change the label on the range axis from a number to something more meaningful for the domain I am in. ...

2. How call refreshTicksVertical from NumberAxis    jfree.org

Hm... I never was in need for doing anything like this (mostly using JFreeChart in Webapps). You could just call refreshTicks() which is public but that would only recalculate the ticks and not redraw the axis. There is a public Axis.draw() which you could try to call, but I'm not sure if this does exactly what you wan. - martin

4. Problem with NumberAxis    jfree.org

Hi , please help me!! I'm facing a problem with Number Axis, in the DateAxis the Horizental axis take a format Like{MM-YYYY} i want to change this appearance to view number in Range,ex:{0..100} i Wrote this Instruction : NumberAxis domainAxis = (NumberAxis)plot.getDomainAxis(); and i got an error message --> "java.lang.ClassCastException" at this line please help me and i'll be very thankfully ...

6. NumberAxis Problem    jfree.org

Hello. I have a chart like this : sdfkjhjhsdf |++++++++++++++++++++ | agdkjdf |+++++++++ | sdklskkdkkdkff |+++++++++++++++ ----------------------------------------------- 0% 50% 100% In some cases, when the text items (sdfkjhjhsdf... etc) on the left get too long, the are displayed as something like sdfkjh... . How can i stop jfreechart doing this ? thx, stefan

7. NumberAxis not showing upper label when all data less than 1    jfree.org

I have a dataset that is all less than 1. In the graph output there is no upper label. The lower label is 0. This is using a TimeSeries chart. setUpperBound( 1.1) does not make a difference. setStandardTickUnits(NumberAxis.createStandardTickUnits()) or createIntegerTickUnits() doesn't make a difference. I would like to force the graph axis to have an upper limit label and don't know ...

8. Major Minor Ticks for NumberAxis    jfree.org

Hi @everybody, im using a chart with a numberAxis as y-Axis. I need this axis to display major ticks with labels and, minor ticks without labels. In addition to that, I need (if possible) a different (dashed) gridlineStroke for the gridlines at the minor ticks. Any ideas how to achieve that? TIA, Tom

9. Problem with NumberAxis Label Color    jfree.org

I am creating a number of charts with the same settings but different datasets and displaying them on the same screen. The background of the charts are set to be transparent. There is no problem up to this point, however, the color tones of the number axis labels are different in some of the charts. For instance although the setting is ...





10. Ticks on NumberAxis does not work ! What do I do wrong ?    jfree.org

I ve got this code : XYPlot plot = chart.getXYPlot(); plot.setOrientation(PlotOrientation.VERTICAL); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0)); StandardXYItemRenderer renderer = (StandardXYItemRenderer) plot.getRenderer(); renderer.setPaint(Color.black); NumberAxis axis2 = new NumberAxis("Rain"); axis2.setAutoRangeIncludesZero(true); axis2.setLabelPaint(Color.red); axis2.setTickLabelPaint(Color.red); axis2.setRange(-20,380); axis2.setTickUnit(new NumberTickUnit(50),false,false); NumberAxis axis3 = new NumberAxis("Degrees"); axis3.setRange(-10,190); axis3.setTickUnit(new NumberTickUnit(25),false,false); plot.setRangeAxis(axis3); plot.setSecondaryRangeAxis(0, axis2); plot.setSecondaryRangeAxisLocation(0,AxisLocation.BOTTOM_OR_RIGHT); I have 2 NumberAxis . I try to set the range for ...

11. Number of ticks on NumberAxis    jfree.org

Hi, is there a way to specify the (maximal) number of ticks, that appears on a NumberAxis? Setting a NumberTickUnit seems not a clever choise, because the AxisRange can change a lot. In the docs I found: "selectAutoTickUnit: Selects an appropriate tick value for the axis. The strategy is to display as many ticks as possible (selected from an array of ...

12. Calling autoAdjustRange() in NumberAxis    jfree.org

Perhaps I'm missing something obvious, but I'm unable to call the autoAdjustRange() method in NumberAxis due to it having protected access. How might I perform this operation? If I had something like a LogarithmicAxis object I could do it, but not so with a plain old NumberAxis. Any suggestions are greatly appreciated.

13. Ticks marks : NumberAxis - Is this a bug?    jfree.org

Tick marks are not drawn when I have large numbers in the dataset. The dataset consists of numbers such as (2.9974E+37, 2.9990E+37, 3.0007E+37, 2.9993E+37, 2.9985E+37, 2.9995E+37, 2.9998E+37, 2.9998E+37, etc) This dataset results in a tick count of 2147483647. Since we have a maximum of 500 ticks, ticks are not drawn. Any thoughts on the large tick count? Is there a bug ...

14. chart NumberAxis problem    jfree.org

15. First Tick Label for NumberAxis    jfree.org

I have a simple XYLineChart where the Y axis has an inverted range from 1 to 32. I would like to display the tick labels starting with 1 and increasing by 4. The "setTickUnit" sets the tick label interval at 4, but I cannot seem to start the tick labels at 1. Any help would be greatly appreciated. (Code below) chart ...

16. HorizontalNumberAxis replaced with NumberAxis.    jfree.org

Hi , We recently upgraded our jfreechart library to jfreechart-1.0.6.jar. We were using a very old jfreechart library and rendering XY graph using the following code, HorizontalNumberAxis horizontalNumberAxis = (HorizontalNumberAxis)plot.getHorizontalValueAxis(); Calendar dobCalendar = Calendar.getInstance(); Calendar currentCalendar = Calendar.getInstance(); dobCalendar.setTime(basicInfo.getDateOfBirth()); int currentAge = (int)CalendarUtils.getAge(currentCalendar,dobCalendar); horizontalNumberAxis.setAutoRange(false); horizontalNumberAxis.setRange(50*12,75*12); if (currentAge > 50){ horizontalNumberAxis.setRange(currentAge*12,75*12); } NumberTickUnit tickUnit = new NumberTickUnit(60); horizontalNumberAxis.setTickUnit(tickUnit); horizontalNumberAxis.setNumberFormatOverride(new ChartNumberFormat()); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); ChartPanel ...





17. BUG: HashCode in NumberAxis / Axis etc    jfree.org

Currently hashcode is this public int hashCode() { if (getLabel() != null) { return getLabel().hashCode(); } else { return 0; } } I'm caching label values as I need to hide and restore labels. Since there's no method to hide a LabelLabel (not tick Label), I'm setting values to null and storing in Map. Problem is obvious from above! Also if ...

18. Numerical problem in NumberAxis class?    jfree.org

I believe I've encountered a numerical problem in the NumberAxis class. The methods calculateLowestVisibleTickValue, calculateHighestVisibleTickValue, and calculateVisibleTickCount contain expressions of the form: 'Math.ceil(getRange().getLowerBound() / getTickUnit().getSize())' and/or 'Math.floor(getRange().getUpperBound() / getTickUnit().getSize())'. With lower bound of -0.3 and unit of 0.1, the first expression yields -2. instead of the desired -3. This is on my Windows platform using MS Visual Studio 2005. The problem ...

19. NumberAxis: How to set the "Tick" not to sticky ze    jfree.org

I want to paint a Histogram, ex: +-----------+ | +------------+ +------------+ | | +------------+------------+------------+ 19.4 20.0 20.6 21.2 I set the TickUnit=0.6 but the result is +-----------+ | +------------+ +------------+ | | +--+---------+--+-------+--+------- -+--+ 19.2 19.8 20.4 21.0 it's seem the ticks always count start from zero... and axis.setAutoRangeStickyZero(false); is useless... Is there any solution?

20. NumberAxis: How to set the "Tick" not to sticky ze    jfree.org

I want to paint a Histogram, ex: +-----------+ | +------------+ +------------+ | | +------------+------------+------------+ 19.4 20.0 20.6 21.2 I set the TickUnit=0.6 but the result is +-----------+ | +------------+ +------------+ | | +--+---------+--+-------+--+------- -+--+ 19.2 19.8 20.4 21.0 it's seem the ticks always count start from zero... and axis.setAutoRangeStickyZero(false); is useless... Is there any solution?

22. Integral values using NumberAxis    jfree.org

Hi all Im working on a charting solution at the moment, but I'm having a problem. I'm using the StackedBarRenderer3D class, and am wondering is it possible to use whole numbers instead of doubles as the numerical format for Y-Axis value labels. I'm only new to JFreeChart so am unsure as to how to go about it. Any help would be ...

23. Make NumberAxis values "wrap around"    jfree.org

Hi, I have a XYPlot that uses the XYBlockRenderer to create an intensity chart. The X (domain) axis goes from 1 to 50. The default behavior of the Axis is of course to plot "1" at the leftmost extreme and "50" at the rightmost extreme of the axis. However for my particular application, I'd like to have "1" be plotted in ...

24. Set NumberAxis setLowerBound    jfree.org

25. Showing Tick for Minimum Value on NumberAxis    jfree.org

I've tried all sorts of things, and searched the archive, but I can't find a solution for a seemingly simple issue. Is it possible to have the exact bounds of the axis displayed as tick values? i.e. if my minimum is 827 and my maximum is 47059, how can I have it display ticks at 827 and 47059, rather than it ...

26. Negative Label on NumberAxis    jfree.org

Negative Label on NumberAxis by gunjannigam Fri Aug 28, 2009 11:21 am I have a requirements of plotting values. I am using XYSereies and my domain axis is NumberAxis. I am drawing dynamic plots. The range of domain value starts from 0. I have set domain.setAutoRange(true) and domainFixedAutoRange(range). Now When I am plotting data the graph I am getting negative ...

27. Setting TickUnit on NumberAxis    jfree.org

Setting TickUnit on NumberAxis by gunjannigam Wed Sep 02, 2009 1:03 pm I am using a XYSeries graph to generate graphs in which in am having range and domain axis as NumberAxis. I am trying to set the number of ticks and fixed auto range of the graph. I am using setTickUnit(new NumberTickUnit(maxAge/10)) where domain is my my domain axis ...

28. NumberAxis small bug?    jfree.org

Hi, i come across with a "small" problem. i have a timeseries chart, and when has more than one series, no problem. no error. when i have just only one serie, and when this series has ALL the same values, the label on the left (numberaxis ) is not printing. i mean, time 0 - value 10 time 1 - value ...

29. NumberAxis with letters in label    jfree.org

30. Always show minimum value tick (NumberAxis)    jfree.org

Hi! Iv been trying to do this for a while (show a tick always at the start of the axis). Here is the problem, I have a fixed range for the value axis, and sometimes happens the following (see image): As you can see its a bit confusing, "May 10" has a 0.008 value (the range minimum value) but first tick ...