-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add checkbox to hide extreme offers in chart #2884
Merged
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,6 +62,7 @@ | |
import javafx.scene.control.TableView; | ||
import javafx.scene.image.ImageView; | ||
import javafx.scene.layout.AnchorPane; | ||
import javafx.scene.layout.GridPane; | ||
import javafx.scene.layout.HBox; | ||
import javafx.scene.layout.Priority; | ||
import javafx.scene.layout.Region; | ||
|
@@ -146,14 +147,20 @@ public OfferBookChartView(OfferBookChartViewModel model, Navigation navigation, | |
public void initialize() { | ||
createListener(); | ||
|
||
// Header with currency combobox and checkbox to show extreme values | ||
GridPane topGrid = new GridPane(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please also remove the additional GridPane again, so we don't use more containers as necessary. |
||
|
||
// Currency combobox | ||
final Tuple3<VBox, Label, ComboBox<CurrencyListItem>> currencyComboBoxTuple = addTopLabelComboBox(Res.get("shared.currency"), | ||
Res.get("list.currency.select"), 0); | ||
this.currencyComboBox = currencyComboBoxTuple.third; | ||
this.currencyComboBox.setButtonCell(GUIUtil.getCurrencyListItemButtonCell(Res.get("shared.oneOffer"), | ||
Res.get("shared.multipleOffers"), model.preferences)); | ||
this.currencyComboBox.setCellFactory(GUIUtil.getCurrencyListItemCellFactory(Res.get("shared.oneOffer"), | ||
Res.get("shared.multipleOffers"), model.preferences)); | ||
topGrid.getChildren().add(currencyComboBoxTuple.first); | ||
|
||
// Chart | ||
createChart(); | ||
|
||
VBox.setMargin(chartPane, new Insets(0, 0, 5, 0)); | ||
|
@@ -179,8 +186,7 @@ public void initialize() { | |
tupleSell.second.setUserData(OfferPayload.Direction.SELL.name()); | ||
bottomHBox.getChildren().addAll(tupleBuy.second, tupleSell.second); | ||
|
||
|
||
root.getChildren().addAll(currencyComboBoxTuple.first, chartPane, bottomHBox); | ||
root.getChildren().addAll(topGrid, chartPane, bottomHBox); | ||
} | ||
|
||
@Override | ||
|
@@ -215,6 +221,7 @@ protected void activate() { | |
volumeColumnLabel.set(Res.get("shared.amountWithCur", code)); | ||
xAxis.setTickLabelFormatter(new StringConverter<>() { | ||
int cryptoPrecision = 3; | ||
|
||
@Override | ||
public String toString(Number object) { | ||
final double doubleValue = (double) object; | ||
|
@@ -374,18 +381,21 @@ private void updateChartData() { | |
final Supplier<Optional<? extends XYChart.Data>> optionalMinSupplier = () -> | ||
Optional.of(new XYChart.Data<>(Double.MIN_VALUE, Double.MIN_VALUE)); | ||
|
||
// Hide buy offers that are more than a factor 5 higher than the lowest buy offer | ||
final Optional<XYChart.Data> buyMaxOptional = model.getBuyData().stream() | ||
.filter(o -> (double) o.getXValue() < (double) buyMinOptional.get().getXValue() * 3) | ||
.max(Comparator.comparingDouble(o -> (double) o.getXValue())) | ||
.or(optionalMinSupplier); | ||
|
||
final Optional<XYChart.Data> sellMinOptional = model.getSellData().stream() | ||
.min(Comparator.comparingDouble(o -> (double) o.getXValue())) | ||
.or(optionalMaxSupplier); | ||
|
||
final Optional<XYChart.Data> sellMaxOptional = model.getSellData().stream() | ||
.max(Comparator.comparingDouble(o -> (double) o.getXValue())) | ||
.or(optionalMinSupplier); | ||
|
||
final Optional<XYChart.Data> sellMinOptional = model.getSellData().stream() | ||
.filter(o -> (double) o.getXValue() > (double) sellMaxOptional.get().getXValue() / 3) | ||
.min(Comparator.comparingDouble(o -> (double) o.getXValue())) | ||
.or(optionalMaxSupplier); | ||
|
||
final double minValue = Double.min((double) buyMinOptional.get().getXValue(), (double) sellMinOptional.get().getXValue()); | ||
final double maxValue = Double.max((double) buyMaxOptional.get().getXValue(), (double) sellMaxOptional.get().getXValue()); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove the translation as well