@Override public void run() { final IAxis xBottomAxis = sciChartBuilder.newNumericAxis() .withAutoRangeMode(AutoRange.Never) .withAxisTitle("Time (ms)") .withVisibleRange(new DoubleRange(2.5, 4.5)) .build(); final IAxis yRightAxis = sciChartBuilder.newNumericAxis() .withAutoRangeMode(AutoRange.Never) .withAxisTitle("Voltage (mV)") .withVisibleRange(new DoubleRange(-12.5, 12.5)) .build(); rSeries = sciChartBuilder.newLineSeries() .withDataSeries(dataSeries1) .withXAxisId(xBottomAxis.getAxisId()) .withYAxisId(yRightAxis.getAxisId()) .build(); Collections.addAll(surface.getXAxes(), xBottomAxis); Collections.addAll(surface.getYAxes(), yRightAxis); Collections.addAll(surface.getRenderableSeries(), rSeries); Collections.addAll(surface.getChartModifiers(), sciChartBuilder.newModifierGroupWithDefaultModifiers().build()); } });
@Override public void run() { Collections.addAll(surface.getXAxes(), xAxis); Collections.addAll(surface.getYAxes(), leftAxis, rightAxis); surface.getChartModifiers().add(seriesSelectionModifier); for (int i = 0; i < SERIES_COUNT; i++) { final AxisAlignment alignment = i % 2 == 0 ? AxisAlignment.Left : AxisAlignment.Right; final IDataSeries ds = generateDataSeries(alignment, i); final FastLineRenderableSeries rSeries = sciChartBuilder.newLineSeries() .withStrokeStyle(initialColor, 1f, true) .withDataSeries(ds) .withYAxisId(alignment.name()) .build(); surface.getRenderableSeries().add(rSeries); final int red = ColorUtil.red(initialColor); final int green = ColorUtil.green(initialColor); final int blue = ColorUtil.blue(initialColor); int newR = red == 255 ? 255 : red + 5; int newB = blue == 0 ? 0 : blue - 2; initialColor = ColorUtil.rgb(newR, green, newB); sciChartBuilder.newAnimator(rSeries).withSweepTransformation().withInterpolator(new DecelerateInterpolator()).withDuration(2000).withStartDelay(350).start(); } } });
public RsiPaneModel(SciChartBuilder builder, PriceSeries prices) { super(builder, RSI, "0.0", false); final XyDataSeries<Date, Double> rsiSeries = builder.newXyDataSeries(Date.class, Double.class).withSeriesName("RSI").build(); rsiSeries.append(prices.getDateData(), MovingAverage.rsi(prices, 14)); addRenderableSeries(builder.newLineSeries().withDataSeries(rsiSeries).withYAxisId(RSI).build()); Collections.addAll(annotations, builder.newAxisMarkerAnnotation().withY1(rsiSeries.getYValues().get(rsiSeries.getCount() - 1)).withYAxisId(RSI).build()); } }
.withDataSeries(lineData) .withYAxisId("primaryYAxis") .withStrokeStyle(ColorUtil.LightBlue, 2f, true) .build();
.withDataSeries(ds1) .withXAxisId(xAxis.getAxisId()) .withYAxisId(yLeftAxis1.getAxisId()) .withStrokeStyle(0xFFFF1919) .build(); .withDataSeries(ds2) .withXAxisId(xAxis.getAxisId()) .withYAxisId(yLeftAxis2.getAxisId()) .withStrokeStyle(0xFFCCCCCC) .build(); .withDataSeries(ds3) .withXAxisId(xAxis.getAxisId()) .withYAxisId(yLeftAxis3.getAxisId()) .withStrokeStyle(0xFFFC9C29) .build(); .withDataSeries(ds4) .withXAxisId(xAxis.getAxisId()) .withYAxisId(yLeftAxis4.getAxisId()) .withStrokeStyle(0xFF4083B7) .build(); .withDataSeries(ds5) .withXAxisId(xAxis.getAxisId()) .withYAxisId(yRightAxis1.getAxisId()) .withStrokeStyle(0xFF4083B7) .build();
.withDataSeries(ds1) .withXAxisId(X_BOTTOM_AXIS) .withYAxisId(Y_LEFT_AXIS) .withStrokeStyle(0xFFFF1919, 1f, true) .build(); .withDataSeries(ds2) .withXAxisId(X_BOTTOM_AXIS) .withYAxisId(Y_LEFT_AXIS) .withStrokeStyle(0xFF279B27, 1f, true) .build(); .withDataSeries(ds3) .withXAxisId(X_TOP_AXIS) .withYAxisId(Y_RIGHT_AXIS) .withStrokeStyle(0xFFFC9C29, 1f, true) .build(); .withDataSeries(ds4) .withXAxisId(X_TOP_AXIS) .withYAxisId(Y_RIGHT_AXIS) .withStrokeStyle(0xFF4083B7, 1f, true) .build();
final FastLineRenderableSeries lineSeries = sciChartBuilder.newLineSeries().withDataSeries(lineDataSeries).withYAxisId("PrimaryAxisId").build(); final FastColumnRenderableSeries columnSeries = sciChartBuilder.newColumnSeries().withDataSeries(columnDataSeries).withYAxisId("SecondaryAxisId").build(); final FastCandlestickRenderableSeries candlestickSeries = sciChartBuilder.newCandlestickSeries().withDataSeries(candlestickDataSeries).withYAxisId("PrimaryAxisId").build();
final FastLineRenderableSeries lineSeries = sciChartBuilder.newLineSeries().withDataSeries(lineDataSeries).withYAxisId("PrimaryAxisId").build(); final FastColumnRenderableSeries columnSeries = sciChartBuilder.newColumnSeries().withDataSeries(columnDataSeries).withYAxisId("SecondaryAxisId").build(); final FastCandlestickRenderableSeries candlestickSeries = sciChartBuilder.newCandlestickSeries().withDataSeries(candlestickDataSeries).withYAxisId("PrimaryAxisId").build();
.withDataSeries(ds2) .withXAxisId(xBottomAxis.getAxisId()) .withYAxisId(yRightAxis.getAxisId()) .withStrokeStyle(ColorUtil.argb(0xFF, 0x27, 0x9B, 0x27), 1f, true) .build(); .withDataSeries(ds1) .withXAxisId(xBottomAxis.getAxisId()) .withYAxisId(yLeftAxis.getAxisId()) .withStrokeStyle(ColorUtil.argb(0xFF, 0x40, 0x83, 0xB7), 1f, true) .build();
final FastLineRenderableSeries ch0 = sciChartBuilder.newLineSeries().withDataSeries(dataSeries.get(0)).withStrokeStyle(0xFFFF1919, 1f, true).withYAxisId("Ch0").build(); final FastLineRenderableSeries ch1 = sciChartBuilder.newLineSeries().withDataSeries(dataSeries.get(1)).withStrokeStyle(0xFFFC9C29, 1f, true).withYAxisId("Ch1").build(); final FastLineRenderableSeries ch2 = sciChartBuilder.newLineSeries().withDataSeries(dataSeries.get(2)).withStrokeStyle(0xFFFF1919, 1f, true).withYAxisId("Ch2").build(); final FastLineRenderableSeries ch3 = sciChartBuilder.newLineSeries().withDataSeries(dataSeries.get(3)).withStrokeStyle(0xFFFC9C29, 1f, true).withYAxisId("Ch3").build(); final FastLineRenderableSeries ch4 = sciChartBuilder.newLineSeries().withDataSeries(dataSeries.get(4)).withStrokeStyle(0xFF4083B7, 1f, true).withYAxisId("Ch4").build();
final FastLineRenderableSeries lineRenderableSeries = sciChartBuilder.newLineSeries().withDataSeries(lineDS).withStrokeStyle(0xFF279B27, 2f, true).withYAxisId("RightAxisId").build();
public PricePaneModel(SciChartBuilder builder, PriceSeries prices) { super(builder, PRICES, "$0.0000", true); // Add the main OHLC chart final OhlcDataSeries<Date, Double> stockPrices = builder.newOhlcDataSeries(Date.class, Double.class).withSeriesName("EUR/USD").build(); stockPrices.append(prices.getDateData(), prices.getOpenData(), prices.getHighData(), prices.getLowData(), prices.getCloseData()); addRenderableSeries(builder.newCandlestickSeries().withDataSeries(stockPrices).withYAxisId(PRICES).build()); final XyDataSeries<Date, Double> maLow = builder.newXyDataSeries(Date.class, Double.class).withSeriesName("Low Line").build(); maLow.append(prices.getDateData(), MovingAverage.movingAverage(prices.getCloseData(), 50)); addRenderableSeries(builder.newLineSeries().withDataSeries(maLow).withStrokeStyle(0xFFFF3333, 1f).withYAxisId(PRICES).build()); final XyDataSeries<Date, Double> maHigh = builder.newXyDataSeries(Date.class, Double.class).withSeriesName("High Line").build(); maHigh.append(prices.getDateData(), MovingAverage.movingAverage(prices.getCloseData(), 200)); addRenderableSeries(builder.newLineSeries().withDataSeries(maHigh).withStrokeStyle(0xFF33DD33, 1f).withYAxisId(PRICES).build()); Collections.addAll(annotations, builder.newAxisMarkerAnnotation().withY1(stockPrices.getYValues().get(stockPrices.getCount() - 1)).withBackgroundColor(0xFFFF3333).withYAxisId(PRICES).build(), builder.newAxisMarkerAnnotation().withY1(maLow.getYValues().get(maLow.getCount() - 1)).withBackgroundColor(0xFFFF3333).withYAxisId(PRICES).build(), builder.newAxisMarkerAnnotation().withY1(maHigh.getYValues().get(maHigh.getCount() - 1)).withBackgroundColor(0xFF33DD33).withYAxisId(PRICES).build()); } }
public PricePaneModel(SciChartBuilder builder, PriceSeries prices) { super(builder, PRICES, "$0.0000", true); // Add the main OHLC chart final OhlcDataSeries<Date, Double> stockPrices = builder.newOhlcDataSeries(Date.class, Double.class).withSeriesName("OHLC").build(); stockPrices.append(prices.getDateData(), prices.getOpenData(), prices.getHighData(), prices.getLowData(), prices.getCloseData()); addRenderableSeries(builder.newCandlestickSeries().withDataSeries(stockPrices).withYAxisId(PRICES).build()); final XyDataSeries<Date, Double> maLow = builder.newXyDataSeries(Date.class, Double.class).withSeriesName("Low Line").build(); maLow.append(prices.getDateData(), MovingAverage.movingAverage(prices.getCloseData(), 50)); addRenderableSeries(builder.newLineSeries().withDataSeries(maLow).withStrokeStyle(0xFFFF3333, 2f).withYAxisId(PRICES).build()); final XyDataSeries<Date, Double> maHigh = builder.newXyDataSeries(Date.class, Double.class).withSeriesName("High Line").build(); maHigh.append(prices.getDateData(), MovingAverage.movingAverage(prices.getCloseData(), 200)); addRenderableSeries(builder.newLineSeries().withDataSeries(maHigh).withStrokeStyle(0xFF33DD33, 2f).withYAxisId(PRICES).build()); Collections.addAll(annotations, builder.newAxisMarkerAnnotation().withY1(stockPrices.getYValues().get(stockPrices.getCount() - 1)).withBackgroundColor(0xFFFF3333).withYAxisId(PRICES).build(), builder.newAxisMarkerAnnotation().withY1(maLow.getYValues().get(maLow.getCount() - 1)).withBackgroundColor(0xFFFF3333).withYAxisId(PRICES).build(), builder.newAxisMarkerAnnotation().withY1(maHigh.getYValues().get(maHigh.getCount() - 1)).withBackgroundColor(0xFF33DD33).withYAxisId(PRICES).build()); } }
public RsiPaneModel(SciChartBuilder builder, PriceSeries prices) { super(builder, RSI, "0.0", false); final XyDataSeries<Date, Double> rsiSeries = builder.newXyDataSeries(Date.class, Double.class).withSeriesName("RSI").build(); rsiSeries.append(prices.getDateData(), MovingAverage.rsi(prices, 14)); addRenderableSeries(builder.newLineSeries().withDataSeries(rsiSeries).withStrokeStyle(0xFFC6E6FF, 1f).withYAxisId(RSI).build()); Collections.addAll(annotations, builder.newAxisMarkerAnnotation().withY1(rsiSeries.getYValues().get(rsiSeries.getCount() - 1)).withYAxisId(RSI).build()); } }