Skip to content

[syncfusion_flutter_charts] Switching to or from DST breaks daily or weekly labels #2460

@DrNiels

Description

@DrNiels

Bug description

Using the charts to display a timespan during which a switch to or from DST occurs computes the ticks after the change wrong, either an hour to early or too late. This happens due to the implementation of _nextData in datetime_axis.dart. For the interval type week or day a duration is added. Durations in turn assume a day to have 24 hours, which is not correct during the change, as days are 23 or 25 hours long on this special occasion. You can find a suggested fix here: DrNiels@53307f3

Steps to reproduce

  1. Set your timezone to Germany/Berlin
  2. Load the code sample
  3. Check the axis

Code sample

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

void main() {
  return runApp(_ChartApp());
}

class _ChartApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(primarySwatch: Colors.blue, useMaterial3: false),
      home: _MyHomePage(),
    );
  }
}

class _MyHomePage extends StatefulWidget {
  // ignore: prefer_const_constructors_in_immutables
  _MyHomePage({Key? key}) : super(key: key);

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<_MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Syncfusion Flutter chart')),
      body: SfCartesianChart(
        primaryXAxis: DateTimeAxis(
          minimum: DateTime(2025, 10, 25),
          maximum: DateTime(2025, 10, 28),
          intervalType: DateTimeIntervalType.days,
        ),
        // Chart title
        title: ChartTitle(text: 'Half yearly sales analysis'),
        // Enable legend
        legend: Legend(isVisible: true),
        // Enable tooltip
        tooltipBehavior: TooltipBehavior(enable: true),
        series: <CartesianSeries<_SalesData, String>>[
        ],
      ),
    );
  }
}

class _SalesData {
  _SalesData(this.year, this.sales);

  final String year;
  final double sales;
}

Screenshots or Video

Screenshots / Video demonstration

Without fix:

Image

With fix:

Image

Stack Traces

Stack Traces

Not applicable

On which target platforms have you observed this bug?

Web, Android, Windows

Flutter Doctor output

Doctor output
[√] Flutter (Channel stable, 3.32.0, on Microsoft Windows [Version 10.0.19045.6456], locale de-DE) [574ms]
    • Flutter version 3.32.0 on channel stable at C:\Users\Niels\Documents\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision be698c48a6 (6 months ago), 2025-05-19 12:59:14 -0700
    • Engine revision 1881800949
    • Dart version 3.8.0
    • DevTools version 2.45.1

[√] Windows Version (10 Education 64-bit, 22H2, 2009) [2,5s]

[!] Android toolchain - develop for Android devices (Android SDK version 35.0.0) [5,8s]
    • Android SDK at C:\Users\Niels\AppData\Local\Android\Sdk
    • Platform android-35, build-tools 35.0.0
    • Java binary at: C:\Program Files\Android\Android Studio1\jbr\bin\java
      This is the JDK bundled with the latest Android Studio installation on this machine.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build 17.0.11+0--11852314)
    ! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses

[√] Chrome - develop for the web [116ms]
    • Chrome at C:\Users\Niels\AppData\Local\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.14.15 (September 2025)) [115ms]
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.14.36511.14
    • Windows 10 SDK version 10.0.26100.0

[!] Android Studio (version 2021.2) [28ms]
    • 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
    X Unable to determine bundled Java version.
    • Try updating or re-installing Android Studio.

[√] Android Studio (version 2024.1) [26ms]
    • Android Studio at C:\Program Files\Android\Android Studio1
    • 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.11+0--11852314)

[√] VS Code, 64-bit edition (version 1.104.2) [25ms]
    • VS Code at C:\Program Files\Microsoft VS Code
    • Flutter extension version 3.122.0

[√] Connected device (4 available) [563ms]
    • SM S921B (wireless) (mobile) • adb-RFCX306GLHZ-2OV7MI._adb-tls-connect._tcp. • android-arm64  • Android 16 (API 36)
    • Windows (desktop)            • windows                                       • windows-x64    • Microsoft Windows [Version 10.0.19045.6456]
    • Chrome (web)                 • chrome                                        • web-javascript • Google Chrome 142.0.7444.59
    • Edge (web)                   • edge                                          • web-javascript • Microsoft Edge 128.0.2739.42

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

! Doctor found issues in 2 categories.

Metadata

Metadata

Assignees

No one assigned

    Labels

    chartsCharts componentwaiting for customer responseCannot make further progress until the customer responds.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions