Skip to content

Commit d6c2122

Browse files
committed
Merge branch 'icons3' of https://github.com/abjurato/Charts into abjurato-icons3
2 parents 7f9f2ec + ccaa966 commit d6c2122

File tree

79 files changed

+438
-134
lines changed

Some content is hidden

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

79 files changed

+438
-134
lines changed

Charts.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@
160160
06B3C0F81D99F85400B1DF43 /* LineChartTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06B3C0F41D99F85400B1DF43 /* LineChartTests.swift */; };
161161
06B3C0F91D99F85400B1DF43 /* ChartsRealmTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 06B3C0F61D99F85400B1DF43 /* ChartsRealmTest.swift */; };
162162
5B56A9CD1D905EB300F58178 /* Description.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5B56A9CC1D905EB300F58178 /* Description.swift */; };
163+
D8A58A411DCE2EF8007BB012 /* Media.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D8A58A401DCE2EF8007BB012 /* Media.xcassets */; };
163164
5BF8813B1DDC4DF70033370C /* IndexAxisValueFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5BF8813A1DDC4DF70033370C /* IndexAxisValueFormatter.swift */; };
164165
/* End PBXBuildFile section */
165166

@@ -338,6 +339,7 @@
338339
06B3C0F41D99F85400B1DF43 /* LineChartTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LineChartTests.swift; sourceTree = "<group>"; };
339340
06B3C0F61D99F85400B1DF43 /* ChartsRealmTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ChartsRealmTest.swift; sourceTree = "<group>"; };
340341
5B56A9CC1D905EB300F58178 /* Description.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Description.swift; sourceTree = "<group>"; };
342+
D8A58A401DCE2EF8007BB012 /* Media.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Media.xcassets; path = Charts/ChartsTests/Media.xcassets; sourceTree = SOURCE_ROOT; };
341343
5BF8813A1DDC4DF70033370C /* IndexAxisValueFormatter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IndexAxisValueFormatter.swift; sourceTree = "<group>"; };
342344
/* End PBXFileReference section */
343345

@@ -740,6 +742,7 @@
740742
isa = PBXGroup;
741743
children = (
742744
06B121111D81201C00D14B02 /* Info.plist */,
745+
D8A58A401DCE2EF8007BB012 /* Media.xcassets */,
743746
);
744747
name = "Supporting Files";
745748
sourceTree = "<group>";
@@ -894,6 +897,7 @@
894897
isa = PBXResourcesBuildPhase;
895898
buildActionMask = 2147483647;
896899
files = (
900+
D8A58A411DCE2EF8007BB012 /* Media.xcassets in Resources */,
897901
);
898902
runOnlyForDeploymentPostprocessing = 0;
899903
};
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info" : {
3+
"version" : 1,
4+
"author" : "xcode"
5+
}
6+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"filename" : "star-2.png",
6+
"scale" : "1x"
7+
},
8+
{
9+
"idiom" : "universal",
10+
"filename" : "star-1.png",
11+
"scale" : "2x"
12+
},
13+
{
14+
"idiom" : "universal",
15+
"filename" : "star.png",
16+
"scale" : "3x"
17+
}
18+
],
19+
"info" : {
20+
"version" : 1,
21+
"author" : "xcode"
22+
}
23+
}
1.19 KB
Loading
1.19 KB
Loading
1.19 KB
Loading

ChartsDemo/Classes/DemoBaseViewController.m

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,16 @@ - (void)handleOption:(NSString *)key forChartView:(ChartViewBase *)chartView
8383
[chartView setNeedsDisplay];
8484
}
8585

86+
if ([key isEqualToString:@"toggleIcons"])
87+
{
88+
for (id<IChartDataSet> set in chartView.data.dataSets)
89+
{
90+
set.drawIconsEnabled = !set.isDrawIconsEnabled;
91+
}
92+
93+
[chartView setNeedsDisplay];
94+
}
95+
8696
if ([key isEqualToString:@"toggleHighlight"])
8797
{
8898
chartView.data.highlightEnabled = !chartView.data.isHighlightEnabled;

ChartsDemo/Classes/Demos/BarChartViewController.m

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ - (void)viewDidLoad
3333

3434
self.options = @[
3535
@{@"key": @"toggleValues", @"label": @"Toggle Values"},
36+
@{@"key": @"toggleIcons", @"label": @"Toggle Icons"},
3637
@{@"key": @"toggleHighlight", @"label": @"Toggle Highlight"},
3738
@{@"key": @"animateX", @"label": @"Animate X"},
3839
@{@"key": @"animateY", @"label": @"Animate Y"},
@@ -136,7 +137,11 @@ - (void)setDataCount:(int)count range:(double)range
136137
{
137138
double mult = (range + 1);
138139
double val = (double) (arc4random_uniform(mult));
139-
[yVals addObject:[[BarChartDataEntry alloc] initWithX:(double)i y:val]];
140+
if (arc4random_uniform(100) < 25) {
141+
[yVals addObject:[[BarChartDataEntry alloc] initWithX:val y:i data: [UIImage imageNamed:@"icon"]]];
142+
} else {
143+
[yVals addObject:[[BarChartDataEntry alloc] initWithX:val y:i]];
144+
}
140145
}
141146

142147
BarChartDataSet *set1 = nil;

ChartsDemo/Classes/Demos/BubbleChartViewController.m

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ - (void)viewDidLoad
3232

3333
self.options = @[
3434
@{@"key": @"toggleValues", @"label": @"Toggle Values"},
35+
@{@"key": @"toggleIcons", @"label": @"Toggle Icons"},
3536
@{@"key": @"toggleHighlight", @"label": @"Toggle Highlight"},
3637
@{@"key": @"animateX", @"label": @"Animate X"},
3738
@{@"key": @"animateY", @"label": @"Animate Y"},
@@ -103,11 +104,11 @@ - (void)setDataCount:(int)count range:(double)range
103104
{
104105
double val = (double) (arc4random_uniform(range));
105106
double size = (double) (arc4random_uniform(range));
106-
[yVals1 addObject:[[BubbleChartDataEntry alloc] initWithX:i y:val size:size]];
107+
[yVals1 addObject:[[BubbleChartDataEntry alloc] initWithX:i y:val size:size data: [UIImage imageNamed:@"icon"]]];
107108

108109
val = (double) (arc4random_uniform(range));
109110
size = (double) (arc4random_uniform(range));
110-
[yVals2 addObject:[[BubbleChartDataEntry alloc] initWithX:i y:val size:size]];
111+
[yVals2 addObject:[[BubbleChartDataEntry alloc] initWithX:i y:val size:size data: [UIImage imageNamed:@"icon"]]];
111112

112113
val = (double) (arc4random_uniform(range));
113114
size = (double) (arc4random_uniform(range));
@@ -118,6 +119,7 @@ - (void)setDataCount:(int)count range:(double)range
118119
[set1 setColor:ChartColorTemplates.colorful[0] alpha:0.50f];
119120
[set1 setDrawValuesEnabled:YES];
120121
BubbleChartDataSet *set2 = [[BubbleChartDataSet alloc] initWithValues:yVals2 label:@"DS 2"];
122+
set1.iconsOffset = CGSizeMake(0, 15);
121123
[set2 setColor:ChartColorTemplates.colorful[1] alpha:0.50f];
122124
[set2 setDrawValuesEnabled:YES];
123125
BubbleChartDataSet *set3 = [[BubbleChartDataSet alloc] initWithValues:yVals3 label:@"DS 3"];

ChartsDemo/Classes/Demos/CandleStickChartViewController.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ - (void)viewDidLoad
3232

3333
self.options = @[
3434
@{@"key": @"toggleValues", @"label": @"Toggle Values"},
35+
@{@"key": @"toggleIcons", @"label": @"Toggle Icons"},
3536
@{@"key": @"toggleHighlight", @"label": @"Toggle Highlight"},
3637
@{@"key": @"animateX", @"label": @"Animate X"},
3738
@{@"key": @"animateY", @"label": @"Animate Y"},
@@ -100,7 +101,7 @@ - (void)setDataCount:(int)count range:(double)range
100101
double open = (double) (arc4random_uniform(6)) + 1.0;
101102
double close = (double) (arc4random_uniform(6)) + 1.0;
102103
BOOL even = i % 2 == 0;
103-
[yVals1 addObject:[[CandleChartDataEntry alloc] initWithX:i shadowH:val + high shadowL:val - low open:even ? val + open : val - open close:even ? val - close : val + close]];
104+
[yVals1 addObject:[[CandleChartDataEntry alloc] initWithX:i shadowH:val + high shadowL:val - low open:even ? val + open : val - open close:even ? val - close : val + close data: [UIImage imageNamed:@"icon"]]];
104105
}
105106

106107
CandleChartDataSet *set1 = [[CandleChartDataSet alloc] initWithValues:yVals1 label:@"Data Set"];

0 commit comments

Comments
 (0)