Skip to content
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

support highlight specified item in PieChart. #440

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions PNChart/PNPieChart.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,7 @@

- (void)recompute;

/** highlight the specified item */
- (void)highlightItemWithIndex:(NSInteger)index;

@end
6 changes: 5 additions & 1 deletion PNChart/PNPieChart.m
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,10 @@ - (void)didTouchAt:(CGPoint)touchLocation
[self.delegate userClickedOnPieIndexItem:index];
}

[self highlightItemWithIndex:index];
}

- (void)highlightItemWithIndex:(NSInteger)index {
if (self.shouldHighlightSectorOnTouch)
{
if (!self.enableMultipleSelection)
Expand Down Expand Up @@ -345,7 +349,7 @@ - (void)didTouchAt:(CGPoint)touchLocation

if (self.enableMultipleSelection)
{
NSString *dictIndex = [NSString stringWithFormat:@"%d", index];
NSString *dictIndex = [NSString stringWithFormat:@"%ld", (long)index];
CAShapeLayer *indexShape = [self.selectedItems valueForKey:dictIndex];
if (indexShape)
{
Expand Down
64 changes: 0 additions & 64 deletions PNChartDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,6 @@
0AF7A860182AA9F6003645C4 /* Sources */,
0AF7A861182AA9F6003645C4 /* Frameworks */,
0AF7A862182AA9F6003645C4 /* Resources */,
7D516272BD760D57A76DAD64 /* [CP] Embed Pods Frameworks */,
4552CFD6C9080AB9EE9E46D1 /* [CP] Copy Pods Resources */,
3ED57DE8204F0C44003D6796 /* Embed Frameworks */,
);
buildRules = (
Expand Down Expand Up @@ -456,8 +454,6 @@
6E984E4D1AE2AF2D00E817A0 /* Sources */,
6E984E4E1AE2AF2D00E817A0 /* Frameworks */,
6E984E4F1AE2AF2D00E817A0 /* Resources */,
352F07839FB03B1A9D90A483 /* [CP] Embed Pods Frameworks */,
7D8856A691FAB9EC9C672F2A /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand Down Expand Up @@ -539,36 +535,6 @@
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
352F07839FB03B1A9D90A483 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-PNChartTests/Pods-PNChartTests-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
4552CFD6C9080AB9EE9E46D1 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-PNChartDemo/Pods-PNChartDemo-resources.sh\"\n";
showEnvVarsInLog = 0;
};
701E9E0847192B2A2BE3698D /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand All @@ -587,36 +553,6 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
7D516272BD760D57A76DAD64 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-PNChartDemo/Pods-PNChartDemo-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
7D8856A691FAB9EC9C672F2A /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-PNChartTests/Pods-PNChartTests-resources.sh\"\n";
showEnvVarsInLog = 0;
};
FA0C39B32F296624BBDFF3E3 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down
4 changes: 4 additions & 0 deletions PNChartDemo/PCChartViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -480,4 +480,8 @@ - (IBAction)animationsSwitchChanged:(UISwitch *)sender {
}
}

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
[self.pieChart highlightItemWithIndex:2];
}

@end
2 changes: 1 addition & 1 deletion Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'

target :PNChartDemo do
pod 'UICountingLabel','~> 1.4.1'
pod 'UICountingLabel','~> 1.0.0'
end

target :PNChartTests do
Expand Down
15 changes: 10 additions & 5 deletions Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
PODS:
- Expecta (1.0.6)
- UICountingLabel (1.4.1)
- UICountingLabel (1.0.0)

DEPENDENCIES:
- Expecta
- UICountingLabel (~> 1.4.1)
- UICountingLabel (~> 1.0.0)

SPEC REPOS:
https://github.com/cocoapods/specs.git:
- Expecta
- UICountingLabel

SPEC CHECKSUMS:
Expecta: 3b6bd90a64b9a1dcb0b70aa0e10a7f8f631667d5
UICountingLabel: faf890b505d96312e324a86718f031fafffb0ccb
UICountingLabel: 540feeca6bbb78be892c8ab75b6ad02313cb2b10

PODFILE CHECKSUM: de6be598c24bcfa6bcb5d22972adde29af718156
PODFILE CHECKSUM: e78182a4fa088d19e3151af985af1dc8a514b92a

COCOAPODS: 1.4.0
COCOAPODS: 1.5.3
25 changes: 25 additions & 0 deletions Pods/Expecta/Expecta/EXPBlockDefinedMatcher.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 60 additions & 0 deletions Pods/Expecta/Expecta/EXPBlockDefinedMatcher.m

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions Pods/Expecta/Expecta/EXPDefines.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions Pods/Expecta/Expecta/EXPDoubleTuple.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 45 additions & 0 deletions Pods/Expecta/Expecta/EXPDoubleTuple.m

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 45 additions & 0 deletions Pods/Expecta/Expecta/EXPExpect.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading