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.
SciChart’s SCIFreeSurfaceRenderableSeries3D renderable series allows you to create many different shapes of charts, one of the chart types is simple Cylindroid Chart 3D.
iOS Cylindroid 3D Charts are rendered by SCICylindroidDataSeries3D and SCIFreeSurfaceRenderableSeries3D series. With our flexible API you can set Cylindroid location & size as well as set different palette modes (Radial, Axial, Polar and Azimuthal).
You can find out more about iOS 3D Cylindroid Chart type as well as, others in SciChart iOS Library Documentation:
The Swift and Objective-C source code for the iOS and macOS Simple Cylindroid Chart 3D 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
//
// Cylindroid3DChartView.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 "Cylindroid3DChartView.h"
#import "SCDRandomUtil.h"
@implementation Cylindroid3DChartView
- (Class)associatedType { return SCIChartSurface3D.class; }
- (void)initExample {
SCINumericAxis3D *xAxis = [SCINumericAxis3D new];
xAxis.visibleRange = [[SCIDoubleRange alloc] initWithMin:-7 max:7];
SCINumericAxis3D *yAxis = [SCINumericAxis3D new];
yAxis.visibleRange = [[SCIDoubleRange alloc] initWithMin:-7 max:7];
SCINumericAxis3D *zAxis = [SCINumericAxis3D new];
zAxis.visibleRange = [[SCIDoubleRange alloc] initWithMin:-7 max:7];
const int sizeU = 40;
const int sizeV = 20;
SCICylindroidDataSeries3D *ds = [[SCICylindroidDataSeries3D alloc] initWithXZType:SCIDataType_Double yType:SCIDataType_Double uSize:sizeU vSize:sizeV];
ds.a = @(3);
ds.b = @(3);
ds.h = @(7);
for (int u = 0; u < sizeU; ++u) {
for (int v = 0; v < sizeV; ++v) {
double weight = 1.0 - ABS(2.0 * v / sizeV - 1);
double offset = 1.0 - [SCDRandomUtil nextDouble];
[ds setDisplacement:@(offset * weight) uIndex:u vIndex:v];
}
}
unsigned int colors[7] = { 0xFF00008B, 0xFF0000FF, 0xFF00FFFF, 0xFFADFF2F, 0xFFFFFF00, 0xFFFF0000, 0xFF8B0000 };
float stops[7] = { 0.0, 0.1, 0.3, 0.5, 0.7, 0.9, 1.0};
SCIGradientColorPalette *palette = [[SCIGradientColorPalette alloc] initWithColors:colors stops:stops count:7];
SCIFreeSurfaceRenderableSeries3D *rSeries = [SCIFreeSurfaceRenderableSeries3D new];
rSeries.dataSeries = ds;
rSeries.drawMeshAs = SCIDrawMeshAs_SolidWireframe;
rSeries.stroke = 0x77228B22;
rSeries.contourInterval = 0.1;
rSeries.contourStroke = 0x77228B22;
rSeries.strokeThickness = 2.0;
rSeries.lightingFactor = 0.8;
rSeries.meshColorPalette = palette;
rSeries.paletteMinMaxMode = SCIFreeSurfacePaletteMinMaxMode_Relative;
rSeries.paletteMinimum = [[SCIVector3 alloc] initWithX:3.0 y:0.0 z:0.0];
rSeries.paletteMaximum = [[SCIVector3 alloc] initWithX:4.0 y:0.0 z:0.0];
[SCIUpdateSuspender usingWithSuspendable:self.surface withBlock:^{
self.surface.xAxis = xAxis;
self.surface.yAxis = yAxis;
self.surface.zAxis = zAxis;
[self.surface.renderableSeries add:rSeries];
[self.surface.chartModifiers add:[SCDExampleBaseViewController createDefaultModifiers3D]];
[self.surface.worldDimensions assignX:200 y:200 z:200];
}];
}
@end
//******************************************************************************
// SCICHART® Copyright SciChart Ltd. 2011-2019. All rights reserved.
//
// Web: http://www.scichart.com
// Support: support@scichart.com
// Sales: sales@scichart.com
//
// Cylindroid3DChartView.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 Cylindroid3DChartView: SCDSingleChartViewController<SCIChartSurface3D> {
override var associatedType: AnyClass { return SCIChartSurface3D.self }
let SizeU: Int = 40
let SizeV: Int = 20
override func initExample() {
let xAxis = SCINumericAxis3D()
xAxis.visibleRange = SCIDoubleRange(min: -7.0, max: 7.0)
let yAxis = SCINumericAxis3D()
yAxis.visibleRange = SCIDoubleRange(min: -7.0, max: 7.0)
let zAxis = SCINumericAxis3D()
zAxis.visibleRange = SCIDoubleRange(min: -7.0, max: 7.0)
let meshDataSeries = SCICylindroidDataSeries3D(xzType: .double, yType: .double, uSize: SizeU, vSize: SizeV)
meshDataSeries.set(a: 3.0)
meshDataSeries.set(b: 3.0)
meshDataSeries.set(h: 7.0)
for u in 0 ..< SizeU {
for v in 0 ..< SizeV {
let weight = 1.0 - abs(2.0 * Double(v) / Double(SizeV) - 1.0)
let offset = 1 - SCDRandomUtil.nextDouble()
meshDataSeries.setDisplacement(offset * weight, atU: u, v: v)
}
}
let palette = SCIGradientColorPalette(
colors: [0xFF1D2C6B, 0xFF0000FF, 0xFF00FFFF, 0xFFADFF2F, 0xFFFFFF00, 0xFFFF0000, 0xFF8B0000],
stops: [0.0, 0.1, 0.3, 0.5, 0.7, 0.9, 1.0]
)
let rSeries = SCIFreeSurfaceRenderableSeries3D()
rSeries.dataSeries = meshDataSeries
rSeries.drawMeshAs = .solidWireframe
rSeries.stroke = 0x77228B22
rSeries.contourInterval = 0.1
rSeries.contourStroke = 0x77228B22
rSeries.strokeThickness = 2.0
rSeries.lightingFactor = 0.8
rSeries.meshColorPalette = palette
rSeries.paletteMinMaxMode = .relative
rSeries.paletteMinimum = SCIVector3(x: 3.0, y: 0.0, z: 0.0)
rSeries.paletteMaximum = SCIVector3(x: 4.0, y: 0.0, z: 0.0)
SCIUpdateSuspender.usingWith(surface) {
self.surface.xAxis = xAxis
self.surface.yAxis = yAxis
self.surface.zAxis = zAxis
self.surface.renderableSeries.add(rSeries)
self.surface.chartModifiers.add(SCDExampleBaseViewController.createDefaultModifiers3D())
self.surface.worldDimensions.assignX(200, y: 200, z: 200)
}
}
}