Skip to content

Commit

Permalink
fix: fl_charts
Browse files Browse the repository at this point in the history
  • Loading branch information
alienc0der committed Aug 6, 2023
1 parent bff247d commit ecb33c0
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 19 deletions.
2 changes: 1 addition & 1 deletion lib/widgets/charts/pillar_rewards_chart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class PillarRewardsChartState extends State<PillarRewardsChart> {
);

List<LineChartBarData> _linesBarData() => [
StandardLineChartBarData(
LineChartBarData(
color: AppColors.znnColor,
spots: _getRewardsSpots(),
),
Expand Down
33 changes: 18 additions & 15 deletions lib/widgets/charts/realtime_txs_chart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,23 @@ class RealtimeTxsChartState extends State<RealtimeTxsChart> {

@override
Widget build(BuildContext context) {
return StandardChart(
yValuesInterval: _maxTransactionsPerDay > kNumOfChartLeftSideTitles
? _maxTransactionsPerDay / kNumOfChartLeftSideTitles
: 1,
maxY: _maxTransactionsPerDay,
lineBarsData: _linesBarData(),
lineBarDotSymbol: 'txs',
titlesReferenceDate: DateTime.now(),
convertLeftSideTitlesToInt: true,
);
return Padding(
padding: const EdgeInsets.all(10),
child: Center(
child: StandardChart(
yValuesInterval: _maxTransactionsPerDay > kNumOfChartLeftSideTitles
? _maxTransactionsPerDay / kNumOfChartLeftSideTitles
: 1,
maxY: _maxTransactionsPerDay,
titlesReferenceDate: DateTime.now(),
lineBarsData: _linesBarData(),
lineBarDotSymbol: 'txs',
convertLeftSideTitlesToInt: true,
)));
}

double _getTransactionsByDay(TokenStandard tokenId, DateTime date) {
var transactions = [];
List<AccountBlock> transactions = [];
for (var transaction in widget.transactions) {
AccountBlock? pairedAccountBlock;
if (transaction.blockType == 3 &&
Expand Down Expand Up @@ -80,13 +83,13 @@ class RealtimeTxsChartState extends State<RealtimeTxsChart> {

List<LineChartBarData> _linesBarData() {
return [
StandardLineChartBarData(
LineChartBarData(
color: ColorUtils.getTokenColor(kZnnCoin.tokenStandard),
spots: _znnSpots,
spots: _znnSpots!,
),
StandardLineChartBarData(
LineChartBarData(
color: ColorUtils.getTokenColor(kQsrCoin.tokenStandard),
spots: _qsrSpots,
spots: _qsrSpots!,
),
];
}
Expand Down
4 changes: 2 additions & 2 deletions lib/widgets/charts/sentinel_rewards_chart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ class _SentinelRewardsChart extends State<SentinelRewardsChart> {
);

List<LineChartBarData> _linesBarData() => [
StandardLineChartBarData(
LineChartBarData(
color: AppColors.znnColor,
spots: _getZnnRewardsSpots(),
),
StandardLineChartBarData(
LineChartBarData(
color: AppColors.qsrColor,
spots: _getQsrRewardsSpots(),
),
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/charts/staking_rewards_chart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class _StakingRewardsChart extends State<StakingRewardsChart> {
);

_linesBarData() => [
StandardLineChartBarData(
LineChartBarData(
color: AppColors.qsrColor,
spots: _getRewardsSpots(),
),
Expand Down

0 comments on commit ecb33c0

Please sign in to comment.