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

RadialBarSeries with rounded ends looks ugly when some legends are hidden #2105

Closed
Abhijit-Revamp opened this issue Oct 1, 2024 · 4 comments
Labels
charts Charts component solved Solved the query using existing solutions

Comments

@Abhijit-Revamp
Copy link

Bug description

Hiding points (via legends) in a RadialBarSeries with circular ends looks ugly when only 1 or 2 are visible.

Not sure if setting "maximumValue" on RadialBarSeries has more impact,

The shape becomes thick and looks bad when
cornerStyle: CornerStyle.bothCurve,
or
cornerStyle: CornerStyle.endCurve,

See the attached images

You can reproduce this in the samples:

  1. Open https://flutter.syncfusion.com
  2. Navigate to Circular chart -> Radial Bar
  3. Inside Radial Bar sample, select the option with Legend (activity tracker)
  4. Hide 2 of the 3 points

Steps to reproduce

  1. create RadialBarSeries
  2. in Data have lot of points (say 10)
  3. Add legends with toggleSeriesVisibility=true
  4. Now of the 10 values, hide 8 or 9

Code sample

Code sample
[Add your code here]

Screenshots or Video

Screenshots / Video demonstration


All points visible
image


With only 1 point visible
image
Same with `cornerStyle: CornerStyle.bothCurve`
image
One more
image

Stack Traces

Stack Traces
[Add the Stack Traces here]

On which target platforms have you observed this bug?

Web

Flutter Doctor output

Doctor output
[Add your output here]
@VijayakumarMariappan VijayakumarMariappan added charts Charts component open Open labels Oct 3, 2024
@Baranibharathip
Copy link

Hi @Abhijit-Revamp,

We have validated your query and would like to inform you that in the RadialBarSeries, the segment ring size is calculated based on the number of visible data points, radius and widget available size. When the legend is toggled, the remaining segments will always expand to fill the entire radial bar space. This is the default behavior of the RadialBarSeries. To reduce the outer radius of the series, we recommend adjusting the radius settings, which will modify the default radius of the RadialBarSeries.

For more details about radius, refer to the following UserGuide link.
Radial bar chart: https://help.syncfusion.com/flutter/circular-charts/chart-types/radial-bar-chart#changing-the-radial-bar-size

Regards,
Baranibharathi P.

@LavanyaGowtham2021 LavanyaGowtham2021 added waiting for customer response Cannot make further progress until the customer responds. and removed open Open labels Oct 24, 2024
@Abhijit-Revamp
Copy link
Author

@Baranibharathip Thanks. I had a look at that. However my data is dynamic and so are my legends.
I have already set the radius and inner radius, however when the labels hide, tracking the radius and calculating the values will be extremely tricky.
is it possible to have a flag (as an ENHANCEMENT) to keep the size of each element impact

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

Hi @Abhijit-Revamp,

We have validated your query and we would like to inform you that We have achieved your requirement using a workaround sample. In the sample, we dynamically update the inner radius of the radial bar series by checking the visible segment count in the onLegendTapped callback. We have shared code snippet and demo for your reference.

void _onLegendTapped(LegendTapArgs args) {
    setState(() {
      if (activeIndices.contains(args.pointIndex)) {
        activeIndices.remove(args.pointIndex);
      } else {
        activeIndices.add(args.pointIndex!);
      }
    });
  }
 double _calculateInnerRadius() {
    int count = activeIndices.length;
    double minRadius = 0.5;
    double maxIncrease = 0.4;
    double radiusIncrease = maxIncrease * ((data.length - count) / data.length);
    double innerRadius = minRadius + radiusIncrease;
    return innerRadius.clamp(minRadius, minRadius + maxIncrease);
  }
  @override
  Widget build(BuildContext context) {
  return SfCircularChart(
          onLegendTapped: _onLegendTapped,
          legend: const Legend(isVisible: true, isResponsive: true),
          series: <RadialBarSeries<_ChartData, String>>[
            RadialBarSeries<_ChartData, String>(
              dataSource: data,
              xValueMapper: (_ChartData data, _) => data.x,
              yValueMapper: (_ChartData data, _) => data.y,
              innerRadius: '${_calculateInnerRadius() * 100}%',
            ),
          ),

Demo:

Recording.2025-01-27.112524.mp4

Sample: GH_2105.zip

Regards,
Baranibharathi P.

@LavanyaGowtham2021 LavanyaGowtham2021 added waiting for customer response Cannot make further progress until the customer responds. and removed open Open labels Feb 20, 2025
@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 Mar 5, 2025
@LavanyaGowtham2021
Copy link
Collaborator

Please open this issue, if you need further assistance on this.

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

4 participants