MacBook-Pro:~ xun$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.0.3, on macOS 11.2.3 20D91 darwin-x64, locale
zh-Hans)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
[!] Xcode - develop for iOS and macOS
! CocoaPods 1.9.1 out of date (1.10.0 is recommended).
CocoaPods is used to retrieve the iOS and macOS platform side’s plugin
code that responds to your plugin usage on the Dart side.
Without CocoaPods, plugins will not work on iOS or macOS.
For more info, see https://flutter.dev/platform-plugins
To upgrade see
https://guides.cocoapods.org/using/getting-started.html#installation for
instructions.
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.1)
[✓] VS Code (version 1.55.2)
[✓] Connected device (2 available)
一 基本集成
折线图是一个 Widget,和普通 Widget一样声明即可:
LineChart(
sampleData(),
),
LineChart的构造参数是一个
LineChartData,其属性如下:
属性名称 | 描述 | 默认值 |
---|---|---|
lineBarsData | 图表要展示的线的数组,数组的每一位代表一条线。 | [] |
betweenBarsData | 填充2条图表线之间的区域 | [] |
titlesData | 坐标,可以设置四个方向的标题 | FlTitlesData() |
axisTitleData | 标题 | FlAxisTitleData() |
extraLinesData | 额外的水平和垂直线的图形细节 | |
lineTouchData | 触摸交互详细信息 | LineTouchDa |