-
Notifications
You must be signed in to change notification settings - Fork 848
[syncfusion_flutter_charts] The color of unselected legend was quite dark #2355
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
Comments
Hi @komhkomh, We have analyzed your case, and suspect that the toggled legend item's color may have been set too close to the chart background, making it appear very dark when unselected. Currently, we do not provide direct support for customizing the color of disabled legend items. However, you can achieve this effect by managing series visibility manually through external toggle controls that update each series isVisible property via its ChartSeriesController and customize the toggle color accordingly. This workaround gives you full control over the disabled legend appearance. We have shared a modified code snippets and sample for your reference.
Output: UG Link: Callbacks in Flutter Cartesian Charts widget | Syncfusion Please check and get back to us if you require further assistance. Sample: gh2355.zip Regards, |
Thanks! @Mugunthan-Ramalingam It's an excellent way to custom the legends. However, I used the same chartSeriesController for all series, because I needed to calculate the size of plotarea in the onActualRangeChanged method so I could set a max size for the customized trackball. Is there any way to solve this? And FYI, the color of unselected legend without legendItemBuilder is not that dark in the same background. Thanks for your time.
|
Hi @komhkomh, Query 1: The color of unselected legend without legendItemBuilder is not that dark in the same background: As mentioned in our previous update, we suspect that the toggled legend item’s color may be too close to the chart background when using legendItemBuilder, making it appear very dark when unselected. Without the legendItemBuilder, the default color is applied, which may explain the difference in appearance. Since we do not know your exact application scenario, we are unable to proceed further on this. Therefore, we kindly request you to try replicating the reported issue in the test sample attached below and share the exact scenario to replicate the issue. This will help us assist you in a better way. Query 2: I needed to calculate the size of plotarea in the onActualRangeChanged method so I could set a max size for the customized trackball: We understand your requirement to access the plot area size for customizing the trackball. We already have a knowledge base article that demonstrates how to create a customized trackball. We have shared a knowledge base article link for your reference: KB Link: How to customize the trackball in Flutter CartesianChart? In this article, you’ll find an example that shows how to access the plot area size using the parentBox.paintBounds inside the custom TrackballBehavior class. This allows you to implement features such as setting a maximum size for the trackball tooltip or line, similar to what you're trying to achieve using chartSeriesController. Here’s the relevant part from the sample: final Rect plotAreaBounds = parentBox!.paintBounds; This provides you the exact plot area boundaries without the need to rely on the chartSeriesController across all series. Sample: gh_2355.zip Please check and get back to us if you require further assistance. Regards, |
Bug description
After I updated syncfusion_flutter_charts to 29.1.39, the color of unselected legend was quite dark and barely to see if legendItemBuilder was applied.
Steps to reproduce
It happened everytime if legendItemBuilder used.
Code sample
Screenshots or Video
Stack Traces
no stack trace
On which target platforms have you observed this bug?
Android
Flutter Doctor output
[√] Flutter (Channel stable, 3.29.3, on Microsoft Windows [版本 10.0.22621.3155],
locale zh-CN) [1,399ms]
• Flutter version 3.29.3 on channel stable at
D:\flutter_windows_3.29.3-stable\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision ea121f8859 (6 weeks ago), 2025-04-11 19:10:07 +0000
• Engine revision cf56914b32
• Dart version 3.7.2
• DevTools version 2.42.3
[√] Windows Version (11 专业版 64-bit, 22H2, 2009) [5.2s]
[√] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[3.7s]
• Android SDK at D:\Android\SDK
• Platform android-35, build-tools 35.0.0
• ANDROID_SDK_ROOT = D:\Android\SDK
• Java binary at: C:\Program Files\Android\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.6+-13355223-b631.42)
• All Android licenses accepted.
[√] Chrome - develop for the web [831ms]
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[!] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.12.3)
[830ms]
• Visual Studio at D:\Microsoft Visual Studio2022
• Visual Studio Community 2022 version 17.12.35527.113
X Visual Studio is missing necessary components. Please re-run the Visual
Studio installer for the "Desktop development with C++" workload, and
include these components:
MSVC v142 - VS 2019 C++ x64/x86 build tools
- If there are multiple build tool versions available, install the
latest
C++ CMake tools for Windows
Windows 10 SDK
[√] Android Studio (version 2024.3) [16ms]
• 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 21.0.6+-13355223-b631.42)
[√] Connected device (5 available) [778ms]
• SM S9010 (mobile) • R5CTA17Q1MB • android-arm64 • Android 14 (API 34)
• sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64 • Android 12 (API 31) (emulator)
• Windows (desktop) • windows • windows-x64 • Microsoft
Windows [版本 10.0.22621.3155]
• Chrome (web) • chrome • web-javascript • Google
Chrome 136.0.7103.93
• Edge (web) • edge • web-javascript • Microsoft
Edge 136.0.3240.50
[√] Network resources [1,854ms]
• All expected network resources are available.
! Doctor found issues in 1 category.
The text was updated successfully, but these errors were encountered: