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

Is it possible to have the center text without a background? #79

Open
rivetingpeppermint opened this issue Jan 14, 2022 · 2 comments
Open

Comments

@rivetingpeppermint
Copy link

As shown in this image here
Screen Shot 2022-01-13 at 16 49 26

I have a ring chart, I've hidden all the legends but showed the center text. No matter what I do, the white background of this center text won't go away. Here's my code:

PieChart(
emptyColor: Colors.transparent,
key: ValueKey(1),
dataMap: <String, double>{
  "prc_1": 50,
  "prc2": 50,
},
animationDuration:
    Duration(milliseconds: 800),
chartRadius:
    MediaQuery.of(context).size.width /
                3.2 >
            300
        ? 300
        : MediaQuery.of(context)
                .size
                .width /
            3.2,
colorList: <Color>[
 Colors.blue,
  Colors.white
],
initialAngleInDegree: 270,
chartType: ChartType.ring,
centerText: 'Can we\nhave this\nwithout the\nwhite\nbackground',
centerTextStyle: TextStyle(
    fontFamily: 'Overpass'),
legendOptions: LegendOptions(
  showLegends: false,
),
chartValuesOptions: ChartValuesOptions(
  showChartValues: false,
),
ringStrokeWidth: 7.5),
@apgapg
Copy link
Owner

apgapg commented Jan 25, 2022

You can set chart value color to transparent

@DeimeralGIT
Copy link

Alternative solution
By wrapping the pie inside a stack with a center alignment you can draw anything inside your pie chart

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants