Skip to content

Commit

Permalink
Fix #501 => add clip property for AASeriesElement
Browse files Browse the repository at this point in the history
  • Loading branch information
AAChartModel committed Oct 18, 2024
1 parent bab475f commit bbdd661
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 0 deletions.
7 changes: 7 additions & 0 deletions AAInfographics/AAChartCreator/AASeriesElement.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public class AASeriesElement: AAObject {
public var connectNulls: Bool? //Whether to connect a graph line across null points. default value:false.
public var enabledCrosshairs: Bool?
public var jitter: AAJitter? //Only useful for scatter chart and bubble chart
public var clip: Bool?

@discardableResult
public func type(_ prop: AAChartType) -> AASeriesElement {
Expand Down Expand Up @@ -390,6 +391,12 @@ public class AASeriesElement: AAObject {
return self
}

@discardableResult
public func clip(_ prop: Bool) -> AASeriesElement {
clip = prop
return self
}

public override init() {

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ class AAChartModelListVC: AABaseListVC {
"connectNullsForSingleAASeriesElementLineChart",
"largeDifferencesInTheNumberOfDataInDifferentSeriesElementLineChart",
"customDifferentDataLabelsShapeForLineChart",
"clipForAASeriesElementLineChart",
],
/*Custom Style For Spline Chart*/
[
Expand Down Expand Up @@ -432,6 +433,7 @@ class AAChartModelListVC: AABaseListVC {
"connectNullsForSingleAASeriesElementLineChart",
"largeDifferencesInTheNumberOfDataInDifferentSeriesElementLineChart",
"customDifferentDataLabelsShapeForLineChart",
"clipForAASeriesElementLineChart",
],
/*Custom Style For Spline Chart*/
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -947,4 +947,28 @@ class CustomStyleForLineChartComposer {
])
])
}



static func clipForAASeriesElementLineChart() -> AAChartModel {
AAChartModel()
.series([
AASeriesElement()
.lineWidth(15)
.clip(false)
.type(.area)
.name("Non clipped series")
.data([100, 100, 50, 50, 0, 0])
,
AASeriesElement()
.lineWidth(26)
.clip(false)
.type(.line)
.name("Clipped series")
.data([0, 0, 50, 50, 100, 100])
])
}



}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class CustomStyleForLineChartVC: AABaseChartVC {
case "connectNullsForSingleAASeriesElementLineChart": return CustomStyleForLineChartComposer.connectNullsForSingleAASeriesElementLineChart()
case "largeDifferencesInTheNumberOfDataInDifferentSeriesElementLineChart": return CustomStyleForLineChartComposer.largeDifferencesInTheNumberOfDataInDifferentSeriesElementLineChart()
case "customDifferentDataLabelsShapeForLineChart": return CustomStyleForLineChartComposer.customDifferentDataLabelsShapeForLineChart()
case "clipForAASeriesElementLineChart": return CustomStyleForLineChartComposer.clipForAASeriesElementLineChart()

default: return nil
}
Expand Down

0 comments on commit bbdd661

Please sign in to comment.