imaNNeo / fl_chart

FL Chart is a highly customizable Flutter chart library that supports Line Chart, Bar Chart, Pie Chart, Scatter Chart, and Radar Chart.
https://flchart.dev
MIT License
6.87k stars 1.78k forks source link

Is it possible to scroll? #1696

Closed kindkmj closed 5 months ago

kindkmj commented 5 months ago

** Don't make a duplicate issue. You can search in issues to make sure there isn't any already opened issue with your concern.

Is your feature request relasted to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like A clear and concise description of what you want to happen.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

I'd like to show more data at wide intervals by scrolling left and right. Is it possible??

kindkmj commented 5 months ago
  List<FlSpot> freList = [];
  List<FlSpot> reFreList = [];

  @override
  void initState() {
    freList = List.generate(100,
        (index) => FlSpot(index.toDouble(), generateRandomPositiveNumber()));
    reFreList = List.generate(100,
        (index) => FlSpot(index.toDouble(), generateRandomNegativeNumber()));
    super.initState();
  }

  double generateRandomPositiveNumber() {
    Random random = Random();
    return (random.nextInt(10) + 1).toDouble();
  }

  double generateRandomNegativeNumber() {
    Random random = Random();
    return (-(random.nextInt(10) + 1)).toDouble();
  }
 SizedBox(
                    width: 320.w,
                    height: 242.h,
                    child: LineChart(
                      LineChartData(
                          clipData: FlClipData.all(),
                          titlesData: FlTitlesData(
                            rightTitles: AxisTitles(
                              sideTitles: SideTitles(showTitles: false),
                            ),
                            topTitles: AxisTitles(
                              sideTitles: SideTitles(showTitles: false),
                            ),
                          ),
                          lineBarsData: [
                            LineChartBarData(
                              color: black80,

                              spots: freList,
                              isStrokeJoinRound: true,
                              dotData: const FlDotData(
                                show: false,
                              ),
                            ),
                            LineChartBarData(
                              color: blue100,
                              spots: reFreList,
                              isStrokeJoinRound: true,
                              dotData: const FlDotData(
                                show: false,
                              ),
                            ),
                          ]),
                    ),
                  )

it is mycode can i scroll LineChart?

kindkmj commented 5 months ago

i found #71