Antoine Gamond

Fix blurred label when coordinates aren't integer

@@ -65,17 +65,17 @@ @@ -65,17 +65,17 @@
65 NSString *yLabelFormat = self.yLabelFormat ? : @"%1.f"; 65 NSString *yLabelFormat = self.yLabelFormat ? : @"%1.f";
66 66
67 if (yStep == 0.0) { 67 if (yStep == 0.0) {
68 - PNChartLabel *minLabel = [[PNChartLabel alloc] initWithFrame:CGRectMake(0.0, _chartCavanHeight, _chartMargin, _yLabelHeight)]; 68 + PNChartLabel *minLabel = [[PNChartLabel alloc] initWithFrame:CGRectMake(0.0, (NSInteger)_chartCavanHeight, (NSInteger)_chartMargin, (NSInteger)_yLabelHeight)];
69 minLabel.text = [NSString stringWithFormat:yLabelFormat, 0.0]; 69 minLabel.text = [NSString stringWithFormat:yLabelFormat, 0.0];
70 [self setCustomStyleForYLabel:minLabel]; 70 [self setCustomStyleForYLabel:minLabel];
71 [self addSubview:minLabel]; 71 [self addSubview:minLabel];
72 72
73 - PNChartLabel *midLabel = [[PNChartLabel alloc] initWithFrame:CGRectMake(0.0, _chartCavanHeight / 2, _chartMargin, _yLabelHeight)]; 73 + PNChartLabel *midLabel = [[PNChartLabel alloc] initWithFrame:CGRectMake(0.0, (NSInteger)(_chartCavanHeight / 2), (NSInteger)_chartMargin, (NSInteger)_yLabelHeight)];
74 midLabel.text = [NSString stringWithFormat:yLabelFormat, _yValueMax]; 74 midLabel.text = [NSString stringWithFormat:yLabelFormat, _yValueMax];
75 [self setCustomStyleForYLabel:midLabel]; 75 [self setCustomStyleForYLabel:midLabel];
76 [self addSubview:midLabel]; 76 [self addSubview:midLabel];
77 77
78 - PNChartLabel *maxLabel = [[PNChartLabel alloc] initWithFrame:CGRectMake(0.0, 0.0, _chartMargin, _yLabelHeight)]; 78 + PNChartLabel *maxLabel = [[PNChartLabel alloc] initWithFrame:CGRectMake(0.0, 0.0, (NSInteger)_chartMargin, (NSInteger)_yLabelHeight)];
79 maxLabel.text = [NSString stringWithFormat:yLabelFormat, _yValueMax * 2]; 79 maxLabel.text = [NSString stringWithFormat:yLabelFormat, _yValueMax * 2];
80 [self setCustomStyleForYLabel:maxLabel]; 80 [self setCustomStyleForYLabel:maxLabel];
81 [self addSubview:maxLabel]; 81 [self addSubview:maxLabel];
@@ -86,7 +86,7 @@ @@ -86,7 +86,7 @@
86 86
87 while (num > 0) 87 while (num > 0)
88 { 88 {
89 - PNChartLabel *label = [[PNChartLabel alloc] initWithFrame:CGRectMake(0.0, (_chartCavanHeight - index * yStepHeight), _chartMargin, _yLabelHeight)]; 89 + PNChartLabel *label = [[PNChartLabel alloc] initWithFrame:CGRectMake(0.0, (NSInteger)(_chartCavanHeight - index * yStepHeight), (NSInteger)_chartMargin, (NSInteger)_yLabelHeight)];
90 [label setTextAlignment:NSTextAlignmentRight]; 90 [label setTextAlignment:NSTextAlignmentRight];
91 label.text = [NSString stringWithFormat:yLabelFormat, _yValueMin + (yStep * index)]; 91 label.text = [NSString stringWithFormat:yLabelFormat, _yValueMin + (yStep * index)];
92 [self setCustomStyleForYLabel:label]; 92 [self setCustomStyleForYLabel:label];
@@ -124,7 +124,7 @@ @@ -124,7 +124,7 @@
124 NSInteger x = 2 * _chartMargin + (index * _xLabelWidth) - (_xLabelWidth / 2); 124 NSInteger x = 2 * _chartMargin + (index * _xLabelWidth) - (_xLabelWidth / 2);
125 NSInteger y = _chartMargin + _chartCavanHeight; 125 NSInteger y = _chartMargin + _chartCavanHeight;
126 126
127 - PNChartLabel *label = [[PNChartLabel alloc] initWithFrame:CGRectMake(x, y, _xLabelWidth, _chartMargin)]; 127 + PNChartLabel *label = [[PNChartLabel alloc] initWithFrame:CGRectMake(x, y, (NSInteger)_xLabelWidth, (NSInteger)_chartMargin)];
128 [label setTextAlignment:NSTextAlignmentCenter]; 128 [label setTextAlignment:NSTextAlignmentCenter];
129 label.text = labelText; 129 label.text = labelText;
130 [self setCustomStyleForXLabel:label]; 130 [self setCustomStyleForXLabel:label];
@@ -142,6 +142,7 @@ @@ -142,6 +142,7 @@
142 if (_xLabelColor) { 142 if (_xLabelColor) {
143 label.textColor = _xLabelColor; 143 label.textColor = _xLabelColor;
144 } 144 }
  145 +
145 } 146 }
146 147
147 - (void)setCustomStyleForYLabel:(UILabel *)label 148 - (void)setCustomStyleForYLabel:(UILabel *)label