diff --git a/lib/src/deriv_chart/chart/data_visualization/annotations/barriers/accumulators_barriers/accumulators_active_contract.dart b/lib/src/deriv_chart/chart/data_visualization/annotations/barriers/accumulators_barriers/accumulators_active_contract.dart index cf77c3d98..37c679253 100644 --- a/lib/src/deriv_chart/chart/data_visualization/annotations/barriers/accumulators_barriers/accumulators_active_contract.dart +++ b/lib/src/deriv_chart/chart/data_visualization/annotations/barriers/accumulators_barriers/accumulators_active_contract.dart @@ -3,12 +3,18 @@ class AccumulatorsActiveContract { /// Initializes [AccumulatorsActiveContract]. const AccumulatorsActiveContract({ required this.profit, - required this.currency, + required this.profitUnit, + required this.fractionalDigits, }); /// Profit value of the current contract. final double? profit; - /// The currency of the current contract. - final String? currency; + /// The profit unit label either currency or %, etc that will be shown next to + /// profit value. + final String? profitUnit; + + /// The number of decimal places to show the correct formatting of the profit + /// value. + final int fractionalDigits; } diff --git a/lib/src/deriv_chart/chart/data_visualization/annotations/barriers/accumulators_barriers/accumulators_indicator_painter.dart b/lib/src/deriv_chart/chart/data_visualization/annotations/barriers/accumulators_barriers/accumulators_indicator_painter.dart index a7b8bbf56..35de3f209 100644 --- a/lib/src/deriv_chart/chart/data_visualization/annotations/barriers/accumulators_barriers/accumulators_indicator_painter.dart +++ b/lib/src/deriv_chart/chart/data_visualization/annotations/barriers/accumulators_barriers/accumulators_indicator_painter.dart @@ -223,12 +223,14 @@ class AccumulatorIndicatorPainter extends SeriesPainter { // profit if (animatedProfit != null && animatedProfit != 0) { final TextPainter profitPainter = makeTextPainter( - '${animatedProfit < 0 ? '' : '+'}${animatedProfit.toStringAsFixed(2)}', + '${animatedProfit < 0 ? '' : '+'}${animatedProfit.toStringAsFixed( + indicator.activeContract!.fractionalDigits, + )}', style.textStyle.copyWith(color: color, fontSize: 26), ); final TextPainter currencyPainter = makeTextPainter( - indicator.activeContract?.currency ?? '', + indicator.activeContract?.profitUnit ?? '', style.textStyle.copyWith(color: color, fontSize: 14), ); diff --git a/lib/src/deriv_chart/chart/data_visualization/annotations/barriers/accumulators_barriers/accumulators_recently_closed_indicator_painter.dart b/lib/src/deriv_chart/chart/data_visualization/annotations/barriers/accumulators_barriers/accumulators_recently_closed_indicator_painter.dart index 23055014e..5e9eb83c1 100644 --- a/lib/src/deriv_chart/chart/data_visualization/annotations/barriers/accumulators_barriers/accumulators_recently_closed_indicator_painter.dart +++ b/lib/src/deriv_chart/chart/data_visualization/annotations/barriers/accumulators_barriers/accumulators_recently_closed_indicator_painter.dart @@ -84,9 +84,7 @@ class AccumulatorsRecentlyClosedIndicatorPainter // draw the transparent color. final Rect rect = Rect.fromPoints( highBarrierPosition, - Offset( - epochToX(series.barrierEndEpoch), - lowBarrierPosition.dy), + Offset(epochToX(series.barrierEndEpoch), lowBarrierPosition.dy), ); canvas.drawRect(rect, _rectPaint); @@ -183,8 +181,11 @@ class AccumulatorsRecentlyClosedIndicatorPainter if (indicator.activeContract?.profit != null) { final double profit = indicator.activeContract!.profit!; final String profitText = - '${profit < 0 ? '' : '+'}${profit.toStringAsFixed(2)}'; - final String currencyText = '${indicator.activeContract?.currency ?? ''}'; + '${profit < 0 ? '' : '+'}${profit.toStringAsFixed( + indicator.activeContract!.fractionalDigits, + )}'; + final String currencyText = + '${indicator.activeContract?.profitUnit ?? ''}'; final TextPainter profitPainter = makeTextPainter( '$profitText $currencyText', style.textStyle.copyWith(