Skip to content

Stacked Column Chart does not render correctly #2311

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

Open
jackorse opened this issue Mar 19, 2025 · 1 comment
Open

Stacked Column Chart does not render correctly #2311

jackorse opened this issue Mar 19, 2025 · 1 comment
Labels
charts Charts component waiting for customer response Cannot make further progress until the customer responds.

Comments

@jackorse
Copy link

jackorse commented Mar 19, 2025

Bug description

The width and position of the columns is incorrect if some series are hidden from the legend.

Setting minimun and maximun does not fix the issue.

Steps to reproduce

  1. Create a Stacked Column Chart with some columns
  2. Toggle the visibility of some series from the legend

Code sample

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

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(AppMain());
}

class AppMain extends StatelessWidget {
  const AppMain({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: SizedBox(
          height: 600,
          width: 600,
          child: SfCartesianChart(
            legend: Legend(
              isVisible: true,
              position: LegendPosition.bottom,
            ),
            series: <StackedColumnSeries>[
              StackedColumnSeries<(int, int), int>(
                name: 'Series 1',
                dataSource: [
                  (1, 2),
                  (4, 2),
                ],
                xValueMapper: ((int, int) data, _) => data.$1,
                yValueMapper: ((int, int) data, _) => data.$2,
              ),
              StackedColumnSeries<(int, int), int>(
                name: 'Series 2',
                dataSource: [
                  (1, 3),
                  (2, 2),
                  (3, 2),
                  (4, 1),
                ],
                xValueMapper: ((int, int) data, _) => data.$1,
                yValueMapper: ((int, int) data, _) => data.$2,
              ),
              StackedColumnSeries<(int, int), int>(
                name: 'Series 3',
                dataSource: [
                  (2, 1),
                  (4, 1),
                ],
                xValueMapper: ((int, int) data, _) => data.$1,
                yValueMapper: ((int, int) data, _) => data.$2,
              )
            ],
          ),
        ),
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration

With all series enabled:
Image

Hiding series 1:
Image
Expected behaviour: columns' width and position do not change

Hiding series 2:
Image
Expected behaviour: columns do not overlap

Stack Traces

Stack Traces

No stack trace available

On which target platforms have you observed this bug?

Android

Flutter Doctor output

Doctor output
[√] Flutter (Channel stable, 3.29.2, on Microsoft Windows [Versione 10.0.22631.5039], locale it-IT) [536ms]
    • Flutter version 3.29.2 on channel stable at C:\flutter\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision c236373904 (6 days ago), 2025-03-13 16:17:06 -0400
    • Engine revision 18b71d647a
    • Dart version 3.7.2
    • DevTools version 2.42.3

[√] Windows Version (11 Home 64-bit, 23H2, 2009) [3,3s]

[√] Android toolchain - develop for Android devices (Android SDK version 35.0.0) [3,2s]
    • Android SDK at C:\Users\giaco\AppData\Local\Android\sdk
    • Platform android-35, build-tools 35.0.0
    • Java binary at: C:\Users\giaco\AppData\Local\Programs\Android Studio\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 21.0.4+-12508038-b607.1)
    • All Android licenses accepted.

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

[√] Visual Studio - develop Windows apps (Visual Studio Community 2019 16.11.44) [111ms]
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
    • Visual Studio Community 2019 version 16.11.35731.53
    • Windows 10 SDK version 10.0.18362.0

[√] Android Studio (version 2024.2) [28ms]
    • Android Studio at C:\Users\giaco\AppData\Local\Programs\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 21.0.4+-12508038-b607.1)

[√] IntelliJ IDEA Community Edition (version 2022.3) [26ms]
    • IntelliJ at C:\Users\giaco\AppData\Local\Programs\IntelliJ IDEA Community Edition
    • 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

[√] IntelliJ IDEA Ultimate Edition (version 2023.3) [25ms]
    • IntelliJ at C:\Users\giaco\AppData\Local\Programs\IntelliJ IDEA Ultimate
    • 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

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

[√] Connected device (4 available) [509ms]
    • RMX3393 (mobile)  • V8V859CMFAORCQIV • android-arm64  • Android 12 (API 31)
    • Windows (desktop) • windows          • windows-x64    • Microsoft Windows [Versione 10.0.22631.5039]
    • Chrome (web)      • chrome           • web-javascript • Google Chrome 134.0.6998.89
    • Edge (web)        • edge             • web-javascript • Microsoft Edge 133.0.3065.92

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

• No issues found!
@VijayakumarMariappan VijayakumarMariappan added charts Charts component open Open labels Mar 20, 2025
@Mugunthan-Ramalingam
Copy link
Contributor

Hi @jackorse,

We have analyzed the reported behavior regarding the inconsistent spacing in side-by-side series when X values are unordered or not uniformly aligned across different series in the SfCartesianChart.

Our current algorithm calculates spacing by checking each series separately and using the smallest gap between X values, which works well for linear and evenly spaced data. When X values are unordered or uneven, the current algorithm which calculates spacing separately for each series based on the smallest gap may not ensure consistent spacing, as it doesn’t consider the full set of X values across all series.

We have considered this scenario as a valid enhancement to improve the spacing algorithm. A feature request has been created to track this improvement:

FR Link: https://www.syncfusion.com/feedback/67624/enhance-side-by-side-series-spacing-for-non-linear-or-unordered-x-axis-values

The timeline for this enhancement is currently uncertain due to other planned release priorities, but we expect it to be included in one of our upcoming releases. We will keep you informed once it has been implemented.

We appreciate your feedback and patience. If you have any further suggestions or use cases, please feel free to share them in the comments section of the feedback link.

Regards,
Mugunthan.

@Saravanan-Madhesh Saravanan-Madhesh added waiting for customer response Cannot make further progress until the customer responds. and removed open Open labels May 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
charts Charts component waiting for customer response Cannot make further progress until the customer responds.
Projects
None yet
Development

No branches or pull requests

4 participants