Collections.addAll(surface.getXAxes(), sciChartBuilder.newCategoryDateAxis().build()); Collections.addAll(surface.getYAxes(), sciChartBuilder.newNumericAxis().withVisibleRange(30d, 37d).build());
private void initializeOverview(final SciChartSurface surface) { surface.setRenderableSeriesAreaBorderStyle(null); final CategoryDateAxis xAxis = builder.newCategoryDateAxis() .withBarTimeFrame(SECONDS_IN_FIVE_MINUTES) .withAutoRangeMode(AutoRange.Always) .withDrawMinorGridLines(false) .withVisibility(View.GONE) .withGrowBy(0, 0.1) .build(); overviewXAxisVisibleRange = xAxis.getVisibleRange(); final NumericAxis yAxis = builder.newNumericAxis().withAutoRangeMode(AutoRange.Always).withVisibility(View.INVISIBLE).build(); removeAxisGridLines(xAxis, yAxis); final FastMountainRenderableSeries mountain = builder.newMountainSeries().withDataSeries(overviewDataSeries).build(); UpdateSuspender.using(surface, new Runnable() { @Override public synchronized void run() { Collections.addAll(surface.getXAxes(), xAxis); Collections.addAll(surface.getYAxes(), yAxis); Collections.addAll(surface.getRenderableSeries(), mountain); Collections.addAll(surface.getAnnotations(), boxAnnotation, leftBox, rightBox, leftLineGrip, rightLineGrip); } }); }
private void initializeMainChart(final SciChartSurface surface) { final CategoryDateAxis xAxis = sciChartBuilder.newCategoryDateAxis() .withBarTimeFrame(SECONDS_IN_FIVE_MINUTES) .withDrawMinorGridLines(false) .withGrowBy(0, 0.1) .build(); final NumericAxis yAxis = sciChartBuilder.newNumericAxis().withAutoRangeMode(AutoRange.Always).build(); final FastOhlcRenderableSeries ohlc = sciChartBuilder.newOhlcSeries() .withStrokeUp(STOKE_UP_COLOR, STROKE_THICKNESS) .withStrokeDown(STROKE_DOWN_COLOR, STROKE_THICKNESS) .withStrokeStyle(STOKE_UP_COLOR) .withDataSeries(ohlcDataSeries) .build(); final FastLineRenderableSeries line = sciChartBuilder.newLineSeries().withStrokeStyle(SMA_SERIES_COLOR, STROKE_THICKNESS).withDataSeries(xyDataSeries).build(); UpdateSuspender.using(surface, new Runnable() { @Override public synchronized void run() { Collections.addAll(surface.getXAxes(), xAxis); Collections.addAll(surface.getYAxes(), yAxis); Collections.addAll(surface.getRenderableSeries(), ohlc, line); Collections.addAll(surface.getAnnotations(), smaAxisMarker, ohlcAxisMarker); Collections.addAll(surface.getChartModifiers(), sciChartBuilder.newModifierGroup() .withXAxisDragModifier().build() .withZoomPanModifier().withReceiveHandledEvents(true).withXyDirection(Direction2D.XDirection).build() .withZoomExtentsModifier().build() .withLegendModifier().withOrientation(Orientation.HORIZONTAL).withPosition(Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM, 20).withReceiveHandledEvents(true).build() .build()); } }); }
int size = priceSeries.size(); final IAxis xAxis = sciChartBuilder.newCategoryDateAxis().withVisibleRange(size - 30, size).withGrowBy(0, 0.1).build(); final IAxis yAxis = sciChartBuilder.newNumericAxis().withGrowBy(0d, 0.1d).withAutoRangeMode(AutoRange.Always).build();
private void initChart(SciChartSurface surface, BasePaneModel model, boolean isMainPane) { final CategoryDateAxis xAxis = sciChartBuilder.newCategoryDateAxis() .withVisibility(isMainPane ? View.VISIBLE : View.GONE) .withVisibleRange(sharedXRange) .withGrowBy(0, 0.05) .build(); surface.getXAxes().add(xAxis); surface.getYAxes().add(model.yAxis); surface.getRenderableSeries().addAll(model.renderableSeries); surface.getChartModifiers().add(sciChartBuilder .newModifierGroup() .withXAxisDragModifier().withReceiveHandledEvents(true).withDragMode(AxisDragModifierBase.AxisDragMode.Pan).withClipModeX(ClipMode.StretchAtExtents).build() .withPinchZoomModifier().withReceiveHandledEvents(true).withXyDirection(Direction2D.XDirection).build() .withZoomPanModifier().withReceiveHandledEvents(true).build() .withZoomExtentsModifier().withReceiveHandledEvents(true).build() .withLegendModifier().withShowCheckBoxes(false).build() .build()); surface.setAnnotations(model.annotations); verticalGroup.addSurfaceToGroup(surface); }
@Override protected void initExample() { final DefaultLayoutManager layoutManager = new DefaultLayoutManager.Builder().setRightOuterAxesLayoutStrategy(new RightAlignedOuterVerticallyStackedYAxisLayoutStrategy()).build(); surface.setLayoutManager(layoutManager); final CategoryDateAxis xAxis = sciChartBuilder.newCategoryDateAxis().withGrowBy(0, 0.05).build(); surface.getXAxes().add(xAxis); final PriceSeries priceData = DataManager.getInstance().getPriceDataEurUsd(getActivity()); final PricePaneModel pricePaneModel = new PricePaneModel(sciChartBuilder, priceData); final MacdPaneModel macdPaneModel = new MacdPaneModel(sciChartBuilder, priceData); final RsiPaneModel rsiPaneModel = new RsiPaneModel(sciChartBuilder, priceData); final VolumePaneModel volumePaneModel = new VolumePaneModel(sciChartBuilder, priceData); addModel(pricePaneModel); addModel(macdPaneModel); addModel(rsiPaneModel); addModel(volumePaneModel); surface.getChartModifiers().add(sciChartBuilder .newModifierGroup() .withXAxisDragModifier().withReceiveHandledEvents(true).withDragMode(AxisDragModifierBase.AxisDragMode.Pan).withClipModeX(ClipMode.StretchAtExtents).build() .withPinchZoomModifier().withReceiveHandledEvents(true).withXyDirection(Direction2D.XDirection).build() .withZoomPanModifier().withReceiveHandledEvents(true).build() .withZoomExtentsModifier().withReceiveHandledEvents(true).build() .withLegendModifier().withShowCheckBoxes(false).build() .build()); }
Collections.addAll(surface.getXAxes(), sciChartBuilder.newCategoryDateAxis().build()); Collections.addAll(surface.getYAxes(), sciChartBuilder.newNumericAxis().withVisibleRange(30d, 37d).build()); Collections.addAll(surface.getChartModifiers(), new ZoomPanModifier());