Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Osama/DERG-1441/add accumulator profit value to accumulator barriers #288

Merged
merged 29 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
70ebd09
add Accumulators tick indicator class and its painter
ramin-deriv Nov 10, 2023
1e4deb4
add profit
ramin-deriv Nov 10, 2023
883ab8e
paint barrier values as well
ramin-deriv Nov 10, 2023
b481fd7
feat: add high and low barrier display fields
ramin-deriv Nov 29, 2023
d52197a
doc: add some docs to the fields in AccumulatorTickIndicator
ramin-deriv Nov 29, 2023
3a7a5a7
add barrierSpotDistance
ramin-deriv Dec 7, 2023
d2b7607
add barrierEpoch
ramin-deriv Dec 7, 2023
7f16e79
Merge branch 'ramin/add_accumulators_tick_indicator' into osama/add-a…
osama-deriv Dec 7, 2023
23b736c
Create accumulator object
osama-deriv Dec 18, 2023
58e954d
Make paintBlinkingGlow more customizable
osama-deriv Dec 18, 2023
b693e99
rename folder
osama-deriv Dec 18, 2023
a096f0c
Implement Accumulators Barriers
osama-deriv Dec 18, 2023
d80b147
Improve play tick animation logic
osama-deriv Dec 18, 2023
f823577
remove duplication
osama-deriv Dec 18, 2023
7810863
resolve minor issue
osama-deriv Dec 19, 2023
e939ad2
minor improvement
osama-deriv Dec 19, 2023
24c4460
fix typo
osama-deriv Dec 26, 2023
8ec2be5
variable renaming
osama-deriv Dec 26, 2023
2a55a73
renaming
osama-deriv Dec 27, 2023
1b820e8
Merge branch 'osama/add-accumulator-barriers' into osama/add-accumula…
osama-deriv Dec 27, 2023
9d4fc3a
implement price label and blinking dot
osama-deriv Dec 27, 2023
081552c
implement the line for accumulators_indicator
osama-deriv Dec 28, 2023
9caf17c
make the maxCurrentTickOffset dynamic to be selected by the consumer
osama-deriv Dec 28, 2023
fee7866
implement the profit value on accumulator tick indicator
osama-deriv Dec 29, 2023
1e3b403
file format
osama-deriv Dec 29, 2023
6ded98a
fix the test
osama-deriv Dec 29, 2023
bb2a5e4
add a missing field to copy with (ChartAxisConfig)
osama-deriv Jan 2, 2024
f7ee6c6
encapsulate active contact info in accumulators_active_contract.dart …
osama-deriv Jan 3, 2024
cc3a502
update the export
osama-deriv Jan 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/deriv_chart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ library deriv_chart;

export 'generated/l10n.dart';
export 'src/deriv_chart/chart/chart.dart';
export 'src/deriv_chart/chart/data_visualization/annotations/barriers/accumulators_barriers/accumulators_barriers.dart';
export 'src/deriv_chart/chart/data_visualization/annotations/barriers/accumulators_barriers/accumulators_indicator.dart';
export 'src/deriv_chart/chart/data_visualization/annotations/barriers/accumulators_barriers/accumulators_entry_spot_barrier.dart';
export 'src/deriv_chart/chart/data_visualization/annotations/barriers/barrier.dart';
export 'src/deriv_chart/chart/data_visualization/annotations/barriers/horizontal_barrier/combined_barrier.dart';
Expand Down
5 changes: 3 additions & 2 deletions lib/src/deriv_chart/chart/chart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Chart extends StatefulWidget {
this.dataFitEnabled = false,
this.opacity = 1.0,
this.annotations,
this.chartAxisConfig,
this.chartAxisConfig = const ChartAxisConfig(),
Key? key,
}) : super(key: key);

Expand Down Expand Up @@ -81,7 +81,7 @@ class Chart extends StatefulWidget {
final double opacity;

/// Configurations for chart's axes.
final ChartAxisConfig? chartAxisConfig;
final ChartAxisConfig chartAxisConfig;

@override
State<StatefulWidget> createState() => _ChartState();
Expand Down Expand Up @@ -147,6 +147,7 @@ class _ChartState extends State<Chart> with WidgetsBindingObserver {
onVisibleAreaChanged: _onVisibleAreaChanged,
isLive: widget.isLive,
startWithDataFitMode: widget.dataFitEnabled,
maxCurrentTickOffset: widget.chartAxisConfig.maxCurrentTickOffset,
child: Column(
children: <Widget>[
Expanded(
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class AccumulatorsEntrySpotBarrier extends Barrier {
id: id,
title: title,
epoch: endingEpoch,
value: value,
quote: value,
style: style,
longLine: longLine,
);
Expand Down Expand Up @@ -87,5 +87,5 @@ class AccumulatorsEntrySpotBarrier extends Barrier {

@override
BarrierObject createObject() =>
BarrierObject(leftEpoch: startingEpoch, rightEpoch: epoch, value: value);
BarrierObject(leftEpoch: startingEpoch, rightEpoch: epoch, quote: quote);
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class AccumulatorsEntrySpotBarrierPainter<
// If previous object is null then its first load and no need to perform
// transition animation from previousObject to new object.
if (series.previousObject == null) {
animatedValue = series.value;
animatedValue = series.quote;
if (series.epoch != null) {
dotX = epochToX(series.epoch!);
}
Expand All @@ -50,8 +50,8 @@ class AccumulatorsEntrySpotBarrierPainter<
// transition animation
// from previousObject to new object
animatedValue = ui.lerpDouble(
previousBarrier.value,
series.value,
previousBarrier.quote,
series.quote,
animationInfo.currentTickPercent,
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,29 @@ import 'package:deriv_chart/deriv_chart.dart';
import 'package:deriv_chart/src/deriv_chart/chart/data_visualization/chart_series/series_painter.dart';
import 'package:deriv_chart/src/deriv_chart/chart/data_visualization/models/accumulator_object.dart';

import 'accumulators_barriers_painter.dart';
import 'accumulators_indicator_painter.dart';

/// Accumulator Barriers.
class AccumulatorBarriers extends ChartAnnotation<AccumulatorObject> {
class AccumulatorIndicator extends ChartAnnotation<AccumulatorObject> {
/// Initializes a tick indicator.
AccumulatorBarriers(
AccumulatorIndicator(
this.tick, {
required this.lowBarrier,
required this.highBarrier,
required this.highBarrierDisplay,
required this.lowBarrierDisplay,
required this.profit,
required this.barrierSpotDistance,
required this.barrierEpoch,
required this.isActiveContract,
this.profit,
this.currency,
String? id,
HorizontalBarrierStyle? style =
const HorizontalBarrierStyle(labelShape: LabelShape.pentagon),
this.labelVisibility = HorizontalBarrierVisibility.normal,
}) : super(
id ?? 'AccumulatorTickIndicator',
style: style,
);

/// The price difference between the barrier and the [tick] quote.
Expand All @@ -41,23 +46,30 @@ class AccumulatorBarriers extends ChartAnnotation<AccumulatorObject> {
final String lowBarrierDisplay;

/// [Optional] The profit value which is being shown in the middle of the tick indicator.
final String? profit;
final double? profit;

/// The currency of the current asset.
osama-deriv marked this conversation as resolved.
Show resolved Hide resolved
final String? currency;

/// The [epoch] of the tick that the barriers belong to.
final int barrierEpoch;

/// Weathers there is an active contract or not.
final bool isActiveContract;

/// Tick quote label visibility behavior.
final HorizontalBarrierVisibility labelVisibility;

@override
SeriesPainter<Series> createPainter() => AccumulatorBarriersPainter(this);
SeriesPainter<Series> createPainter() => AccumulatorIndicatorPainter(this);

@override
AccumulatorObject createObject() => AccumulatorObject(
tick: tick,
barrierEpoch: barrierEpoch,
lowBarrier: lowBarrier,
highBarrier: highBarrier,
profit: profit,
);

@override
Expand Down
Loading