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());
}
});
}