-
-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chartdata collection refactor #3024
Changes from 23 commits
6e80eb0
d36d11b
36ca566
cb32b08
ad0d148
fcd9fa2
716f182
ca5afad
0d41175
8976b95
f28d3d5
793e437
583dab6
0cce64d
47b6a1c
c0b7d65
1d1e380
a71f87c
efc5a72
bfb750b
6adde98
ae8279a
6de1114
37b29ad
329e00c
2572f04
31a76eb
b7e6f93
eb8e031
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -104,7 +104,7 @@ class BubbleChartViewController: DemoBaseViewController { | |
set3.setColor(ChartColorTemplates.colorful()[2], alpha: 0.5) | ||
set3.drawValuesEnabled = true | ||
|
||
let data = BubbleChartData(dataSets: [set1, set2, set3]) | ||
let data = [set1, set2, set3] as BubbleChartData | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. may I know which protocol method enables this convenient conversion? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
data.setDrawValues(false) | ||
data.setValueFont(UIFont(name: "HelveticaNeue-Light", size: 7)!) | ||
data.setHighlightCircleWidth(1.5) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -144,31 +144,31 @@ class LineChart1ViewController: DemoBaseViewController { | |
override func optionTapped(_ option: Option) { | ||
switch option { | ||
case .toggleFilled: | ||
for set in chartView.data!.dataSets as! [LineChartDataSet] { | ||
for set in chartView.data as! LineChartData { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. want to know which method enables this as well. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See comment below There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jjatie There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh wait. Seems I asked a wrong question? |
||
set.drawFilledEnabled = !set.drawFilledEnabled | ||
} | ||
chartView.setNeedsDisplay() | ||
|
||
case .toggleCircles: | ||
for set in chartView.data!.dataSets as! [LineChartDataSet] { | ||
for set in chartView.data as! LineChartData { | ||
set.drawCirclesEnabled = !set.drawCirclesEnabled | ||
} | ||
chartView.setNeedsDisplay() | ||
|
||
case .toggleCubic: | ||
for set in chartView.data!.dataSets as! [LineChartDataSet] { | ||
for set in chartView.data as! LineChartData { | ||
set.mode = (set.mode == .cubicBezier) ? .linear : .cubicBezier | ||
} | ||
chartView.setNeedsDisplay() | ||
|
||
case .toggleStepped: | ||
for set in chartView.data!.dataSets as! [LineChartDataSet] { | ||
for set in chartView.data as! LineChartData { | ||
set.mode = (set.mode == .stepped) ? .linear : .stepped | ||
} | ||
chartView.setNeedsDisplay() | ||
|
||
case .toggleHorizontalCubic: | ||
for set in chartView.data!.dataSets as! [LineChartDataSet] { | ||
for set in chartView.data as! LineChartData { | ||
set.mode = (set.mode == .cubicBezier) ? .horizontalBezier : .cubicBezier | ||
} | ||
chartView.setNeedsDisplay() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a feeling that
for set in data
is less natural thanfor set in data.dataSets
, what you think? Maybe need time to adapt?So in the future, we will deprecate
data.dataSet
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's just new to you. We need to continue to support
data.dataSet
as long as we keep Obj-C compatibility.