-
Notifications
You must be signed in to change notification settings - Fork 93
/
FinancialCandlestickSample.java
39 lines (33 loc) · 1.32 KB
/
FinancialCandlestickSample.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package io.fair_acc.sample.financial;
import javafx.application.Application;
import io.fair_acc.chartfx.XYChart;
import io.fair_acc.chartfx.renderer.ErrorStyle;
import io.fair_acc.chartfx.renderer.spi.ErrorDataSetRenderer;
import io.fair_acc.chartfx.renderer.spi.financial.CandleStickRenderer;
import io.fair_acc.dataset.spi.DefaultDataSet;
import io.fair_acc.dataset.spi.financial.OhlcvDataSet;
/**
* Candlestick Renderer Sample
*
* @author afischer
*/
public class FinancialCandlestickSample extends AbstractBasicFinancialApplication {
protected void prepareRenderers(XYChart chart, OhlcvDataSet ohlcvDataSet, DefaultDataSet indiSet) {
// create and apply renderers
CandleStickRenderer candleStickRenderer = new CandleStickRenderer();
candleStickRenderer.getDatasets().addAll(ohlcvDataSet);
ErrorDataSetRenderer avgRenderer = new ErrorDataSetRenderer();
avgRenderer.setDrawMarker(false);
avgRenderer.setErrorStyle(ErrorStyle.NONE);
avgRenderer.getDatasets().addAll(indiSet);
chart.getRenderers().clear();
chart.getRenderers().add(candleStickRenderer);
chart.getRenderers().add(avgRenderer);
}
/**
* @param args the command line arguments
*/
public static void main(final String[] args) {
Application.launch(args);
}
}