-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created tooltips for candles Added price line markers Added a small slider to manually adjust the current datetime by +- 10 seconds
- Loading branch information
1 parent
23f2d32
commit cc8fde8
Showing
4 changed files
with
103 additions
and
35 deletions.
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
43 changes: 43 additions & 0 deletions
43
src/main/java/com/ejo/stockdownloader/util/StockDrawUtil.java
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.ejo.stockdownloader.util; | ||
|
||
import com.ejo.glowlib.math.MathE; | ||
import com.ejo.glowlib.math.Vector; | ||
import com.ejo.glowlib.misc.ColorE; | ||
import com.ejo.glowui.util.QuickDraw; | ||
import com.ejo.stockdownloader.data.Stock; | ||
import com.ejo.stockdownloader.render.CandleUI; | ||
|
||
import java.awt.*; | ||
|
||
public class StockDrawUtil { | ||
|
||
public static void drawCandleTooltip(CandleUI candle, Vector mousePos) { | ||
Stock stock = candle.getStock(); | ||
int size = 10; | ||
double x = mousePos.getX() - 60; | ||
double y = mousePos.getY() - size * 4 - 5; | ||
|
||
if (x < 0) { | ||
x = 0; | ||
mousePos = new Vector(60,mousePos.getY()); | ||
} | ||
|
||
if (y < 0) { | ||
y = 0; | ||
mousePos = new Vector(mousePos.getX(),size * 4 + 5); | ||
} | ||
|
||
double open = MathE.roundDouble(stock.getOpen(candle.getDateTime()), 2); | ||
double close = MathE.roundDouble(stock.getClose(candle.getDateTime()), 2); | ||
double min = MathE.roundDouble(stock.getMin(candle.getDateTime()), 2); | ||
double max = MathE.roundDouble(stock.getMax(candle.getDateTime()), 2); | ||
|
||
QuickDraw.drawRect(candle.getScene(), new Vector(x - 2, y), new Vector(mousePos.getX() - x + 2, mousePos.getY() - y - 1), new ColorE(0, 125, 200, 200)); | ||
|
||
QuickDraw.drawText(candle.getScene(), "Open:" + open, new Font("Arial", Font.PLAIN, size), new Vector(x, y), ColorE.WHITE); | ||
QuickDraw.drawText(candle.getScene(), "Close:" + close, new Font("Arial", Font.PLAIN, size), new Vector(x, y + size), ColorE.WHITE); | ||
QuickDraw.drawText(candle.getScene(), "Min:" + min, new Font("Arial", Font.PLAIN, size), new Vector(x, y + size * 2), ColorE.WHITE); | ||
QuickDraw.drawText(candle.getScene(), "Max:" + max, new Font("Arial", Font.PLAIN, size), new Vector(x, y + size * 3), ColorE.WHITE); | ||
|
||
} | ||
} |
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