Kevin

Merge pull request #101 from Antoine4011/custom-style

Label improvements
... ... @@ -18,10 +18,12 @@
if (self) {
// Initialization code
[self setFont:[UIFont boldSystemFontOfSize:11.0f]];
self.font = [UIFont boldSystemFontOfSize:11.0f];
self.backgroundColor = [UIColor clearColor];
[self setTextAlignment:NSTextAlignmentCenter];
self.textAlignment = NSTextAlignmentCenter;
self.userInteractionEnabled = YES;
self.minimumScaleFactor = 0.8;
self.adjustsFontSizeToFitWidth = YES;
}
return self;
... ...
... ... @@ -65,17 +65,17 @@
NSString *yLabelFormat = self.yLabelFormat ? : @"%1.f";
if (yStep == 0.0) {
PNChartLabel *minLabel = [[PNChartLabel alloc] initWithFrame:CGRectMake(0.0, _chartCavanHeight, _chartMargin, _yLabelHeight)];
PNChartLabel *minLabel = [[PNChartLabel alloc] initWithFrame:CGRectMake(0.0, (NSInteger)_chartCavanHeight, (NSInteger)_chartMargin, (NSInteger)_yLabelHeight)];
minLabel.text = [NSString stringWithFormat:yLabelFormat, 0.0];
[self setCustomStyleForYLabel:minLabel];
[self addSubview:minLabel];
PNChartLabel *midLabel = [[PNChartLabel alloc] initWithFrame:CGRectMake(0.0, _chartCavanHeight / 2, _chartMargin, _yLabelHeight)];
PNChartLabel *midLabel = [[PNChartLabel alloc] initWithFrame:CGRectMake(0.0, (NSInteger)(_chartCavanHeight / 2), (NSInteger)_chartMargin, (NSInteger)_yLabelHeight)];
midLabel.text = [NSString stringWithFormat:yLabelFormat, _yValueMax];
[self setCustomStyleForYLabel:midLabel];
[self addSubview:midLabel];
PNChartLabel *maxLabel = [[PNChartLabel alloc] initWithFrame:CGRectMake(0.0, 0.0, _chartMargin, _yLabelHeight)];
PNChartLabel *maxLabel = [[PNChartLabel alloc] initWithFrame:CGRectMake(0.0, 0.0, (NSInteger)_chartMargin, (NSInteger)_yLabelHeight)];
maxLabel.text = [NSString stringWithFormat:yLabelFormat, _yValueMax * 2];
[self setCustomStyleForYLabel:maxLabel];
[self addSubview:maxLabel];
... ... @@ -86,7 +86,7 @@
while (num > 0)
{
PNChartLabel *label = [[PNChartLabel alloc] initWithFrame:CGRectMake(0.0, (_chartCavanHeight - index * yStepHeight), _chartMargin, _yLabelHeight)];
PNChartLabel *label = [[PNChartLabel alloc] initWithFrame:CGRectMake(0.0, (NSInteger)(_chartCavanHeight - index * yStepHeight), (NSInteger)_chartMargin, (NSInteger)_yLabelHeight)];
[label setTextAlignment:NSTextAlignmentRight];
label.text = [NSString stringWithFormat:yLabelFormat, _yValueMin + (yStep * index)];
[self setCustomStyleForYLabel:label];
... ... @@ -124,7 +124,7 @@
NSInteger x = 2 * _chartMargin + (index * _xLabelWidth) - (_xLabelWidth / 2);
NSInteger y = _chartMargin + _chartCavanHeight;
PNChartLabel *label = [[PNChartLabel alloc] initWithFrame:CGRectMake(x, y, _xLabelWidth, _chartMargin)];
PNChartLabel *label = [[PNChartLabel alloc] initWithFrame:CGRectMake(x, y, (NSInteger)_xLabelWidth, (NSInteger)_chartMargin)];
[label setTextAlignment:NSTextAlignmentCenter];
label.text = labelText;
[self setCustomStyleForXLabel:label];
... ... @@ -142,6 +142,7 @@
if (_xLabelColor) {
label.textColor = _xLabelColor;
}
}
- (void)setCustomStyleForYLabel:(UILabel *)label
... ...