Skip to content

Commit ab105b6

Browse files
committed
Update documentation.
1 parent b192848 commit ab105b6

54 files changed

Lines changed: 352 additions & 423 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Sources/SwiftUICharts/BarChart/Models/ChartData/BarChartData.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ import SwiftUI
99

1010
/**
1111
Data for drawing and styling a standard Bar Chart.
12-
13-
1412
*/
1513
public final class BarChartData: CTBarChartDataProtocol {
1614
// MARK: Properties

Sources/SwiftUICharts/BarChart/Models/DataSet/MultiBarDataSets.swift

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,6 @@ import SwiftUI
99

1010
/**
1111
Main data set for a multi part bar charts.
12-
13-
# Example
14-
```
15-
let data = MultiBarDataSets(dataSets: [
16-
MultiBarDataSet(dataPoints: [
17-
MultiBarChartDataPoint(value: 10, group: GroupingData(title: "One", colour: .blue))
18-
]),
19-
MultiBarDataSet(dataPoints: [
20-
MultiBarChartDataPoint(value: 20, group: GroupingData(title: "One", colour: .blue))
21-
])
22-
])
23-
```
2412
*/
2513
public struct MultiBarDataSets: CTMultiDataSetProtocol {
2614

Sources/SwiftUICharts/BarChart/Models/DataSet/RangedBarDataSet.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,19 @@
77

88
import SwiftUI
99

10+
/**
11+
Data set for ranged bar charts.
12+
*/
1013
public struct RangedBarDataSet : CTRangedBarChartDataSet {
1114

1215
public var id: UUID = UUID()
1316
public var dataPoints : [RangedBarDataPoint]
1417
public var legendTitle : String
1518

16-
/// Initialises a new data set for standard Bar Charts.
19+
/// Initialises a new data set for ranged bar chart.
1720
/// - Parameters:
1821
/// - dataPoints: Array of elements.
19-
/// - legendTitle: label for the data in legend.
22+
/// - legendTitle: Label for the data in legend.
2023
public init(dataPoints : [RangedBarDataPoint],
2124
legendTitle : String = ""
2225
) {

Sources/SwiftUICharts/BarChart/Models/Datapoints/RangedBarDataPoint.swift

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77

88
import SwiftUI
99

10-
public struct RangedBarDataPoint : CTRangedBarDataPoint {
10+
/**
11+
Data for a single ranged bar chart data point.
12+
*/
13+
public struct RangedBarDataPoint: CTRangedBarDataPoint {
1114

1215
public let id : UUID = UUID()
1316
public var upperValue : Double
@@ -19,7 +22,7 @@ public struct RangedBarDataPoint : CTRangedBarDataPoint {
1922

2023
public var legendTag : String = ""
2124

22-
/// Data model for a single data point with colour for use with a bar chart.
25+
/// Data model for a single data point with colour for use with a ranged bar chart.
2326
/// - Parameters:
2427
/// - lowerValue: Value of the lower range of the data point.
2528
/// - upperValue: Value of the upper range of the data point.
@@ -29,9 +32,9 @@ public struct RangedBarDataPoint : CTRangedBarDataPoint {
2932
/// - colour: Colour styling for the fill.
3033
public init(lowerValue : Double,
3134
upperValue : Double,
32-
xAxisLabel : String? = nil,
33-
description : String? = nil,
34-
date : Date? = nil,
35+
xAxisLabel : String? = nil,
36+
description : String? = nil,
37+
date : Date? = nil,
3538
colour : ColourStyle = ColourStyle(colour: .red)
3639
) {
3740
self.upperValue = upperValue

Sources/SwiftUICharts/BarChart/Models/Protocols/BarChartProtocols.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ public protocol CTStandardBarChartDataSet: CTSingleDataSetProtocol {
7979
*/
8080
public protocol CTMultiBarChartDataSet: CTSingleDataSetProtocol {}
8181

82-
82+
/**
83+
A protocol to extend functionality of `CTSingleDataSetProtocol` specifically for Ranged Bar Charts.
84+
*/
8385
public protocol CTRangedBarChartDataSet: CTStandardBarChartDataSet {}
8486

8587

@@ -122,7 +124,6 @@ public protocol CTMultiBarDataPoint: CTBarDataPointBaseProtocol, CTStandardDataP
122124
For grouping data points together so they can be drawn in the correct groupings.
123125
*/
124126
var group : GroupingData { get set }
125-
126127
}
127128

128129

Sources/SwiftUICharts/BarChart/Models/Style/BarChartStyle.swift

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,6 @@ import SwiftUI
1313

1414
Controls the look of the chart as a whole, not including any styling
1515
specific to the data set(s),
16-
17-
# Example
18-
```
19-
BarChartStyle(infoBoxPlacement : .floating,
20-
markerType : .full,
21-
xAxisLabelPosition : .bottom,
22-
xAxisLabelsFrom : .dataPoint,
23-
yAxisLabelPosition : .leading,
24-
yAxisNumberOfLabels: 5,
25-
globalAnimation : .linear(duration: 1))
26-
```
2716
*/
2817
public struct BarChartStyle: CTBarChartStyle {
2918

@@ -65,11 +54,13 @@ public struct BarChartStyle: CTBarChartStyle {
6554
/// - xAxisLabelPosition: Location of the X axis labels - Top or Bottom.
6655
/// - xAxisLabelsFrom: Where the label data come from. DataPoint or xAxisLabels.
6756
/// - xAxisLabelColour: Text Colour for the labels on the X axis.
57+
/// - xAxisTitle: Label to display next to the chart giving info about the axis.
6858
///
6959
/// - yAxisGridStyle: Style of the horizontal lines breaking up the chart.
7060
/// - yAxisLabelPosition: Location of the X axis labels - Leading or Trailing.
7161
/// - yAxisNumberOfLabel: Number Of Labels on Y Axis.
7262
/// - yAxisLabelColour: Text Colour for the labels on the Y axis.
63+
/// - yAxisTitle: Label to display next to the chart giving info about the axis.
7364
///
7465
/// - baseline: Whether the chart is drawn from baseline of zero or the minimum datapoint value.
7566
/// - topLine: Where to finish drawing the chart from. Data set maximum or custom.

Sources/SwiftUICharts/BarChart/Views/BarChart.swift

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,22 @@ import SwiftUI
2222
as the modifiers are various types for stacks that wrap
2323
around the previous views.
2424
```
25-
.touchOverlay(chartData: data)
26-
.averageLine(chartData: data)
27-
.yAxisPOI(chartData: data)
28-
.xAxisGrid(chartData: data)
29-
.yAxisGrid(chartData: data)
30-
.xAxisLabels(chartData: data)
31-
.yAxisLabels(chartData: data)
32-
.infoBox(chartData: data)
33-
.headerBox(chartData: data)
34-
.legends(chartData: data)
25+
.touchOverlay(chartData: data)
26+
.averageLine(chartData: data,
27+
strokeStyle: StrokeStyle(lineWidth: 3,dash: [5,10]))
28+
.yAxisPOI(chartData: data,
29+
markerName: "50",
30+
markerValue: 50,
31+
lineColour: Color.blue,
32+
strokeStyle: StrokeStyle(lineWidth: 3, dash: [5,10]))
33+
.xAxisGrid(chartData: data)
34+
.yAxisGrid(chartData: data)
35+
.xAxisLabels(chartData: data)
36+
.yAxisLabels(chartData: data)
37+
.infoBox(chartData: data)
38+
.floatingInfoBox(chartData: data)
39+
.headerBox(chartData: data)
40+
.legends(chartData: data)
3541
```
3642
*/
3743
public struct BarChart<ChartData>: View where ChartData: BarChartData {

Sources/SwiftUICharts/BarChart/Views/GroupedBarChart.swift

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,22 @@ import SwiftUI
2222
as the modifiers are various types for stacks that wrap
2323
around the previous views.
2424
```
25-
.touchOverlay(chartData: data)
26-
.averageLine(chartData: data)
27-
.yAxisPOI(chartData: data)
28-
.xAxisGrid(chartData: data)
29-
.yAxisGrid(chartData: data)
30-
.xAxisLabels(chartData: data)
31-
.yAxisLabels(chartData: data)
32-
.infoBox(chartData: data)
33-
.headerBox(chartData: data)
34-
.legends(chartData: data)
25+
.touchOverlay(chartData: data)
26+
.averageLine(chartData: data,
27+
strokeStyle: StrokeStyle(lineWidth: 3,dash: [5,10]))
28+
.yAxisPOI(chartData: data,
29+
markerName: "50",
30+
markerValue: 50,
31+
lineColour: Color.blue,
32+
strokeStyle: StrokeStyle(lineWidth: 3, dash: [5,10]))
33+
.xAxisGrid(chartData: data)
34+
.yAxisGrid(chartData: data)
35+
.xAxisLabels(chartData: data)
36+
.yAxisLabels(chartData: data)
37+
.infoBox(chartData: data)
38+
.floatingInfoBox(chartData: data)
39+
.headerBox(chartData: data)
40+
.legends(chartData: data)
3541
```
3642
*/
3743
public struct GroupedBarChart<ChartData>: View where ChartData: GroupedBarChartData {

Sources/SwiftUICharts/BarChart/Views/RangedBarChart.swift

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ import SwiftUI
1010
/**
1111
View for creating a grouped bar chart.
1212

13-
Uses `GroupedBarChartData` data model.
13+
Uses `RangedBarChartData` data model.
1414

1515
# Declaration
1616
```
17-
GroupedBarChart(chartData: data, groupSpacing: 25)
17+
RangedBarChart(chartData: data)
1818
```
1919

2020
# View Modifiers
@@ -23,8 +23,13 @@ import SwiftUI
2323
around the previous views.
2424
```
2525
.touchOverlay(chartData: data)
26-
.averageLine(chartData: data)
27-
.yAxisPOI(chartData: data)
26+
.averageLine(chartData: data,
27+
strokeStyle: StrokeStyle(lineWidth: 3,dash: [5,10]))
28+
.yAxisPOI(chartData: data,
29+
markerName: "50",
30+
markerValue: 50,
31+
lineColour: Color.blue,
32+
strokeStyle: StrokeStyle(lineWidth: 3, dash: [5,10]))
2833
.xAxisGrid(chartData: data)
2934
.yAxisGrid(chartData: data)
3035
.xAxisLabels(chartData: data)

Sources/SwiftUICharts/BarChart/Views/StackedBarChart.swift

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,22 @@ import SwiftUI
2222
as the modifiers are various types for stacks that wrap
2323
around the previous views.
2424
```
25-
.touchOverlay(chartData: data)
26-
.averageLine(chartData: data)
27-
.yAxisPOI(chartData: data)
28-
.xAxisGrid(chartData: data)
29-
.yAxisGrid(chartData: data)
30-
.xAxisLabels(chartData: data)
31-
.yAxisLabels(chartData: data)
32-
.infoBox(chartData: data)
33-
.headerBox(chartData: data)
34-
.legends(chartData: data)
25+
.touchOverlay(chartData: data)
26+
.averageLine(chartData: data,
27+
strokeStyle: StrokeStyle(lineWidth: 3,dash: [5,10]))
28+
.yAxisPOI(chartData: data,
29+
markerName: "50",
30+
markerValue: 50,
31+
lineColour: Color.blue,
32+
strokeStyle: StrokeStyle(lineWidth: 3, dash: [5,10]))
33+
.xAxisGrid(chartData: data)
34+
.yAxisGrid(chartData: data)
35+
.xAxisLabels(chartData: data)
36+
.yAxisLabels(chartData: data)
37+
.infoBox(chartData: data)
38+
.floatingInfoBox(chartData: data)
39+
.headerBox(chartData: data)
40+
.legends(chartData: data)
3541
```
3642
*/
3743
public struct StackedBarChart<ChartData>: View where ChartData: StackedBarChartData {

0 commit comments

Comments
 (0)