Toggle navigation
Toggle navigation
This project
Loading...
Sign in
iOS
/
PNChart
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
MrWooJ
2014-12-04 11:15:06 +0330
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
20bb16b3ec496dac163c486b16f443d84f7b6f5c
20bb16b3
1 parent
a675504e
Adding PNScatterChart - Data
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
105 additions
and
0 deletions
PNChart/PNScatterChartData.h
PNChart/PNScatterChartData.m
PNChart/PNScatterChartData.h
0 → 100644
View file @
20bb16b
//
// PNScatterChartData.h
// PNChartDemo
//
// Created by Alireza Arabi on 12/4/14.
// Copyright (c) 2014 kevinzhow. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef
NS_ENUM
(
NSUInteger
,
PNScatterChartPointStyle
)
{
PNScatterChartPointStyleCircle
=
0
,
PNScatterChartPointStyleSquare
=
1
,
};
@class
PNScatterChartDataItem
;
typedef
PNScatterChartDataItem
*
(
^
LCScatterChartDataGetter
)(
NSUInteger
item
);
@interface
PNScatterChartData
:
NSObject
@property
(
strong
)
UIColor
*
fillColor
;
@property
(
strong
)
UIColor
*
strokeColor
;
@property
NSUInteger
itemCount
;
@property
(
copy
)
LCScatterChartDataGetter
getData
;
@property
(
nonatomic
,
assign
)
PNScatterChartPointStyle
inflexionPointStyle
;
/**
* If PNLineChartPointStyle is circle, this returns the circle's diameter.
* If PNLineChartPointStyle is square, each point is a square with each side equal in length to this value.
*/
@property
(
nonatomic
,
assign
)
CGFloat
size
;
@end
...
...
PNChart/PNScatterChartData.m
0 → 100644
View file @
20bb16b
//
// PNScatterChartData.m
// PNChartDemo
//
// Created by Alireza Arabi on 12/4/14.
// Copyright (c) 2014 kevinzhow. All rights reserved.
//
#import "PNScatterChartData.h"
@implementation
PNScatterChartData
-
(
id
)
init
{
self
=
[
super
init
];
if
(
self
)
{
[
self
setDefaultValues
];
}
return
self
;
}
-
(
void
)
setDefaultValues
{
_inflexionPointStyle
=
PNScatterChartPointStyleCircle
;
_fillColor
=
[
UIColor
grayColor
];
_strokeColor
=
[
UIColor
blackColor
];
_size
=
10
;
}
-
(
CAShapeLayer
*
)
drawingPoints
{
if
(
_inflexionPointStyle
==
PNScatterChartPointStyleCircle
)
{
float
radius
=
_size
;
CAShapeLayer
*
circle
=
[
CAShapeLayer
layer
];
// Make a circular shape
circle
.
path
=
[
UIBezierPath
bezierPathWithRoundedRect
:
CGRectMake
(
0
,
0
,
2
.
0
*
radius
,
2
.
0
*
radius
)
cornerRadius
:
radius
].
CGPath
;
// Configure the apperence of the circle
circle
.
fillColor
=
[
_fillColor
CGColor
];
circle
.
strokeColor
=
[
_strokeColor
CGColor
];
circle
.
lineWidth
=
1
;
// Add to parent layer
return
circle
;
}
else
if
(
_inflexionPointStyle
==
PNScatterChartPointStyleSquare
)
{
float
side
=
_size
;
CAShapeLayer
*
square
=
[
CAShapeLayer
layer
];
// Make a circular shape
square
.
path
=
[
UIBezierPath
bezierPathWithRect
:
CGRectMake
(
0
,
0
,
side
,
side
)].
CGPath
;
// Configure the apperence of the circle
square
.
fillColor
=
[
_fillColor
CGColor
];
square
.
strokeColor
=
[
_strokeColor
CGColor
];
square
.
lineWidth
=
1
;
// Add to parent layer
return
square
;
}
else
{
// you cann add your own scatter chart poin here
}
return
nil
;
}
@end
...
...
Please
register
or
login
to post a comment