iOS & macOS charts - Examples
Please note! These examples are new to SciChart iOS v4 release! SciChart’s OpenGL ES and Metal iOS and Metal macOS Chart library ships with hundred of Objective-C and Swift iOS & macOS Chart Examples which you can browse, play with and view the source-code. All of this is possible with the new and improved SciChart iOS Examples Suite and demo application for Mac, which ships as part of the SciChart SDK.
Our Candlestick Chart with Trade Bubbles offers a powerful and intuitive way to visualize stock market data, combining rich candlestick charting with dynamic trade bubble annotations. Perfect for financial analysts and traders, this interactive chart displays price movements over time alongside trade events, giving users a quick understanding of large trades in the market.
The Swift and Objective-C source code for the iOS and macOS Candlestick with Trade Bubbles example is included below (Scroll down!).
Did you know that we have the source code for all our example available for free on Github?
Clone the SciChart.iOS.Examples from Github.
Also the SciChart iOS and Scichart macOS Trials contain the full source for the examples (link below).
CandlestickChartView.swift
View source code//******************************************************************************
// SCICHART® Copyright SciChart Ltd. 2011-2019. All rights reserved.
//
// Web: http://www.scichart.com
// Support: support@scichart.com
// Sales: sales@scichart.com
//
// CandlestickChartView.swift is part of the SCICHART® Examples. Permission is hereby granted
// to modify, create derivative works, distribute and publish any part of this source
// code whether for commercial, private or personal use.
//
// The SCICHART® examples are distributed in the hope that they will be useful, but
// without any warranty. It is provided "AS IS" without warranty of any kind, either
// expressed or implied.
//******************************************************************************
class CandlestickChartView: SCDSingleChartViewController<SCIChartSurface> {
override var associatedType: AnyClass { return SCIChartSurface.self }
override func initExample() {
let SCDPriceSeries = SCDDataManager.getPriceDataIndu()
let size = Double(SCDPriceSeries.count)
let xAxis = SCICategoryDateAxis()
xAxis.growBy = SCIDoubleRange(min: 0, max: 0.1)
xAxis.visibleRange = SCIDoubleRange(min: size - 30, max: size)
let yAxis = SCINumericAxis()
yAxis.growBy = SCIDoubleRange(min: 0.1, max: 0.1)
yAxis.autoRange = .always
let dataSeries = SCIOhlcDataSeries(xType: .date, yType: .double)
dataSeries.append(x: SCDPriceSeries.dateData, open: SCDPriceSeries.openData, high: SCDPriceSeries.highData, low: SCDPriceSeries.lowData, close: SCDPriceSeries.closeData)
let rSeries = SCIFastCandlestickRenderableSeries()
rSeries.dataSeries = dataSeries
rSeries.strokeUpStyle = SCISolidPenStyle(color: 0xFF67BDAF, thickness: 1.0)
rSeries.fillUpBrushStyle = SCISolidBrushStyle(color: 0x7767BDAF)
rSeries.strokeDownStyle = SCISolidPenStyle(color: 0xFFDC7969, thickness: 1.0)
rSeries.fillDownBrushStyle = SCISolidBrushStyle(color: 0x77DC7969)
SCIUpdateSuspender.usingWith(surface) {
self.surface.xAxes.add(xAxis)
self.surface.yAxes.add(yAxis)
self.surface.renderableSeries.add(rSeries)
self.surface.chartModifiers.add(SCDExampleBaseViewController.createDefaultModifiers())
SCIAnimations.wave(rSeries, duration: 1.0, andEasingFunction: SCICubicEase())
}
}
}
Back to iOS & macOS charts Examples


