iOS Charting Documentation - SciChart iOS Charts SDK v3.x

SCIPenStyle, SCIBrushStyle and SCIFontStyle

In SciChart, almost all styling methods expect an instance of either SCIPenStyle or SCIBrushStyle to be passed in. Those that deals with text styling, expect an instance of a SCIFontStyle. All these classes are designed to hold a relevant information related to drawing.

SciChart also provides the category to UIColor - UIColor(Util) - which can be used for some common conversions and retrieving partial color information.

SCIPenStyle

There are several available SCIPenStyle implementations which allow us to specify how lines should be drawn in SciChart:

Also, all SCIPenStyle implementations allows to specify the following parameters for a pen:

To create one of the SCIPenStyle instance, call an appropriate type constructor, for example:

// Solid Pen SCIPenStyle *solidPenStyle = [[SCISolidPenStyle alloc] initWithColorCode:0xFF99EE99 thickness:1.f strokeDashArray:@[@(10.f), @(3.f), @(10.f), @(3.f)] antiAliasing:YES]; // Linear Gradient Pen requires SCILinearGradientBrushStyle SCILinearGradientBrushStyle *linearGradientBrush; SCIPenStyle *linearGradientPenStyle = [[SCILinearGradientPenStyle alloc] initWithGradientStyle:linearGradientBrush antiAliasing:YES thickness:1.f strokeDashArray:nil]; // Radial Gradient Pen requires SCIRadialGradientBrushStyle SCIRadialGradientBrushStyle *radialGradientBrush; SCIPenStyle *radialGradientPenStyle = [[SCIRadialGradientPenStyle alloc] initWithGradientStyle:radialGradientBrush antiAliasing:YES thickness:1.f strokeDashArray:nil]; // Texture Pen requires SCITextureBrushStyle SCITextureBrushStyle *textureBrush; SCIPenStyle *texturedPenStyle = [[SCITexturePenStyle alloc] initWithGradientStyle:textureBrush antiAliasing:YES thickness:1.f strokeDashArray:nil];
// Solid Pen let solidPenStyle = SCISolidPenStyle(colorCode: 0xFF99EE99, thickness: 1, strokeDashArray: [10, 3, 10, 3], antiAliasing: true) // Linear Gradient Pen requires SCILinearGradientBrushStyle var linearGradientBrush: SCILinearGradientBrushStyle let linearGradientPenStyle = SCILinearGradientPenStyle(gradientStyle: linearGradientBrush, antiAliasing: true, thickness: 1, strokeDashArray: nil) // Radial Gradient Pen requires SCIRadialGradientBrushStyle var radialGradientBrush: SCIRadialGradientBrushStyle let radialGradientPenStyle = SCIRadialGradientPenStyle(gradientStyle: radialGradientBrush, antiAliasing: true, thickness: 1, strokeDashArray: nil) // Texture Pen requires SCITextureBrushStyle var textureBrush: SCITextureBrushStyle let texturedPenStyle = SCITexturePenStyle(gradientStyle: textureBrush, antiAliasing: true, thickness: 1, strokeDashArray: nil)
// Solid Pen var solidPenStyle = new SCISolidPenStyle(0xFF99EE99, 1f, true, new[] { 10f, 3f, 10f, 3f }); // Linear Gradient Pen requires SCILinearGradientBrushStyle SCILinearGradientBrushStyle linearGradientBrush; var linearGradientPenStyle = new SCILinearGradientPenStyle(linearGradientBrush, true, 1, null); // Radial Gradient Pen requires SCIRadialGradientBrushStyle SCIRadialGradientBrushStyle radialGradientBrush; var radialGradientPenStyle = new SCIRadialGradientPenStyle(radialGradientBrush, true, 1, null); // Texture Pen requires SCITextureBrushStyle SCITextureBrushStyle textureBrush; var texturedPenStyle = new SCITexturePenStyle(textureBrush, true, 1, null);

SCIBrushStyle

As to the SCIBrushStyle class, it has similar implementations as the SCIPenStyle like the following:

// Solid Brush SCIBrushStyle *solidBrushStyle = [[SCISolidBrushStyle alloc] initWithColor:UIColor.redColor]; // Linear Gradient Brush SCIBrushStyle *linearGradientBrushStyle = [[SCILinearGradientBrushStyle alloc] initWithStart:CGPointZero end:CGPointMake(0, 1) startColor:UIColor.redColor endColor:UIColor.blueColor]; // Radial Gradient Brush SCIBrushStyle *radialGradientBrushStyle = [[SCIRadialGradientBrushStyle alloc] initWithCenterColor:UIColor.redColor edgeColor:UIColor.blueColor]; // Texture Brush - SCIBitmap with Texture should be provided SCIBitmap *textureBitmap; SCIBrushStyle *textureBrushStyle = [[SCITextureBrushStyle alloc] initWithTexture:textureBitmap];
// Solid Brush let solidBrushStyle = SCISolidBrushStyle(color: .red) // Linear Gradient Brush let linearGradientBrushStyle = SCILinearGradientBrushStyle(start: .zero, end: CGPoint(x: 0, y: 1), start: .red, end: .blue) // Radial Gradient Brush let radialGradientBrushStyle = SCIRadialGradientBrushStyle(center: .red, edgeColor: .blue) // Texture Brush - SCIBitmap with Texture should be provided var textureBitmap: SCIBitmap let textureBrushStyle = SCITextureBrushStyle(texture: textureBitmap)
// Solid Brush var solidBrushStyle = new SCISolidBrushStyle(UIColor.Red); // Linear Gradient Brush var linearGradientBrushStyle = new SCILinearGradientBrushStyle(CGPoint.Empty, new CGPoint(0, 1), UIColor.Red, UIColor.Blue); // Radial Gradient Brush var radialGradientBrushStyle = new SCIRadialGradientBrushStyle(UIColor.Red, UIColor.Blue); // Texture Brush - SCIBitmap with Texture should be provided SCIBitmap textureBitmap; var textureBrushStyle = new SCITextureBrushStyle(textureBitmap);

SCIFontStyle

The SCIFontStyle type is designed to hold a relevant information related to text, such as:

NOTE: Since iOS 13, Apple deprecated creation of System Fonts using name. You can learn more about that in Apple’s WWDC - [Font Management] - Presentation

The SCIFontStyle type instances can be created in this way:

UIFontDescriptor *fontDescriptor = [UIFontDescriptor fontDescriptorWithName:@“Courier-Bold” size:14]; SCIFontStyle *fontStyle = [[SCIFontStyle alloc] initWithFontDescriptor:fontDescriptor andTextColor:UIColor.redColor];
let fontDescriptor = UIFontDescriptor(name: “c”, size: 14.0) let fontStyle = SCIFontStyle(fontDescriptor: fontDescriptor, andTextColor: .red)
var fontStyle = new SCIFontStyle(“SCIFontStyle *fontStyle”, 14, UIColor.Red),