Is there any option to specify Interval between values on x and y axis in flutter fl_charts?

711

LineChartData( minX: 0, maxX: 40,

                        gridData: FlGridData(
                          show: false,
                        ),
                        titlesData: FlTitlesData(
                          bottomTitles: SideTitles(
                            showTitles: true,
                            reservedSize: 22,
                            getTextStyles: (value) => const TextStyle(
                              color: CColors.pink,
                              fontWeight: FontWeight.bold,
                              fontSize: 16,
                            ),
                            margin: 10,
                            getTitles: (value) {
                              if(value.toInt() % 5 == 0){
                                return '${value.toInt()}';
                              }else{
                                return '';
                              }},
                          ),
                          leftTitles: SideTitles(
                            showTitles: true,
                            getTextStyles: (value) => const TextStyle(
                              color: CColors.pink,
                              fontWeight: FontWeight.bold,
                              fontSize: 14,
                            ),
                            getTitles: (value) {
                              if(value.toInt() % 25 == 0){
                                return '${value.toInt()}';
                              }else{
                                return '';
                              }
                              },
                              margin: 8,
                              reservedSize: 30,
                            ),
                          ),
                        borderData: FlBorderData(
                          show: true,

                        ),
                        lineBarsData: [
                          LineChartBarData(

                            spots: fl,
                            colors: [CColors.pink],
                            barWidth: 5,
                          ),
                        ],
                      ),
Share:
711
Hamza Ali
Author by

Hamza Ali

Updated on December 28, 2022

Comments

  • Hamza Ali
    Hamza Ali over 1 year

    enter image description here LineChart(

        LineChartData(
        minX: 0,
        maxX: 40,
        minY: 0,
    
        lineBarsData: [
        LineChartBarData(
    
        spots: fl,
        isCurved: true,
        barWidth: 5,
        )
        ]
        )
    

    ),

    here is my code values on x axis are overlapping. I am using fl_charts for flutter is there any option to specify intervals between axis value?