Showing
1 changed file
with
1 additions
and
40 deletions
| @@ -64,6 +64,7 @@ data02.getData = ^(NSUInteger index) { | @@ -64,6 +64,7 @@ data02.getData = ^(NSUInteger index) { | ||
| 64 | 64 | ||
| 65 | lineChart.chartData = @[data01, data02]; | 65 | lineChart.chartData = @[data01, data02]; |
| 66 | [lineChart strokeChart]; | 66 | [lineChart strokeChart]; |
| 67 | + | ||
| 67 | ``` | 68 | ``` |
| 68 | 69 | ||
| 69 | [](https://dl.dropboxusercontent.com/u/1599662/bar.png) | 70 | [](https://dl.dropboxusercontent.com/u/1599662/bar.png) |
| @@ -149,46 +150,6 @@ CGPoint end = CGPointMake(80, 45); | @@ -149,46 +150,6 @@ CGPoint end = CGPointMake(80, 45); | ||
| 149 | scatterChart.delegate = self; | 150 | scatterChart.delegate = self; |
| 150 | ``` | 151 | ``` |
| 151 | 152 | ||
| 152 | -#### Legend | ||
| 153 | - | ||
| 154 | -Legend has been added to PNChart for Line and Pie Charts. Legend items position can be stacked or in series. | ||
| 155 | - | ||
| 156 | -[](https://dl.dropboxusercontent.com/u/4904447/pnchart_legend_1.png) | ||
| 157 | - | ||
| 158 | -[](https://dl.dropboxusercontent.com/u/4904447/pnchart_legend_2.png) | ||
| 159 | - | ||
| 160 | -```objective-c | ||
| 161 | -#import "PNChart.h" | ||
| 162 | - | ||
| 163 | -//For Line Chart | ||
| 164 | - | ||
| 165 | -//Add Line Titles for the Legend | ||
| 166 | -data01.dataTitle = @"Alpha"; | ||
| 167 | -data02.dataTitle = @"Beta Beta Beta Beta"; | ||
| 168 | - | ||
| 169 | -//Build the legend | ||
| 170 | -self.lineChart.legendStyle = PNLegendItemStyleSerial; | ||
| 171 | -self.lineChart.legendFontSize = 12.0; | ||
| 172 | -UIView *legend = [self.lineChart getLegendWithMaxWidth:320]; | ||
| 173 | - | ||
| 174 | -//Move legend to the desired position and add to view | ||
| 175 | -[legend setFrame:CGRectMake(100, 400, legend.frame.size.width, legend.frame.size.height)]; | ||
| 176 | -[self.view addSubview:legend]; | ||
| 177 | - | ||
| 178 | - | ||
| 179 | -//For Pie Chart | ||
| 180 | - | ||
| 181 | -//Build the legend | ||
| 182 | -self.pieChart.legendStyle = PNLegendItemStyleStacked; | ||
| 183 | -self.pieChart.legendFontSize = 12.0; | ||
| 184 | -UIView *legend = [self.pieChart getLegendWithMaxWidth:200]; | ||
| 185 | - | ||
| 186 | -//Move legend to the desired position and add to view | ||
| 187 | -[legend setFrame:CGRectMake(130, 350, legend.frame.size.width, legend.frame.size.height)]; | ||
| 188 | -[self.view addSubview:legend]; | ||
| 189 | -``` | ||
| 190 | - | ||
| 191 | - | ||
| 192 | #### Update Value | 153 | #### Update Value |
| 193 | 154 | ||
| 194 | Now it's easy to update value in real time | 155 | Now it's easy to update value in real time |
-
Please register or login to post a comment