mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-20 02:12:00 +01:00
Only use visible chart items for rendering price range
This commit is contained in:
parent
c3143600da
commit
6f59b7c87c
@ -236,6 +236,7 @@ class TradesChartsViewModel extends ActivatableViewModel {
|
|||||||
// create CandleData for defined time interval
|
// create CandleData for defined time interval
|
||||||
List<CandleData> candleDataList = itemsPerInterval.entrySet().stream()
|
List<CandleData> candleDataList = itemsPerInterval.entrySet().stream()
|
||||||
.map(entry -> getCandleData(entry.getKey(), entry.getValue()))
|
.map(entry -> getCandleData(entry.getKey(), entry.getValue()))
|
||||||
|
.filter(e -> e.tick >= 0)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
candleDataList.sort((o1, o2) -> (o1.tick < o2.tick ? -1 : (o1.tick == o2.tick ? 0 : 1)));
|
candleDataList.sort((o1, o2) -> (o1.tick < o2.tick ? -1 : (o1.tick == o2.tick ? 0 : 1)));
|
||||||
|
|
||||||
@ -274,11 +275,12 @@ class TradesChartsViewModel extends ActivatableViewModel {
|
|||||||
close = list.get(list.size() - 1).tradePrice;
|
close = list.get(list.size() - 1).tradePrice;
|
||||||
}
|
}
|
||||||
boolean isBullish = close > open;
|
boolean isBullish = close > open;
|
||||||
String date = tickUnit.ordinal() > TickUnit.DAY.ordinal() ?
|
final Date date = new Date(getTimeFromTickIndex(tick));
|
||||||
formatter.formatDateTime(new Date(getTimeFromTickIndex(tick))) :
|
String dateString = tickUnit.ordinal() > TickUnit.DAY.ordinal() ?
|
||||||
formatter.formatDate(new Date(getTimeFromTickIndex(tick)));
|
formatter.formatDateTime(date) :
|
||||||
|
formatter.formatDate(date);
|
||||||
return new CandleData(tick, open, close, high, low, averagePrice, accumulatedAmount, accumulatedVolume,
|
return new CandleData(tick, open, close, high, low, averagePrice, accumulatedAmount, accumulatedVolume,
|
||||||
isBullish, date);
|
isBullish, dateString);
|
||||||
}
|
}
|
||||||
|
|
||||||
long getTickFromTime(long tradeDateAsTime, TickUnit tickUnit) {
|
long getTickFromTime(long tradeDateAsTime, TickUnit tickUnit) {
|
||||||
|
Loading…
Reference in New Issue
Block a user