Skip to content

[syncfusion_chart] Daylight Saving Time not working as intended with daily interval #2188

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

Closed
DrNiels opened this issue Nov 27, 2024 · 6 comments
Labels
charts Charts component solved Solved the query using existing solutions

Comments

@DrNiels
Copy link

DrNiels commented Nov 27, 2024

Bug description

When using a daily DateTime x axis that bridges a change towards Daylight Saving Time, the axis is not displayed correctly. On the one hand, the day with the change towards DST should be a bit shorter. On the other hand, the maximum of the axis is not shown, propably pushed out by an hour.

Similarly, a change away from DST does not show the day as longer and has an offset after the maximum of the axis.

It seems to me like the ticks are not positioned correctly and are just placed every 24 hours, which is not correct for these days.

I use syncfusion_flutter_charts in version 27.2.4

Steps to reproduce

  1. Change your time zone to Germany (CET)
  2. Load the sample
  3. Look at the example
  4. The top chart shows a change towards DST, not showing the last hour according to maximum
  5. The middle chart is meant as a reference and does not have a change of DST
  6. The bottom chart shows a change away from DST, with an offset to the right and the 27th shown twice according to ticks, probably 00:00 and 23:00 with 24 hours between dur to DST change

Code sample

Code sample
import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_charts/charts.dart';

void main() async {
  runApp(
    MaterialApp(
      home: Chart(),
    ),
  );
}

class Chart extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => ChartState();
}

class ChartState extends State<Chart> {
  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        Expanded(
          child: SfCartesianChart(
            primaryXAxis: DateTimeAxis(
              minimum: DateTime(2024, 3, 31),
              maximum: DateTime(2024, 4, 3),
              intervalType: DateTimeIntervalType.days,
            ),
          ),
        ),
        Expanded(
          child: SfCartesianChart(
            primaryXAxis: DateTimeAxis(
              minimum: DateTime(2024, 4, 1),
              maximum: DateTime(2024, 4, 4),
              intervalType: DateTimeIntervalType.days,
            ),
          ),
        ),
        Expanded(
          child: SfCartesianChart(
            primaryXAxis: DateTimeAxis(
              minimum: DateTime(2024, 10, 26),
              maximum: DateTime(2024, 10, 30),
              intervalType: DateTimeIntervalType.days,
            ),
          ),
        ),
      ],
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration

image

Stack Traces

Stack Traces Not applicable

On which target platforms have you observed this bug?

Web

Flutter Doctor output

Doctor output
[√] Flutter (Channel stable, 3.24.4, on Microsoft Windows [Version 10.0.22631.4460], locale de-DE)
    • Flutter version 3.24.4 on channel stable at C:\Users\niels\OneDrive\Documents\GitHub\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 603104015d (5 weeks ago), 2024-10-24 08:01:25 -0700
    • Engine revision db49896cf2
    • Dart version 3.5.4
    • DevTools version 2.37.3

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
    • Android SDK at C:\Users\niels\AppData\Local\Android\sdk
    • Platform android-34, build-tools 33.0.2
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-9586694)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.8.5)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.8.34511.84
    • Windows 10 SDK version 10.0.22000.0

[√] Android Studio (version 2022.2)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-b2043.56-9586694)

[√] VS Code (version 1.95.3)
    • VS Code at C:\Users\niels\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.100.0

[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.22631.4460]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 131.0.6778.86
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 129.0.2792.79

[√] Network resources
    • All expected network resources are available.

• No issues found!
@VijayakumarMariappan VijayakumarMariappan added charts Charts component open Open labels Dec 3, 2024
@ManiKesavaraj
Copy link
Contributor

Hi @DrNiels ,

We have checked the mentioned issue and attempted to replicate the report in SfCartesianChart version 27.2.24 using the web platform you specified.

However, we were unable to reproduce it on our end. Please check the attached sample, and if you are still experiencing the issue, we request that you replicate it in the attached sample and provide us with more details regarding the specific scenario in which you are encountering this issue. This will help us to assist you more effectively.

Screenshot:

Screenshot 2024-12-12 162823

665783.zip

Regards,
Naveen K.

@DrNiels
Copy link
Author

DrNiels commented Dec 13, 2024

The issue persists with your example:
image

The relevant aspect here is the change of Daylight Saving Time. In Germany, where I'm located, the change is on 31st March and 27th October. As such, you'd need to change the local time zone of your system to Germany. Then, you should be able to reproduce the issue. Or, if you have DST where you're located, you could update the date intervals accordingly.

@Baranibharathip
Copy link

Hi @DrNiels,

We would like to let you know that currently we don’t have support for time zone in SfCartesianChart. However, we have considered your requirement as a new feature and logged feature request for it in our feedback portal.

We will prioritize the features of every release based on demand and priority. So, this feature will be available in any of our upcoming releases. You can also track the status of the feature with the feedback below.

Feedback: https://www.syncfusion.com/feedback/62812

Regards,
Baranibharathi P.

@LavanyaGowtham2021 LavanyaGowtham2021 added waiting for customer response Cannot make further progress until the customer responds. and removed open Open labels Feb 25, 2025
@DrNiels
Copy link
Author

DrNiels commented Feb 25, 2025

It's actually not really the time zone that is not supported but Daylight Saving Time. I use default DateTime with my local timezone, which just shifts due to DST in the summer.

@LavanyaGowtham2021 LavanyaGowtham2021 added open Open and removed waiting for customer response Cannot make further progress until the customer responds. labels Mar 5, 2025
@Baranibharathip
Copy link

Hi DrNiels,

We have reviewed your query and would like to inform you that the issue you're experiencing is related to Daylight Saving Time (DST) changes. During DST transitions (e.g., on March 31st and October 27th in Germany), clocks shift forward or backward by an hour. Without proper time zone handling, the chart does not account for these changes, which can lead to misaligned data points or incorrect time labels near DST transition dates.

Please refer to the following link for your reference.

Germany DST changes: https://www.timeanddate.com/time/change/germany

Enabling time zone support will automatically adjust the chart for DST changes, preventing skipped or overlapping times and ensuring accurate data representation on the date-time axis. Currently, time zone support is not available in the SfCartesianChart. However, we have already logged this requirement as a new feature request in our feedback portal.

We prioritize feature requests based on demand and priority, and this feature will be included in one of our upcoming releases. You can track the status of the feature through the following link:

Feedback: https://www.syncfusion.com/feedback/62812

Additionally, in Windows Time Zone settings, there is an option called "Adjust for daylight saving time automatically," which is enabled by default. Disabling this setting can resolve DST-related issues in charts.

Please refer to the following link and screenshot for your reference.

Set daylight saving time: https://support.microsoft.com/en-us/windows/set-time-date-and-time-zone-settings-in-windows-dfaa7122-479f-5b98-2a7b-fa0b6e01b261#bkmk_set_date_time_win11

Screenshot:

Image

Regards,
Baranibharathi P.

@Saravanan-Madhesh Saravanan-Madhesh added waiting for customer response Cannot make further progress until the customer responds. and removed open Open labels Apr 11, 2025
@LavanyaGowtham2021
Copy link
Collaborator

Please reopen this ticket, if you need further assistance with this.

@LavanyaGowtham2021 LavanyaGowtham2021 added solved Solved the query using existing solutions and removed waiting for customer response Cannot make further progress until the customer responds. labels Apr 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
charts Charts component solved Solved the query using existing solutions
Projects
None yet
Development

No branches or pull requests

6 participants