-
Notifications
You must be signed in to change notification settings - Fork 654
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add ColorGradient example Add ColorGradient single color constructor Add preview for BarChart * Add PieChart Allow multi color for Pie and Bar Add linter
- Loading branch information
Showing
14 changed files
with
472 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
disabled_rules: | ||
- explicit_acl | ||
- trailing_whitespace | ||
- force_cast | ||
- unused_closure_parameter | ||
- multiple_closures_with_trailing_closure | ||
opt_in_rules: | ||
- anyobject_protocol | ||
- array_init | ||
- attributes | ||
- collection_alignment | ||
- colon | ||
- conditional_returns_on_newline | ||
- convenience_type | ||
- empty_count | ||
- empty_string | ||
- empty_collection_literal | ||
- enum_case_associated_values_count | ||
- function_default_parameter_at_end | ||
- fatal_error_message | ||
- file_name | ||
- first_where | ||
- modifier_order | ||
- toggle_bool | ||
- unused_private_declaration | ||
- yoda_condition | ||
excluded: | ||
- Carthage | ||
- Pods | ||
- SwiftLint/Common/3rdPartyLib | ||
identifier_name: | ||
excluded: | ||
- a | ||
- b | ||
- c | ||
- i | ||
- id | ||
- t | ||
- to | ||
- x | ||
- y | ||
line_length: | ||
warning: 150 | ||
error: 200 | ||
ignores_function_declarations: true | ||
ignores_comments: true | ||
ignores_urls: true | ||
function_body_length: | ||
warning: 300 | ||
error: 500 | ||
function_parameter_count: | ||
warning: 6 | ||
error: 8 | ||
type_body_length: | ||
warning: 300 | ||
error: 400 | ||
file_length: | ||
warning: 500 | ||
error: 1200 | ||
ignore_comment_only_lines: true | ||
cyclomatic_complexity: | ||
warning: 15 | ||
error: 21 | ||
reporter: "xcode" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
Sources/SwiftUICharts/Base/Extensions/CGRect+Extension.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// | ||
// CGRect+Extension.swift | ||
// SwiftUICharts | ||
// | ||
// Created by Nicolas Savoini on 2020-05-24. | ||
// | ||
|
||
import Foundation | ||
import SwiftUI | ||
|
||
extension CGRect { | ||
// Return the coordinate for a rectangle center | ||
public var mid: CGPoint { | ||
return CGPoint(x: self.midX, y: self.midY) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,28 @@ | ||
import SwiftUI | ||
|
||
public struct ChartStyle { | ||
public let backgroundColor: Color | ||
public let foregroundColor: ColorGradient | ||
|
||
public let backgroundColor: ColorGradient | ||
public let foregroundColor: [ColorGradient] | ||
|
||
public init(backgroundColor: Color, foregroundColor: [ColorGradient]) { | ||
self.backgroundColor = ColorGradient.init(backgroundColor) | ||
self.foregroundColor = foregroundColor | ||
} | ||
|
||
public init(backgroundColor: Color, foregroundColor: ColorGradient) { | ||
self.backgroundColor = ColorGradient.init(backgroundColor) | ||
self.foregroundColor = [foregroundColor] | ||
} | ||
|
||
public init(backgroundColor: ColorGradient, foregroundColor: ColorGradient) { | ||
self.backgroundColor = backgroundColor | ||
self.foregroundColor = [foregroundColor] | ||
} | ||
|
||
public init(backgroundColor: ColorGradient, foregroundColor: [ColorGradient]) { | ||
self.backgroundColor = backgroundColor | ||
self.foregroundColor = foregroundColor | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.