View

public extension View
  • Undocumented

    Declaration

    Swift

    @ViewBuilder
    func ifApply(_ condition: Bool, content: (Self) -> some View) -> some View
  • Set ShapeStyle for chart series

    • return: A shape filled with the color or gradient you supply.

    Usage

    let linearGradient = LinearGradient(gradient: Gradient(colors: [.red, .green, .blue]), startPoint: .bottom, endPoint: .top)
    
    .chartSeriesShapeStyle([1: AnyShapeStyle(linearGradient)])
    

    Declaration

    Swift

    func chartSeriesShapeStyle(_ value: [Int : AnyShapeStyle]) -> some View

    Parameters

    value

    the dictionary is [Series Index: AnyShapeSyle]. Key is the chart series index, Value “AnyShapeSyle” should be one of these ShapeStyle: LinearGradient, AngularGradient, RadialGradient, Color and ImagePaint. The startPoint and endPoint in LinearGradient are in the view’s user space. The image in ImagePaint should not be a vector image.

  • Set ShapeStyle for chart categories

    • return: A shape filled with the color or gradient you supply.

    Usage

    let linearGradient = LinearGradient(gradient: Gradient(colors: [.red, .green, .blue]), startPoint: .bottom, endPoint: .top)
    let angularGradient = AngularGradient(gradient: Gradient(colors: [.red, .yellow, .green, .blue, .purple, .pink]), center: UnitPoint(x: 0.50, y: 1.00), startAngle: Angle(degrees: 180.00), endAngle: Angle(degrees: 360.00))
    let radialGradient = RadialGradient(gradient: Gradient(colors: [.red, .yellow, .green, .blue, .purple, .pink]), center: .center, startRadius: 0, endRadius: 50)
    let imagePaint = ImagePaint(image: Image("flower"))
    
    .chartCategoryShapeStyle([0: [0: AnyShapeStyle(linearGradient), 1: AnyShapeStyle(Color.yellow), 2: AnyShapeStyle(angularGradient)],
                              1: [3: AnyShapeStyle(radialGradient), 4: AnyShapeStyle(imagePaint)]])
    

    Declaration

    Swift

    func chartCategoryShapeStyle(_ value: [Int : [Int : AnyShapeStyle]]) -> some View

    Parameters

    value

    the dictionary is [Series Index: [Category Index: AnyShapeSyle]]. Value “AnyShapeSyle” should be one of these ShapeStyle: LinearGradient, AngularGradient, RadialGradient, Color and ImagePaint. The startPoint and endPoint in LinearGradient are in local user space. The image in ImagePaint should not be a vector image.