Skip to content

Commit

Permalink
Fix example.
Browse files Browse the repository at this point in the history
  • Loading branch information
liangxianzhe committed Mar 15, 2021
1 parent d2b7d6f commit 6f4c6fb
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions example/lib/line_chart/samples/line_chart_sample8.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ class _LineChartSample8State extends State<LineChartSample8> {

Future<ui.Image> loadImage(String asset) async {
final ByteData data = await rootBundle.load(asset);
final ui.Codec codec = await ui.instantiateImageCodec(data.buffer.asUint8List());
final ui.Codec codec =
await ui.instantiateImageCodec(data.buffer.asUint8List());
final ui.FrameInfo fi = await codec.getNextFrame();
return fi.image;
}
Expand Down Expand Up @@ -50,7 +51,8 @@ class _LineChartSample8State extends State<LineChartSample8> {
aspectRatio: 1.70,
child: Container(
child: Padding(
padding: const EdgeInsets.only(right: 18.0, left: 12.0, top: 24, bottom: 12),
padding: const EdgeInsets.only(
right: 18.0, left: 12.0, top: 24, bottom: 12),
child: LineChart(
mainData(imageSnapshot.data),
),
Expand Down Expand Up @@ -128,16 +130,21 @@ class _LineChartSample8State extends State<LineChartSample8> {
],
),
gridData: FlGridData(
show: true, drawVerticalLine: false, drawHorizontalLine: false, verticalInterval: 1),
show: true,
drawVerticalLine: false,
drawHorizontalLine: false,
verticalInterval: 1),
titlesData: FlTitlesData(
show: true,
bottomTitles: SideTitles(
showTitles: true,
reservedSize: 22,
getTextStyles: (value) => const TextStyle(color: Colors.black87, fontSize: 10),
getTextStyles: (value) =>
const TextStyle(color: Colors.black87, fontSize: 10),
interval: 4,
margin: 8,
checkToShowTitle: (minValue, maxValue, sideTitles, appliedInterval, value) => true,
checkToShowTitle:
(minValue, maxValue, sideTitles, appliedInterval, value) => true,
),
leftTitles: SideTitles(
interval: 2,
Expand All @@ -151,8 +158,10 @@ class _LineChartSample8State extends State<LineChartSample8> {
),
),
lineTouchData: LineTouchData(
fullHeightTouchLine: true,
getTouchedSpotIndicator: (LineChartBarData barData, List<int> spotIndexes) {
getTouchLineEnd: (data, index) => double.infinity,
touchLineEndAtDot: false,
getTouchedSpotIndicator:
(LineChartBarData barData, List<int> spotIndexes) {
return spotIndexes.map((spotIndex) {
return TouchedSpotIndicatorData(
FlLine(color: Colors.orange, strokeWidth: 3),
Expand All @@ -166,8 +175,9 @@ class _LineChartSample8State extends State<LineChartSample8> {
tooltipBgColor: Colors.blueAccent,
),
),
borderData:
FlBorderData(show: true, border: Border.all(color: const Color(0xffecf1fe), width: 1)),
borderData: FlBorderData(
show: true,
border: Border.all(color: const Color(0xffecf1fe), width: 1)),
minX: 0,
maxX: 11,
minY: 0,
Expand Down Expand Up @@ -196,7 +206,8 @@ class _LineChartSample8State extends State<LineChartSample8> {
),
belowBarData: BarAreaData(
show: false,
colors: gradientColors.map((color) => color.withOpacity(0.5)).toList(),
colors:
gradientColors.map((color) => color.withOpacity(0.5)).toList(),
),
),
],
Expand Down

0 comments on commit 6f4c6fb

Please sign in to comment.