Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix or workaround date before 1900 #165

Open
kevinock opened this issue Jun 26, 2020 · 3 comments
Open

Fix or workaround date before 1900 #165

kevinock opened this issue Jun 26, 2020 · 3 comments

Comments

@kevinock
Copy link

Hello,

I work in a company, and I search help with your api to use date before 1900.

I use this code :

TimeTableXYDataset dataset = new TimeTableXYDataset();
Day day = new Day(myTime); // my time it's my date before 1900 for example 1890

I got this exception :

java.lang.IllegalArgumentException: The 'year' argument must be in range 1900 to 9999.
	at org.jfree.date.SpreadsheetDate.<init>(SpreadsheetDate.java:114)
	at org.jfree.date.SerialDate.createInstance(SerialDate.java:795)
	at org.jfree.data.time.Day.<init>(Day.java:188)
	at org.jfree.data.time.Day.<init>(Day.java:156)

This exception is on the class : org.jfree.chart.date.SpreadshhetDate
I use this dataset for build a shart : JFreeChart createTimeSeriesChart(...)

Do you have any workaround or fix for date before 1900 ?

Thank you.

@jfree
Copy link
Owner

jfree commented Jul 1, 2020

That is a bad limitation. Originally I wrote the SerialDate class to mirror the values used in spreadsheets like Excel, which start at 1900. I would like to rework all the time period classes (and the DateAxis) to use the Java Date/Time API in Java 8, but I haven't had time to start on that yet.

Perhaps as a workaround you could use the FixedMillisecond class to represent the day for your data points.

@kHasnain0
Copy link

jfree is this still an issue or is this closed?

@kHasnain0
Copy link

jfree is this still an issue or is this closed?

Confirmed issue still open

Exception in thread "main" java.lang.IllegalArgumentException: The 'year' argument must be in range 1900 to 9999.
at org.jfree.chart.date.SpreadsheetDate.(SpreadsheetDate.java:92)
at org.jfree.chart.date.SerialDate.createInstance(SerialDate.java:741)
at org.jfree.data.time.Day.(Day.java:108)
at TimeSeriesChart.main(TimeSeriesChart.java:17)

Ivy987 added a commit to Ivy987/jfreechart that referenced this issue Dec 9, 2021
Ivy987 added a commit to Ivy987/jfreechart that referenced this issue Dec 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants