Quick jackets

Library of charts / diagrams for SwiftUI. Works on macOS, iOS, watchOS, and tvOS.

Demonstration project

Examples

Linear diagram

View

LineChart()
.touchOverlay()
.pointMarkers()
.averageLine(strokeStyle : StrokeStyle(lineWidth : 3, dash : [5,10])
.yAxisPOI(markerName : 50, markerValue : 50, lineColor : Red (red: 0.25, green: 0.25, blue: 1.0), strokeStyle : StrokeStyle(lineWidth: 3, dash: [5,10])
.xAxisGrid()
.yAxisGrid()
.xAxisLabels()
.yAxisLabels()
.headerBox()
.legends()
.environmentObject(data)

Data model

static function weekOfData() -> ChartData {

leave the details: ChartDataPoint] = [
ChartDataPoint(value: 20, xAxisLabel: M, LabelPoint: Monday),
ChartDataPoint(value: 90, xAxisLabel: T, LabelPoint: Tuesday),
ChartDataPoint(value: 100, xAxisLabel: W, LabelPoint: Wednesday),
ChartDataPoint(value : 75, xAxisLabel: T, LabelPoint: Thursday),
ChartDataPoint(value : 160, xAxisLabel: F, LabelPoint: Friday),
ChartDataPoint(value : 110, xAxisLabel: S, LabelPoint: Saturday),
ChartDataPoint(value : 90, xAxisLabel: S, LabelPoint: Sunday)
]

leave the metadata: ChartMetadata = ChartMetadata (title: Test Data, subtitle
: A weeks worth,
lineLegend: Data)

leave the labels on: String] = [Mon, Thu, Sun]

let gridStyle : GridStyle = GridStyle(lineColour : Color(.lightGrey).opacity(0.25),
line width : 1,
dash : CGFloat]()

Let Chart Style : ChartStyle = ChartStyle(infoBoxPlacement: .header,
yAxisGridStyle : GridStyle(lineColour : Color.primary.opacity(0.5))

let lineStyle : LineStyle = LineStyle(colors : [color(red : 1.0, green : 0.15, blue : 0.15), color(red : 1.0, green : 0.35, blue : 0.35)],
startPoint : .leading,
endPoint : .trailing,
lineType : .curvedLine,
strokeStyle : StrokeStyle(lineWidth : 3,
lineCap : .round,
lineJoin : .round))

let pointStyle: PointStyle = PointStyle(pointSize : 9, borderColour : Color.primary, lineWidth : 2, pointType : .outline, pointShape : .circle)

return ChartData(dataPoints: data,
metadata: metadata,
xAxisLabels: labels,
chartStyle: chartStyle,
lineStyle: lineStyle,
pointStyle: pointStyle
)
}

View

LineChart()
.touchOverlay(specifier: %.2f)
.yAxisGrid()
.xAxisLabels()
.yAxisLabels()
.headerBox()
.legends()
.environmentObject(data)

Data model

static function yearOfDataMonthlyAverage() -> ChartData {

var-data: GraphDataPoint] = [] let calendar = Calendar.current
let date = Date()

for an index in 1…365 {
must be the value : Double = Double(Int.random(in: -100…100))
let date = calendar.date(byAdding : .day, value : index, to : date)
data.append(ChartDataPoint(value : value, date : date))
}

leave the metadata: ChartMetadata = Chart Metadata (title: Test data,
subtitle: The value of a year – Monthly average,
lineLegend : Data)

leave the labels on: String] = [Jan, Feb, Mar, April, May, June, Jul, Aug, Sep, Oct, Nov, Dec]

Let Chart Style : ChartStyle = ChartStyle(infoBoxPlacement: .header,
yAxisGridStyle : GridStyle(lineColour : Color.primary.opacity(0.5))

let lineStyle : LineStyle = LineStyle(color: Color(red: 0.15, green: 0.15, blue: 1.0),
lineType: .curvedLine,
strokeStyle: StrokeStyle(linWidth: 3,
lineCap: .round,
lineJoin: .round))

return ChartData(dataPoints: data,
metadata: metadata,
xAxisLabels: labels,
chartStyle: chartStyle,
lineStyle: lineStyle, calculations
: .averageMonth)
}

Bar graph

View

BarChart()
.touchOverlay()
.averageLine(marker name : Average, lineColor : Color.primary, strokeStyle : StrokeStyle(lineWidth : 2, dash : [5, 10])
.yAxisGrid()
.xAxisLabels()
.yAxisLabels()
.headerBox()
.legends()
.environmentObject(data)

Data model

static function weekOfData() -> ChartData {

leave the details: ChartDataPoint] = [
ChartDataPoint(value: 20, xAxisLabel: M, LabelPoint: Monday),
ChartDataPoint(value: 90, xAxisLabel: T, LabelPoint: Tuesday),
ChartDataPoint(value: 100, xAxisLabel: W, LabelPoint: Wednesday),
ChartDataPoint(value : 75, xAxisLabel: T, LabelPoint: Thursday),
ChartDataPoint(value : 160, xAxisLabel: F, LabelPoint: Friday),
ChartDataPoint(value : 110, xAxisLabel: S, LabelPoint: Saturday),
ChartDataPoint(value : 90, xAxisLabel: S, LabelPoint: Sunday)
]

leave the metadata: ChartMetadata = ChartMetadata (title: Test Data, subtitle
: A weeks worth,
lineLegend: Data)

let gridStyle : GridStyle = GridStyle(lineColour : Colour(.lightGrey), line
Width : 1)

Let Chart Style : ChartStyle = ChartStyle (infoBoxPlacement: .header,
xAxisGridStyle: gridStyle,
yAxisGridStyle: gridStyle)

let barStyle: BarStyle = BarStyle(barWidth: 0.5,
colorFrom: .barStyle,
colors: [color (red: 1.0, green: 0.15, blue: 0.15),
color (red: 1.0, green: 0.35, blue: 0.35)],
start point: .bottom,
end point: .top].

Return ChartData(dataPoints: data,
metadata: metadata,
chartStyle: chartStyle,
barStyle: barStyle)
}

View

BarChart()
.touchOverlay()
.averageLine(marker name : Average, lineColor : Color.primary, strokeStyle : StrokeStyle(lineWidth : 2, dash : [5, 10])
.yAxisGrid()
.xAxisLabels()
.yAxisLabels()
.headerBox()
.legends()
.environmentObject(data)

Data model

static function weekOfData() -> ChartData {

leave the details: ChartDataPoint] = [
ChartDataPoint(value : 70, xAxisLabel : M, pointLabel : Monday , color : Color(.systemRed)),
ChartDataPoint(value : 40, xAxisLabel : T, pointLabel : Tuesday , color : Color(.systemBlue)),
ChartDataPoint(value: 90, xAxisLabel: W, pointLabel: Wednesday , Color : Color(.systemGreen)),
ChartDataPoint(value: 35, xAxisLabel: T, pointLabel: Thursday , Color: Color(.systemOrange)),
ChartDataPoint(value: 60, xAxisLabel: F, pointLabel: Friday , Color : Color(.systemTeal)),
ChartDataPoint(value: 110, xAxisLabel: S, pointLabel: Saturday , Color : Color(.systemPurple)),
ChartDataPoint(value: 40, xAxisLabel: S, pointLabel: Sunday , Color : Color(.systemYellow))
]

leave the metadata: ChartMetadata = ChartMetadata (title: Test Data, subtitle
: A weeks worth,
lineLegend: Data)

let gridStyle : GridStyle = GridStyle(lineColour : Colour(.lightGrey), line
Width : 1)

Let Chart Style : ChartStyle = ChartStyle(infoBoxPlacement: .header,
xAxisGridStyle: gridStyle,
yAxisGridStyle: gridStyle,
xAxisLabelsFrom: .dataPoint)

let barStyle: BarStyle = BarStyle(barWidth: 1,
color: .dataPoints,
color: [color (red: 1.0, green: 0.15, blue: 0.15),
color (red: 1.0, green: 0.35, blue: 0.35)],
start point: .bottom,
end point: .top].

Return ChartData(dataPoints: data,
metadata: metadata,
chartStyle: chartStyle,
barStyle: barStyle
)
)

Documentation

All data and most styles are transferred to the view through the Environment object. See ChartData.

.environmentObject(data)

Display modifiers

Touch pad

Detects entry by touching the pointer. Determines the closest data point and displays the associated information.

The position of the information field is set to ChartStyle.

.touchOverlay(specification:string)

  • Specifier : Decimal accuracy for labels

ChartData setting –> Chart Style

Scorer

Place markers at each data point.

.pointMarkers()

Setting up ChartData –> PointStyle

centre line

Displays the benchmark line averaged over all data points.

.averageLine(markerName : String = Medium,
StringColor : Color = Primary color,
strokeStyle : StrokeStyle = StrokeStyle(lineWidth: 2,
lineCap: .round,
lineJoint: .round,
mitreLimit: 10,
dash: [CGFloat](),
dashPhase: 0)

  • MarkName: The name of the marker, for the legend…
  • lineColour : Line color
  • Type of stroke: Type of stroke.

Y-axis point

Adaptable point of interest

.yAxisPOI(markerName : String = Medium,
StringColor : Color = Primary color,
strokeStyle : StrokeStyle = StrokeStyle(lineWidth: 2,
lineCap: .round,
lineJoint: .round,
mitreLimit: 10,
dash: [CGFloat](),
dashPhase: 0)

  • MarkName: The name of the marker, for the legend…
  • markerValue: Selected item.
  • lineColour : Line color
  • Type of stroke: Type of stroke.

X-axis grating

Adds vertical lines along the X axis.

.xAxisGrid()

Configure in ChartData –> ChartStyle –> GridStyle.

Y-axis grid

Adds horizontal lines along the Y axis.

.yAxisGrid()

Configure in ChartData –> ChartStyle –> GridStyle.

X-axis markers

Labels for the X axis.

.xAxisLabels()

Configuration in ChartData –> ChartStyle –> XAxisLabelSetup

Y-axis markers

Automatically generated labels for the Y axis

.yAxisLabels(specify: String = %.0f)

  • Specifier : Specification of decimal precision.

Configuration in ChartData –> ChartStyle –> YAxisLabelSetup

Displays metadata about images. See. ChartMetadata

.headerBox()

Legends

The legends of the data displayed in the chart (see ChartMetadata ) and any markings (see centerline and Y-axis point).

.legends()

Place markers at each data point.

Data models

ChartData

Most configurations are done in the ChartData type. The only initializer needed is the dataPoints.

ChartData(dataPoints : ChartDataPoint],
metadata : ChartMetadata ?,
xAxisLabels : String] ?,
chartStyle : ChartStyle,
lineStyle : LineStyle,
barStyle : BarStyle,
pointStyle : PointStyle, calculation
: CalculationType)

  • dataPoints : ChartDataPoints. See ChartDataPoint.
  • Metadata : Data to populate the metadata field above the graph. See Chart Metadata.
  • xAxisLabels : An array of strings in case there are too many data points to display all xAxisLabels.
  • ChartStyle: Parameters for the aesthetics of the card. See ChartStyle.
  • LineStyle: Parameters for the aesthetics of the line graph. See. LineChartStyle.
  • Bar Style: Parameters for histogram aesthetics. See BarStyle.
  • PointStyle: Aesthetic parameters of data point markers. See PointStyle.
  • Calculations: Choose whether to perform calculations on data points. If so, in what way.

Diagram pointDataPoint

ChartDataPoint stores information for each individual data point.

Colors are only used in bar charts.

All

GraphDataPoint(value:Double,xAxisLabel:String?,pointLabel:String?,date:Date…)

  • Importance: The value of the data point.
  • xAxisLabel : A mark that can be displayed on the X axis.
  • dotLabel: Longer label that can be displayed on the input touch screen.
  • Date: Date of the data point if calculations are to be made from the data.

Monochrome

GraphDataPoint(…
Color: Color)

  • The color: Color to be used with the bar graph.

Gradient

ChartDataPoint(. Colors
: [Color] ?,
Start point: Unit point ?,
End point: Unit point ?)

  • Colors: Degenerated colors
  • Starting point: Starting point of slope
  • Point: End point of the gradient

Gradient with stop control

ChartDataPoint(…stops: [GradientStop],startPoint: UnitPoint?,endPoint: UnitPoint?)

  • he stops: Colours and stops for the slope with stop control.
  • Starting point: Starting point of the gradient.
  • Period: End point of the gradient.

Map Metadata

Data model for diagram metadata

Graph Metadata (title: String ?, subtitle
: String ?,
stringLegend: String ?)

  • Title : Card name
  • Subtitle: Graphic subtitles
  • lineLegend : The name of the legend

Graphic style

Model to control the overall aesthetics of the diagram.

Chart Style(infoBoxPlacement) : InfoBoxPlacement,
xAxisGridStyle : GridStyle,
yAxisGridStyle : GridStyle,
xAxisLabelPosition : XAxisLabelPosistion,
xAxisLabelsFrom : LabelPosition
yAxisLabelPosition : YAxisLabelPosistion,
yAxisNumberOfLabels : B,GlobalizationAnimation : Animation

  • infoBoxPlacement : Placement of the information field displayed on the input touch screen.
  • xAxisGridStyle : The style of vertical lines dividing the painting. See GridStyle.
  • YAxisGridStyle : The style of the horizontal lines that divide the table. See GridStyle.
  • xAxisLabelPosition : Label layout on the X axis – up or down
  • xAxisLabelsFrom : Where does the label data come from? DataPoint or xAxisLabels
  • yAxisLabelPosition : Position of the marker along the X-axis – Forward or approximate
  • YAxisNumberOfLabel : Number of labels on the Y-axis.
  • GlobalizationAnimation : Animation of the gobal control.

Network style

Template to control the appearance of the grid

GridStyle(number of lines: Int, line
Color: Color, line
Width: CGFloat, dash
: [CGFloat], dash
Phase: CGFloat)

  • number of lines : Number of lines to divide the axis
  • lineColour : Line color
  • Line thickness : Line thickness
  • Dash: Dash
  • dashPhase: Start-up phase

XAxisLabelSetup

Template for the design of labels on the X axis.

XAxisLabelSetup (labelPosition: XAxisLabelPosistion,
labelsFrom: LabelsFrom)

  • StickerPosition : Label layout on the X axis – up or down
  • Tags : Where does the label data come from? DataPoint or xAxisLabels

YAxisLabelSetup

Style template for Y-axis labeling.

YAxisLabelSetup (labelPosition: YAxisLabelPosistion,
number of labels: Int)

  • StickerPosition : Y axis marker position – leading or following
  • number of labels : Number of labels on the Y-axis.

Line type

A model to check the overall aesthetics of a line graph.

There are three possible initiators: Monochrome, gradient or gradient with stop command.

Monochrome

LineChartStyle(color : Colour…

Gradient

LineChartStyle(Colors : ?? ?, start point: UnitPoint? Point: UnitPoint?

  • Colors: Degenerated colors
  • Starting point: Starting point of slope
  • End point: end point of the gradient

Gradient with stop control

LineChartStyle(stops : GradientStop], starting point
: UnitPoint? Point: UnitPoint?

  • he stops: Colours and stops for the slope with stop control.
  • Starting point: Starting point of the gradient.
  • Point: End point of the gradient.

All

LineChartStyle(…
strokeStyle : StrokeStyle,
ignoreZero : Bool)

  • LineType : The style of line drawing.
  • The style of the hub: Attack Style
  • Ignore the zero: If the graph must skip data points with a value of 0, the interval is preserved.

BarStyle

Template to check the aesthetics of the histogram.

There are three possible initiators: Monochrome, gradient or gradient with stop command.

All

BarStyle(barWidth : CGFloat,cornerRadius : CornerRadius,colorFrom : ColourFrom, …)

  • Bar width: The available width to be used. 0…1
  • Corner radius : The radius of the angular shape of the tire.
  • the color… Where you get the color data.

Monochrome

BarStyle(…
Color: Single Color)

Gradient

BarStyle(. Colors
: [Color] Starting point: Unit point
End point: Unit point)

  • Colors: Degenerated colors
  • Starting point: Starting point of slope
  • Point: End point of the gradient

Gradient with stop control

BarStyle(.
stop: [GradientStop] startPoint: UnitPoint
endPoint: UnitPoint)

  • he stops: Colours and stops for the slope with stop control.
  • Starting point: Starting point of the gradient.
  • Point: End point of the gradient.

Style point

Model for checking the aesthetics of markers.

PointStyle(pointSize : CGFloat,borderColour : Color,fill color : Color,border width : CGFloat,pointType : PointType,pointShape : PointShape)

  • Item Size : Overall size board
  • BorderColour : Color of the output ring
  • fillColour : Colour centre filling
  • Line thickness : Output ring line width
  • PointType : Dotted font.
  • ShapePoint: The shape of the dots

GitHub

swiftui donut chart,swiftui pie chart tutorial,swiftui line chart github,line graphs swiftui,swift chart library,swiftsunburstdiagram,horizontal bar chart swift,swiftui scatter chart,vertical bar chart swift,line chart swift,graph data structure in swift,how to draw graph in xcode,line charts in ios swift,step line chart ios,circle chart in ios,radar chart swift,swiftui circle chart,sunburst diagram swiftui,swiftui draw line graph,swiftui charts macos,ios charts swift example github,pod ‘charts swift 4,bar chart in swift 4,ios charts stacked bar chart,graph framework ios,how to make shapes in xcode,shape swift ui,google charts for ios,ios charts animate,swiftui gauge,Privacy settings,How Search works,swiftui charts tutorial,line chart swiftui,swiftui charts github,swiftui pie chart,swiftui bar chart,swiftuicharts

You May Also Like

đŸ„‡Â EXVAGOS Close?  How to enter? + Alternatives + List ▷ 2021

Exvagos, was considered one of the most popular file sharing portals in…

A Guide to Monitoring Children’s Phone Activities

It is important for the safety of your children that you keep…

How to remove lock screen ads on Android

As necessary as advertising and marketing communications are, the implementation methodology can…

7 Solutions To Fix Chromium Won’t Uninstall In Windows 10

Chromium is an open source web browser developed by Google. Thanks to…