如何在 Flutter 中使用 fl_chart 在折线图中水平滚动?

我想在折线图中显示列表中的数据。问题是宽度太小了。所以我希望您可以水平滚动以查看所有内容。如何使用包 fl_chart 执行此操作?

这是我的代码,我从列表中构建点。

plot_df.plot.bar(ax=ax,zorder=3,cmap=cmap,rot=0)
qq568957159 回答:如何在 Flutter 中使用 fl_chart 在折线图中水平滚动?

将 LineChart 的宽度设置为您需要的宽度并将 LineChart() 小部件包装在 SingleChildScrollView() 中并设置 scrollDirection: Axis.horizontal

编辑:我认为您需要先将 LineChart() 包裹在具有固定宽度的 Container() 中。否则图表可能会尝试向无穷大延伸。

,

嗨 ? 尝试使用 horizontal listview

ListView(
  // This next line does the trick.
  scrollDirection: Axis.horizontal,children: <Widget>[

  ],)
本文链接:https://www.f2er.com/79948.html

大家都在问