fl_chart icon indicating copy to clipboard operation
fl_chart copied to clipboard

reservedSize auto size

Open ninoid opened this issue 2 years ago • 5 comments

Is possible to this value have auto size?

ninoid avatar Oct 20 '22 15:10 ninoid

Same need

a1573595 avatar Jan 31 '23 00:01 a1573595

Same need

asinel avatar Feb 21 '23 10:02 asinel

@imaNNeo How is this feature progressing?

BroonDev avatar Jan 12 '24 19:01 BroonDev

For now I solved this by using AutoSizeText widget with auto size groups. Each widgets group (bottom titles group, left titles group, top, right...) use auto size text widgets with appropriate AutoSizeGroup reference. It works great!

https://pub.dev/packages/auto_size_text

bottomTitles: AxisTitles(
  sideTitles: SideTitles(
    interval: data.interval,
      showTitles: true,
         reservedSize: 30,
             getTitlesWidget: (value, meta) {
                final result = 'Some computed value';
                return SideTitleWidget(
                  axisSide: meta.axisSide,
                  space: 10,
                  angle: 0.0,
                  child: AutoSizeText(
                    result,
                    group: bottomGroup, //HERE USE UNIQUE AUTO SIZE GROUPS, (LEFT/TOP/BOTTOM/RIGHT) <--
                    maxFontSize: 11,
                    minFontSize: 8,
                    maxLines: 1,
                    overflow: TextOverflow.clip,
                    textAlign: TextAlign.center,
                    style: TextStyle(
                      color: Colors.white.withOpacity(0.55),
                      fontSize: 11,
                      fontWeight: FontWeight.w400,
                    ),
                  ),
                );
              },
            ),
          ),

ninoid avatar Jan 13 '24 07:01 ninoid

@ninoid Thank you so much.

BroonDev avatar Jan 15 '24 12:01 BroonDev