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

The X-axis chart of the DST is not displayed. #323

Open
boyqian opened this issue Oct 28, 2022 · 4 comments
Open

The X-axis chart of the DST is not displayed. #323

boyqian opened this issue Oct 28, 2022 · 4 comments

Comments

@boyqian
Copy link

boyqian commented Oct 28, 2022

Incorrect description
The X-axis chart of the DST is incorrect.

Copy

The environment time is Sydney DST.
Transfer Start DST Timestamp 1680363293000 Sun Apr 2 02:34:53 AEDT 2023
Transfer end DST timestamp 1680366053000 Sun Apr 2 02:20:53 AEST 2023
Expected Behavior
The X-axis time information is displayed correctly.

Screenshot
Blank is not displayed.
Some Picture can not upload........

** System (please fill in the following information): * *

Operating system: Euler
Font used:
Other Contexts;
TimeSeriesCollection xySeriesCollection = new TimeSeriesCollection();
TimeSeries series = new TimeSeries(“seriesName”);
xySeriesCollection .addSeries(series);
JFreeChart chart =
ChartFactory.createTimeSeriesChart(title, null, null, xySeriesCollection, true, false, false);
XYPlot plot = new XYPlot();
ValueAxis valueAxis = plot.getRangeAxis();
Range range = valueAxis.getRange();
double lowerBonder = 0d;
double upperBonder = range.getUpperBound();

    upperBonder = upperBonder < 1 ? 1 : upperBonder;
    Range newRange = new Range(lowerBonder, upperBonder);
    valueAxis.setAutoRange(false);
    valueAxis.setRange(newRange);

    DateAxis axis = new DateAxis();
    axis = (DateAxis) plot.getDomainAxis();
    axis.setRangeWithMargins(startTime, endTime); // that time
    axis.setLowerMargin(X_AXIS_ALIGN);
    axis.setUpperMargin(X_AXIS_ALIGN);
    axis.setTickMarkPosition(DateTickMarkPosition.START);
    axis.setAutoRange(false);
    plot.setBackgroundPaint(Color.white);
    plot.setDomainGridlinePaint(Color.pink);
    plot.setRangeGridlinePaint(Color.pink);
    plot.setBackgroundAlpha(BACKGROUND_ALPHA);
    plot.setForegroundAlpha(BACKGROUND_ALPHA);

ChartUtils.saveChartAsPNG(new File(“fileName”), chart, 1200, 360); // and picture's X-axis chart of the DST is not displayed.

I has used 1.5.1 JfreeChart

@trashgod
Copy link
Contributor

For reference, using your timestamps and this epoch converter, I see the following event having a duration of 46 minutes; it looks like the event spans the return to standard time in Sydney.

Start: Saturday, April 01, 2023 03:34:53 PM GMT
  End: Saturday, April 01, 2023 04:20:53 PM GMT
Start: Sunday,   April 02, 2023 02:34:53 AM AEDT
  End: Sunday,   April 02, 2023 02:20:53 AM AEST

@boyqian
Copy link
Author

boyqian commented Oct 29, 2022

I tried to use the latest version of 1.5.3 to no avail. So could that be a problem~?

@boyqian
Copy link
Author

boyqian commented Oct 29, 2022

Second second = new Second(new Date(time), TimeZone.getDefault(), Locale.getDefault());
The reason is that the current time zone is used after the DST. Can the Date object be changed to the DateTimeZone object next time?

@trashgod
Copy link
Contributor

Can you get the desired result using setDateFormatOverride()?

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

2 participants