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

No border on pie chart with a single section #1089

Closed
mentoc3000 opened this issue Jul 8, 2022 · 5 comments · Fixed by #1108
Closed

No border on pie chart with a single section #1089

mentoc3000 opened this issue Jul 8, 2022 · 5 comments · Fixed by #1108
Labels
bug Something isn't working Pie Chart

Comments

@mentoc3000
Copy link

Describe the bug
Border is not shown on pie charts that have only one section.

To Reproduce

Code that produces image below
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: Scaffold(
        body: PieChartSample(),
      ),
    );
  }
}

class PieChartSample extends StatelessWidget {
  const PieChartSample({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Center(
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          Card(
            child: SizedBox(
              height: 200,
              width: 200,
              child: PieChart(
                PieChartData(sections: showingSections(4)),
              ),
            ),
          ),
          Card(
            child: SizedBox(
              height: 200,
              width: 200,
              child: PieChart(
                PieChartData(sections: showingSections(1)),
              ),
            ),
          ),
        ],
      ),
    );
  }

  List<PieChartSectionData> showingSections(int count) {
    final sections = [
      PieChartSectionData(value: 40, borderSide: const BorderSide()),
      PieChartSectionData(value: 30, borderSide: const BorderSide()),
      PieChartSectionData(value: 15, borderSide: const BorderSide()),
      PieChartSectionData(value: 15, borderSide: const BorderSide()),
    ];
    return sections.take(count).toList();
  }
}

Screenshots
Screenshot_1657248194

Versions

  • which version of the Flutter are you using? 3.0.1
  • which version of the FlChart are you using? 0.55.0
@imaNNeo imaNNeo added bug Something isn't working Pie Chart labels Jul 31, 2022
imaNNeo pushed a commit that referenced this issue Jul 31, 2022

Verified

This commit was signed with the committer’s verified signature. The key has expired.
juliusknorr Julius Knorr
@imaNNeo imaNNeo reopened this Aug 1, 2022
@imaNNeo
Copy link
Owner

imaNNeo commented Aug 3, 2022

Fixed in 0.55.1. Check it out!

@mentoc3000
Copy link
Author

Thanks for addressing this @imaNNeoFighT! I see the border on the outside now, but shouldn't there also be a border on the inside to be consistent with the multi-section design?

Screenshot_1659701060

@imaNNeo
Copy link
Owner

imaNNeo commented Aug 5, 2022

Oh sorry. I missed that. I will fix it ASAP.

@imaNNeo
Copy link
Owner

imaNNeo commented Aug 5, 2022

It has landed on the master branch just now.
You can try it out using the below code until we bump the version up.

dependencies:

  fl_chart:
    git:
      url: git@github.com:imaNNeoFighT/fl_chart.git
      ref: master

@mentoc3000
Copy link
Author

Looks great!!

Screenshot_1659797988

This was referenced Sep 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Pie Chart
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants