SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components
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.
Generates an iOS bubble chart in code. See Documentation on how to use this type here: The iOS Bubble Chart Documentation.
iOS Bubble charts can be used to visualize multi-dimensional data on a 2D Chart, for example, using the Bubble size (Z property) and color can denote data of increasing importance or weight at an X-Y location.
The SCIFastBubbleRenderableSeries requires a SCIXyzDataSeries, which contains one Z-value per X-Y point. Bubble sizes can be scaled using the SCIBubbleSeriesStyle.zScaleFactor property.
The Swift and Objective-C source code for the iOS and macOS Bubble Chart 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).
//******************************************************************************
// SCICHART® Copyright SciChart Ltd. 2011-2019. All rights reserved.
//
// Web: http://www.scichart.com
// Support: support@scichart.com
// Sales: sales@scichart.com
//
// SyncMultipleChartsView.m 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.
//******************************************************************************
#import "SyncMultipleChartsView.h"
#import "SCDDataManager.h"
static int const PointsCount = 500;
@implementation SyncMultipleChartsView {
SCIDoubleRange *_sharedXRange;
SCIDoubleRange *_sharedYRange;
}
- (Class)associatedType { return SCIChartSurface.class; }
- (BOOL)showDefaultModifiersInToolbar { return NO; }
- (void)initExample {
_sharedXRange = [[SCIDoubleRange alloc] initWithMin:0 max:1];
_sharedYRange = [[SCIDoubleRange alloc] initWithMin:0 max:1];
[self initChart:self.surface1];
[self initChart:self.surface2];
}
- (void)initChart:(SCIChartSurface *)surface {
id<ISCIAxis> xAxis = [SCINumericAxis new];
xAxis.growBy = [[SCIDoubleRange alloc] initWithMin:0.1 max:0.1];
xAxis.visibleRange = _sharedXRange;
id<ISCIAxis> yAxis = [SCINumericAxis new];
yAxis.growBy = [[SCIDoubleRange alloc] initWithMin:0.1 max:0.1];
yAxis.visibleRange = _sharedYRange;
SCIXyDataSeries *dataSeries = [[SCIXyDataSeries alloc] initWithXType:SCIDataType_Double yType:SCIDataType_Double];
for (int i = 0; i < PointsCount; i++) {
[dataSeries appendX:@(i) y:@(PointsCount * sin(i * M_PI * 0.1) / i)];
}
SCIFastLineRenderableSeries *rSeries = [SCIFastLineRenderableSeries new];
rSeries.dataSeries = dataSeries;
rSeries.strokeStyle = [[SCISolidPenStyle alloc] initWithColor:SCIColor.greenColor thickness:1.0];
SCIRolloverModifier *rolloverModifier = [SCIRolloverModifier new];
rolloverModifier.receiveHandledEvents = YES;
rolloverModifier.eventsGroupTag = @"SharedEventGroup";
[SCIUpdateSuspender usingWithSuspendable:surface withBlock:^{
[surface.xAxes add:xAxis];
[surface.yAxes add:yAxis];
[surface.renderableSeries add:rSeries];
[surface.chartModifiers addAll:[SCIZoomExtentsModifier new], [SCIPinchZoomModifier new], rolloverModifier, [SCIXAxisDragModifier new], [SCIYAxisDragModifier new], nil];
[surface zoomExtents];
[SCIAnimations sweepSeries:rSeries duration:3.0 andEasingFunction:[SCICubicEase new]];
}];
}
@end
//******************************************************************************
// SCICHART® Copyright SciChart Ltd. 2011-2019. All rights reserved.
//
// Web: http://www.scichart.com
// Support: support@scichart.com
// Sales: sales@scichart.com
//
// SyncMultipleChartsView.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 SyncMultipleChartsView: SCDTwoChartsViewController<SCIChartSurface> {
override var associatedType: AnyClass { return SCIChartSurface.self }
let PointsCount = 500
let SharedXRange = SCIDoubleRange(min: 0, max: 1)
let SharedYRange = SCIDoubleRange(min: 0, max: 1)
override var showDefaultModifiersInToolbar: Bool { return false }
override func initExample() {
initChart(surface: surface1!)
initChart(surface: surface2!)
}
fileprivate func initChart(surface: SCIChartSurface) {
let xAxis = SCINumericAxis()
xAxis.growBy = SCIDoubleRange(min: 0.1, max: 0.1)
xAxis.visibleRange = SharedXRange
let yAxis = SCINumericAxis()
yAxis.growBy = SCIDoubleRange(min: 0.1, max: 0.1)
yAxis.visibleRange = SharedYRange
let dataSeries = SCIXyDataSeries(xType: .double, yType: .double)
for i in 0 ..< PointsCount {
dataSeries.append(x: i, y: Double(PointsCount) * sin(Double(i) * .pi * 0.1) / Double(i))
}
let rSeries = SCIFastLineRenderableSeries()
rSeries.dataSeries = dataSeries
rSeries.strokeStyle = SCISolidPenStyle(color: .green, thickness: 1.0)
let rolloverModifier = SCIRolloverModifier()
rolloverModifier.receiveHandledEvents = true
rolloverModifier.eventsGroupTag = "SharedEventGroup"
SCIUpdateSuspender.usingWith(surface) {
surface.xAxes.add(xAxis)
surface.yAxes.add(yAxis)
surface.renderableSeries.add(rSeries)
surface.chartModifiers.add(items: SCIZoomExtentsModifier(), SCIPinchZoomModifier(), rolloverModifier, SCIXAxisDragModifier(), SCIYAxisDragModifier())
surface.zoomExtents()
SCIAnimations.sweep(rSeries, duration: 3.0, easingFunction: SCICubicEase())
}
}
}