Scott Main | 50e990c | 2012-06-21 17:14:39 -0700 | [diff] [blame] | 1 | page.title=Dashboards |
Dirk Dougherty | 3506ac8 | 2014-02-21 11:15:52 -0800 | [diff] [blame] | 2 | page.metaDescription=page.metaDescription=Charts that give you an overview of device characteristics and platform versions that are active in the Android ecosystem. |
| 3 | page.tags="android, dashboard, platforms, versions" |
| 4 | meta.tags="ecosystem, versions, whatsnew" |
Scott Main | 50e990c | 2012-06-21 17:14:39 -0700 | [diff] [blame] | 5 | @jd:body |
| 6 | |
Scott Main | 3cd0b46 | 2013-02-27 17:51:49 -0800 | [diff] [blame] | 7 | <style> |
| 8 | div.chart, |
| 9 | div.screens-chart { |
| 10 | display:none; |
| 11 | } |
| 12 | tr .total { |
| 13 | background-color:transparent; |
| 14 | border:0; |
| 15 | color:#666; |
| 16 | } |
| 17 | tr th.total { |
| 18 | font-weight:bold; |
| 19 | } |
| 20 | </style> |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | <div class="sidebox"> |
| 26 | <h2>Google Play Install Stats</h2> |
| 27 | <p>The Google Play Developer Console also provides <a |
Dirk Dougherty | 3506ac8 | 2014-02-21 11:15:52 -0800 | [diff] [blame] | 28 | href="{@docRoot}distribute/googleplay/developer-console.html#app-stats">detailed statistics</a> |
Scott Main | 3cd0b46 | 2013-02-27 17:51:49 -0800 | [diff] [blame] | 29 | about your users' devices. Those stats may help you prioritize the device profiles for which |
| 30 | you optimize your app.</p> |
| 31 | </div> |
| 32 | |
| 33 | <p>This page provides information about the relative number of devices that share a certain |
| 34 | characteristic, such as Android version or screen size. This information may |
| 35 | help you prioritize efforts for <a |
Scott Main | 847480c | 2013-09-03 18:01:31 -0700 | [diff] [blame] | 36 | href="{@docRoot}training/basics/supporting-devices/index.html">supporting different devices</a> |
| 37 | by revealing which devices are active in the Android and Google Play ecosystem.</p> |
Scott Main | 3cd0b46 | 2013-02-27 17:51:49 -0800 | [diff] [blame] | 38 | |
Scott Main | 847480c | 2013-09-03 18:01:31 -0700 | [diff] [blame] | 39 | <p>This data reflects devices running the latest Google Play Store app, which is compatible |
| 40 | with Android 2.2 and higher. Each snapshot of data represents all the devices that visited the |
| 41 | Google Play Store in the prior 7 days.</p> |
Scott Main | 3cd0b46 | 2013-02-27 17:51:49 -0800 | [diff] [blame] | 42 | |
Scott Main | 847480c | 2013-09-03 18:01:31 -0700 | [diff] [blame] | 43 | |
Scott Main | 50e990c | 2012-06-21 17:14:39 -0700 | [diff] [blame] | 44 | |
| 45 | <h2 id="Platform">Platform Versions</h2> |
| 46 | |
Scott Main | 3cd0b46 | 2013-02-27 17:51:49 -0800 | [diff] [blame] | 47 | <p>This section provides data about the relative number of devices running a given version of |
| 48 | the Android platform.</p> |
| 49 | |
| 50 | <p>For information about how to target your application to devices based on |
Scott Main | bf03f39 | 2013-08-01 15:23:19 -0700 | [diff] [blame] | 51 | platform version, read <a |
Scott Main | 3cd0b46 | 2013-02-27 17:51:49 -0800 | [diff] [blame] | 52 | href="{@docRoot}training/basics/supporting-devices/platforms.html">Supporting Different |
| 53 | Platform Versions</a>.</p> |
Scott Main | 50e990c | 2012-06-21 17:14:39 -0700 | [diff] [blame] | 54 | |
| 55 | |
Scott Main | 3cd0b46 | 2013-02-27 17:51:49 -0800 | [diff] [blame] | 56 | <div id="version-chart"> |
Scott Main | 50e990c | 2012-06-21 17:14:39 -0700 | [diff] [blame] | 57 | </div> |
| 58 | |
Scott Main | 50e990c | 2012-06-21 17:14:39 -0700 | [diff] [blame] | 59 | |
Joe Fernandez | 1f5acf8 | 2014-12-01 10:25:01 -0800 | [diff] [blame] | 60 | <p style="clear:both"><em>Data collected during a 7-day period ending on December 1, 2014. |
Scott Main | 3cd0b46 | 2013-02-27 17:51:49 -0800 | [diff] [blame] | 61 | <br/>Any versions with less than 0.1% distribution are not shown.</em> |
| 62 | </p> |
Scott Main | 50e990c | 2012-06-21 17:14:39 -0700 | [diff] [blame] | 63 | |
Scott Main | 847480c | 2013-09-03 18:01:31 -0700 | [diff] [blame] | 64 | <p class="note"><strong>Note:</strong> Because this data is gathered from the new Google Play |
| 65 | Store app, which supports Android 2.2 and above, devices running older versions are not included. |
| 66 | However, in August, 2013, versions older than Android 2.2 accounted for about 1% of devices that |
| 67 | <em>checked in</em> to Google servers (not those that actually visited Google Play Store). |
| 68 | </p> |
Scott Main | 50e990c | 2012-06-21 17:14:39 -0700 | [diff] [blame] | 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | <h2 id="Screens">Screen Sizes and Densities</h2> |
| 75 | |
Scott Main | d46023d | 2012-09-04 20:55:57 -0700 | [diff] [blame] | 76 | |
Scott Main | 3cd0b46 | 2013-02-27 17:51:49 -0800 | [diff] [blame] | 77 | <p>This section provides data about the relative number of devices that have a particular |
Scott Main | 50e990c | 2012-06-21 17:14:39 -0700 | [diff] [blame] | 78 | screen configuration, defined by a combination of screen size and density. To simplify the way that |
| 79 | you design your user interfaces for different screen configurations, Android divides the range of |
Scott Main | 3cd0b46 | 2013-02-27 17:51:49 -0800 | [diff] [blame] | 80 | actual screen sizes and densities into several buckets as expressed by the table below.</p> |
Scott Main | 50e990c | 2012-06-21 17:14:39 -0700 | [diff] [blame] | 81 | |
| 82 | <p>For information about how you can support multiple screen configurations in your |
Scott Main | 3cd0b46 | 2013-02-27 17:51:49 -0800 | [diff] [blame] | 83 | application, read <a href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple |
Scott Main | 50e990c | 2012-06-21 17:14:39 -0700 | [diff] [blame] | 84 | Screens</a>.</p> |
| 85 | |
Scott Main | 3cd0b46 | 2013-02-27 17:51:49 -0800 | [diff] [blame] | 86 | |
| 87 | <div id="screens-chart"> |
| 88 | </div> |
Scott Main | 50e990c | 2012-06-21 17:14:39 -0700 | [diff] [blame] | 89 | |
| 90 | |
Joe Fernandez | 1f5acf8 | 2014-12-01 10:25:01 -0800 | [diff] [blame] | 91 | <p style="clear:both"><em>Data collected during a 7-day period ending on December 1, 2014. |
Robert Ly | 52a1816 | 2014-09-09 15:40:50 -0700 | [diff] [blame] | 92 | |
Scott Main | 3cd0b46 | 2013-02-27 17:51:49 -0800 | [diff] [blame] | 93 | <br/>Any screen configurations with less than 0.1% distribution are not shown.</em></p> |
Scott Main | 50e990c | 2012-06-21 17:14:39 -0700 | [diff] [blame] | 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | |
| 102 | <h2 id="OpenGL">Open GL Version</h2> |
| 103 | |
Scott Main | 3cd0b46 | 2013-02-27 17:51:49 -0800 | [diff] [blame] | 104 | <p>This section provides data about the relative number of devices that support a particular |
Scott Main | 50e990c | 2012-06-21 17:14:39 -0700 | [diff] [blame] | 105 | version of OpenGL ES. Note that support for one particular version of OpenGL ES also implies |
| 106 | support for any lower version (for example, support for version 2.0 also implies support for |
| 107 | 1.1).</p> |
| 108 | |
Scott Main | d46023d | 2012-09-04 20:55:57 -0700 | [diff] [blame] | 109 | |
| 110 | <img alt="" style="float:right" |
Joe Fernandez | 1f5acf8 | 2014-12-01 10:25:01 -0800 | [diff] [blame] | 111 | src="//chart.googleapis.com/chart?chl=GL%202.0%7CGL%203.0&chf=bg%2Cs%2C00000000&chd=t%3A72.2%2C27.8&chco=c4df9b%2C6fad0c&cht=p&chs=400x250" /> |
| 112 | |
Scott Main | d46023d | 2012-09-04 20:55:57 -0700 | [diff] [blame] | 113 | |
Scott Main | 50e990c | 2012-06-21 17:14:39 -0700 | [diff] [blame] | 114 | <p>To declare which version of OpenGL ES your application requires, you should use the {@code |
| 115 | android:glEsVersion} attribute of the <a |
| 116 | href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code <uses-feature>}</a> |
| 117 | element. You can also use the <a |
| 118 | href="{@docRoot}guide/topics/manifest/supports-gl-texture-element.html">{@code |
| 119 | <supports-gl-texture>}</a> element to declare the GL compression formats that your application |
| 120 | uses.</p> |
| 121 | |
Scott Main | 50e990c | 2012-06-21 17:14:39 -0700 | [diff] [blame] | 122 | |
Scott Main | d46023d | 2012-09-04 20:55:57 -0700 | [diff] [blame] | 123 | <table style="width:350px"> |
Scott Main | 50e990c | 2012-06-21 17:14:39 -0700 | [diff] [blame] | 124 | <tr> |
| 125 | <th scope="col">OpenGL ES Version</th> |
| 126 | <th scope="col">Distribution</th> |
| 127 | </tr> |
| 128 | <tr> |
Robert Ly | 52a1816 | 2014-09-09 15:40:50 -0700 | [diff] [blame] | 129 | <td>2.0</td> |
Joe Fernandez | 1f5acf8 | 2014-12-01 10:25:01 -0800 | [diff] [blame] | 130 | <td>72.2%</td> |
Scott Main | 50e990c | 2012-06-21 17:14:39 -0700 | [diff] [blame] | 131 | </tr> |
| 132 | <tr> |
Robert Ly | 52a1816 | 2014-09-09 15:40:50 -0700 | [diff] [blame] | 133 | <td>3.0</td> |
Joe Fernandez | 1f5acf8 | 2014-12-01 10:25:01 -0800 | [diff] [blame] | 134 | <td>27.8%</td> |
Scott Main | 50e990c | 2012-06-21 17:14:39 -0700 | [diff] [blame] | 135 | </tr> |
| 136 | </table> |
Scott Main | 50e990c | 2012-06-21 17:14:39 -0700 | [diff] [blame] | 137 | |
| 138 | |
Scott Main | d46023d | 2012-09-04 20:55:57 -0700 | [diff] [blame] | 139 | |
Joe Fernandez | 1f5acf8 | 2014-12-01 10:25:01 -0800 | [diff] [blame] | 140 | <p style="clear:both"><em>Data collected during a 7-day period ending on December 1, 2014</em></p> |
Scott Main | 3cd0b46 | 2013-02-27 17:51:49 -0800 | [diff] [blame] | 141 | |
| 142 | |
| 143 | |
| 144 | |
| 145 | |
| 146 | |
| 147 | |
| 148 | |
| 149 | |
| 150 | |
| 151 | |
| 152 | |
| 153 | |
| 154 | <script> |
| 155 | var VERSION_DATA = |
| 156 | [ |
| 157 | { |
Joe Fernandez | 1f5acf8 | 2014-12-01 10:25:01 -0800 | [diff] [blame] | 158 | "chart": "//chart.googleapis.com/chart?chl=Froyo%7CGingerbread%7CIce%20Cream%20Sandwich%7CJelly%20Bean%7CKitKat&chf=bg%2Cs%2C00000000&chd=t%3A0.5%2C9.1%2C7.8%2C48.7%2C33.9&chco=c4df9b%2C6fad0c&cht=p&chs=500x250", |
Scott Main | 3cd0b46 | 2013-02-27 17:51:49 -0800 | [diff] [blame] | 159 | "data": [ |
| 160 | { |
Scott Main | 3cd0b46 | 2013-02-27 17:51:49 -0800 | [diff] [blame] | 161 | "api": 8, |
| 162 | "name": "Froyo", |
Joe Fernandez | 1f5acf8 | 2014-12-01 10:25:01 -0800 | [diff] [blame] | 163 | "perc": "0.5" |
Scott Main | 3cd0b46 | 2013-02-27 17:51:49 -0800 | [diff] [blame] | 164 | }, |
| 165 | { |
| 166 | "api": 10, |
| 167 | "name": "Gingerbread", |
Joe Fernandez | 1f5acf8 | 2014-12-01 10:25:01 -0800 | [diff] [blame] | 168 | "perc": "9.1" |
Scott Main | 3cd0b46 | 2013-02-27 17:51:49 -0800 | [diff] [blame] | 169 | }, |
| 170 | { |
| 171 | "api": 15, |
| 172 | "name": "Ice Cream Sandwich", |
Joe Fernandez | 1f5acf8 | 2014-12-01 10:25:01 -0800 | [diff] [blame] | 173 | "perc": "7.8" |
Scott Main | 3cd0b46 | 2013-02-27 17:51:49 -0800 | [diff] [blame] | 174 | }, |
| 175 | { |
| 176 | "api": 16, |
| 177 | "name": "Jelly Bean", |
Joe Fernandez | 1f5acf8 | 2014-12-01 10:25:01 -0800 | [diff] [blame] | 178 | "perc": "21.3" |
Scott Main | 3cd0b46 | 2013-02-27 17:51:49 -0800 | [diff] [blame] | 179 | }, |
| 180 | { |
| 181 | "api": 17, |
| 182 | "name": "Jelly Bean", |
Joe Fernandez | 1f5acf8 | 2014-12-01 10:25:01 -0800 | [diff] [blame] | 183 | "perc": "20.4" |
Scott Main | f5468f6 | 2013-10-02 16:21:42 -0700 | [diff] [blame] | 184 | }, |
| 185 | { |
| 186 | "api": 18, |
| 187 | "name": "Jelly Bean", |
Joe Fernandez | 1f5acf8 | 2014-12-01 10:25:01 -0800 | [diff] [blame] | 188 | "perc": "7.0" |
Scott Main | 65907fd | 2013-12-02 11:38:42 -0800 | [diff] [blame] | 189 | }, |
| 190 | { |
| 191 | "api": 19, |
| 192 | "name": "KitKat", |
Joe Fernandez | 1f5acf8 | 2014-12-01 10:25:01 -0800 | [diff] [blame] | 193 | "perc": "33.9" |
Scott Main | 3cd0b46 | 2013-02-27 17:51:49 -0800 | [diff] [blame] | 194 | } |
| 195 | ] |
| 196 | } |
| 197 | ]; |
| 198 | |
| 199 | |
Scott Main | 3cd0b46 | 2013-02-27 17:51:49 -0800 | [diff] [blame] | 200 | var SCREEN_DATA = |
| 201 | [ |
| 202 | { |
| 203 | "data": { |
| 204 | "Large": { |
Dirk Dougherty | ccc5ca1 | 2014-01-08 15:52:27 -0800 | [diff] [blame] | 205 | "hdpi": "0.6", |
Robert Ly | ba5c49dcd | 2014-08-12 12:26:37 -0700 | [diff] [blame] | 206 | "ldpi": "0.5", |
Joe Fernandez | 1f5acf8 | 2014-12-01 10:25:01 -0800 | [diff] [blame] | 207 | "mdpi": "4.6", |
| 208 | "tvdpi": "2.0", |
Robert Ly | 52a1816 | 2014-09-09 15:40:50 -0700 | [diff] [blame] | 209 | "xhdpi": "0.6" |
Scott Main | 3cd0b46 | 2013-02-27 17:51:49 -0800 | [diff] [blame] | 210 | }, |
| 211 | "Normal": { |
Joe Fernandez | 1f5acf8 | 2014-12-01 10:25:01 -0800 | [diff] [blame] | 212 | "hdpi": "36.9", |
| 213 | "mdpi": "9.4", |
| 214 | "tvdpi": "0.2", |
| 215 | "xhdpi": "18.8", |
| 216 | "xxhdpi": "16.3" |
Scott Main | 3cd0b46 | 2013-02-27 17:51:49 -0800 | [diff] [blame] | 217 | }, |
| 218 | "Small": { |
Joe Fernandez | 1f5acf8 | 2014-12-01 10:25:01 -0800 | [diff] [blame] | 219 | "ldpi": "5.4" |
Scott Main | 3cd0b46 | 2013-02-27 17:51:49 -0800 | [diff] [blame] | 220 | }, |
| 221 | "Xlarge": { |
Scott Main | 749120f | 2014-02-04 10:57:47 -0800 | [diff] [blame] | 222 | "hdpi": "0.3", |
Joe Fernandez | 1f5acf8 | 2014-12-01 10:25:01 -0800 | [diff] [blame] | 223 | "mdpi": "3.8", |
| 224 | "xhdpi": "0.6" |
Scott Main | 3cd0b46 | 2013-02-27 17:51:49 -0800 | [diff] [blame] | 225 | } |
| 226 | }, |
Joe Fernandez | 1f5acf8 | 2014-12-01 10:25:01 -0800 | [diff] [blame] | 227 | "densitychart": "//chart.googleapis.com/chart?chl=ldpi%7Cmdpi%7Ctvdpi%7Chdpi%7Cxhdpi%7Cxxhdpi&chf=bg%2Cs%2C00000000&chd=t%3A5.9%2C17.8%2C2.2%2C37.8%2C20.0%2C16.3&chco=c4df9b%2C6fad0c&cht=p&chs=400x250", |
| 228 | "layoutchart": "//chart.googleapis.com/chart?chl=Xlarge%7CLarge%7CNormal%7CSmall&chf=bg%2Cs%2C00000000&chd=t%3A4.7%2C8.3%2C81.6%2C5.4&chco=c4df9b%2C6fad0c&cht=p&chs=400x250" |
Scott Main | 3cd0b46 | 2013-02-27 17:51:49 -0800 | [diff] [blame] | 229 | } |
| 230 | ]; |
| 231 | |
| 232 | |
| 233 | |
| 234 | var VERSION_NAMES = |
| 235 | [ |
| 236 | {"api":0},{"api":1},{"api":2},{"api":3}, |
Scott Main | bf03f39 | 2013-08-01 15:23:19 -0700 | [diff] [blame] | 237 | { |
Scott Main | 3cd0b46 | 2013-02-27 17:51:49 -0800 | [diff] [blame] | 238 | "api":4, |
| 239 | "link":"<a href='/about/versions/android-1.6.html'>1.6</a>", |
| 240 | "codename":"Donut", |
| 241 | }, |
| 242 | { "api":5}, |
| 243 | { "api":6}, |
Scott Main | bf03f39 | 2013-08-01 15:23:19 -0700 | [diff] [blame] | 244 | { |
Scott Main | 3cd0b46 | 2013-02-27 17:51:49 -0800 | [diff] [blame] | 245 | "api":7, |
| 246 | "link":"<a href='/about/versions/android-2.1.html'>2.1</a>", |
| 247 | "codename":"Eclair", |
| 248 | }, |
| 249 | { |
| 250 | "api":8, |
| 251 | "link":"<a href='/about/versions/android-2.2.html'>2.2</a>", |
| 252 | "codename":"Froyo" |
| 253 | }, |
| 254 | { |
| 255 | "api":9, |
| 256 | "link":"<a href='/about/versions/android-2.3.html'>2.3 -<br>2.3.2</a>", |
| 257 | "codename":"Gingerbread" |
| 258 | }, |
| 259 | { |
| 260 | "api":10, |
| 261 | "link":"<a href='/about/versions/android-2.3.3.html'>2.3.3 -<br>2.3.7</a>", |
| 262 | "codename":"Gingerbread" |
| 263 | }, |
| 264 | { "api":11}, |
| 265 | { |
| 266 | "api":12, |
| 267 | "link":"<a href='/about/versions/android-3.1.html'>3.1</a>", |
| 268 | "codename":"Honeycomb" |
| 269 | }, |
| 270 | { |
| 271 | "api":13, |
| 272 | "link":"<a href='/about/versions/android-3.2.html'>3.2</a>", |
| 273 | "codename":"Honeycomb" |
| 274 | }, |
| 275 | { "api":14}, |
| 276 | { |
| 277 | "api":15, |
| 278 | "link":"<a href='/about/versions/android-4.0.html'>4.0.3 -<br>4.0.4</a>", |
| 279 | "codename":"Ice Cream Sandwich" |
| 280 | }, |
| 281 | { |
| 282 | "api":16, |
| 283 | "link":"<a href='/about/versions/android-4.1.html'>4.1.x</a>", |
| 284 | "codename":"Jelly Bean" |
| 285 | }, |
| 286 | { |
| 287 | "api":17, |
| 288 | "link":"<a href='/about/versions/android-4.2.html'>4.2.x</a>", |
| 289 | "codename":"Jelly Bean" |
Scott Main | 847480c | 2013-09-03 18:01:31 -0700 | [diff] [blame] | 290 | }, |
| 291 | { |
| 292 | "api":18, |
| 293 | "link":"<a href='/about/versions/android-4.3.html'>4.3</a>", |
| 294 | "codename":"Jelly Bean" |
Scott Main | 65907fd | 2013-12-02 11:38:42 -0800 | [diff] [blame] | 295 | }, |
| 296 | { |
| 297 | "api":19, |
| 298 | "link":"<a href='/about/versions/android-4.4.html'>4.4</a>", |
| 299 | "codename":"KitKat" |
Joe Fernandez | 9dc852a | 2014-10-30 10:57:31 -0700 | [diff] [blame] | 300 | }, |
| 301 | { |
| 302 | "api":20, |
| 303 | "link":"<a href='/about/versions/android-4.4.html'>4.4W</a>", |
| 304 | "codename":"KitKat for Wear" |
| 305 | }, |
| 306 | { |
| 307 | "api":21, |
| 308 | "link":"<a href='/about/versions/android-5.0.html'>4.4</a>", |
| 309 | "codename":"Lollipop" |
Scott Main | 3cd0b46 | 2013-02-27 17:51:49 -0800 | [diff] [blame] | 310 | } |
| 311 | ]; |
| 312 | |
| 313 | |
| 314 | |
| 315 | |
| 316 | |
| 317 | |
| 318 | |
| 319 | |
| 320 | |
| 321 | |
| 322 | |
| 323 | |
| 324 | |
| 325 | |
| 326 | |
| 327 | |
| 328 | |
| 329 | |
| 330 | |
| 331 | $(document).ready(function(){ |
| 332 | // for each set of data (each month) |
| 333 | $.each(VERSION_DATA, function(i, set) { |
| 334 | |
| 335 | // set up wrapper divs |
| 336 | var $div = $('<div class="chart"' |
| 337 | + ((i == 0) ? ' style="display:block"' : '') |
| 338 | + ' >'); |
| 339 | var $divtable = $('<div class="col-5" style="margin-left:0">'); |
| 340 | var $divchart = $('<div class="col-8" style="margin-right:0">'); |
| 341 | |
| 342 | // set up a new table |
| 343 | var $table = $("<table>"); |
| 344 | var $trh = $("<tr><th>Version</th>" |
| 345 | + "<th>Codename</th>" |
| 346 | + "<th>API</th>" |
| 347 | + "<th>Distribution</th></tr>"); |
| 348 | $table.append($trh); |
| 349 | |
| 350 | // loop each data set (each api level represented in stats) |
| 351 | $.each(set.data, function(i, data) { |
| 352 | // check if we need to rowspan the codename |
| 353 | var rowspan = 1; |
| 354 | // must not be first row |
| 355 | if (i > 0) { |
| 356 | // if this row's codename is the same as previous row codename |
| 357 | if (data.name == set.data[i-1].name) { |
| 358 | rowspan = 0; |
| 359 | // otherwise, as long as this is not the last row |
| 360 | } else if (i < (set.data.length - 1)) { |
| 361 | // increment rowspan for each subsequent row w/ same codename |
| 362 | while (data.name == set.data[i+rowspan].name) { |
| 363 | rowspan++; |
| 364 | // unless we've reached the last row |
| 365 | if ((i + rowspan) >= set.data.length) break; |
| 366 | } |
| 367 | } |
| 368 | } |
| 369 | |
| 370 | // create table row and get corresponding version info from VERSION_NAMES |
| 371 | var $tr = $("<tr>"); |
| 372 | $tr.append("<td>" + VERSION_NAMES[data.api].link + "</td>"); |
| 373 | if (rowspan > 0) { |
| 374 | $tr.append("<td rowspan='" + rowspan + "'>" + VERSION_NAMES[data.api].codename + "</td>"); |
| 375 | } |
| 376 | $tr.append("<td>" + data.api + "</td>"); |
| 377 | $tr.append("<td>" + data.perc + "%</td>"); |
| 378 | $table.append($tr); |
| 379 | }); |
| 380 | |
| 381 | // create chart image |
| 382 | var $chart = $('<img style="margin-left:30px" alt="" src="' + set.chart + '" />'); |
| 383 | |
| 384 | // stack up and insert the elements |
| 385 | $divtable.append($table); |
| 386 | $divchart.append($chart); |
| 387 | $div.append($divtable).append($divchart); |
| 388 | $("#version-chart").append($div); |
| 389 | }); |
| 390 | |
| 391 | |
| 392 | |
| 393 | var SCREEN_SIZES = ["Small","Normal","Large","Xlarge"]; |
| 394 | var SCREEN_DENSITIES = ["ldpi","mdpi","tvdpi","hdpi","xhdpi","xxhdpi"]; |
| 395 | |
| 396 | |
| 397 | // for each set of screens data (each month) |
| 398 | $.each(SCREEN_DATA, function(i, set) { |
| 399 | |
| 400 | // set up wrapper divs |
| 401 | var $div = $('<div class="screens-chart"' |
| 402 | + ((i == 0) ? ' style="display:block"' : '') |
| 403 | + ' >'); |
| 404 | |
| 405 | // set up a new table |
| 406 | var $table = $("<table>"); |
| 407 | var $trh = $("<tr><th></th></tr>"); |
| 408 | $.each(SCREEN_DENSITIES, function(i, density) { |
| 409 | $trh.append("<th scope='col'>" + density + "</th>"); |
| 410 | }); |
| 411 | $trh.append("<th scope='col' class='total'>Total</th>"); |
| 412 | $table.append($trh); |
| 413 | |
| 414 | // array to hold totals for each density |
| 415 | var densityTotals = new Array(SCREEN_DENSITIES.length); |
| 416 | $.each(densityTotals, function(i, total) { |
| 417 | densityTotals[i] = 0; // make them all zero to start |
| 418 | }); |
| 419 | |
| 420 | // loop through each screen size |
| 421 | $.each(SCREEN_SIZES, function(i, size) { |
| 422 | // if there are any devices of this size |
| 423 | if (typeof set.data[size] != "undefined") { |
| 424 | // create table row and insert data |
| 425 | var $tr = $("<tr>"); |
| 426 | $tr.append("<th scope='row'>" + size + "</th>"); |
| 427 | // variable to sum all densities for this size |
| 428 | var total = 0; |
| 429 | // loop through each density |
| 430 | $.each(SCREEN_DENSITIES, function(i, density) { |
| 431 | var num = typeof set.data[size][density] != "undefined" ? set.data[size][density] : 0; |
| 432 | $tr.append("<td>" + (num != 0 ? num + "%" : "") + "</td>"); |
| 433 | total += parseFloat(num); |
| 434 | densityTotals[i] += parseFloat(num); |
| 435 | }) |
| 436 | $tr.append("<td class='total'>" + total.toFixed(1) + "%</td>"); |
| 437 | $table.append($tr); |
| 438 | } |
| 439 | }); |
| 440 | |
| 441 | // create row of totals for each density |
| 442 | var $tr = $("<tr><th class='total'>Total</th></tr>"); |
| 443 | $.each(densityTotals, function(i, total) { |
| 444 | $tr.append("<td class='total'>" + total.toFixed(1) + "%</td>"); |
| 445 | }); |
| 446 | $table.append($tr); |
| 447 | |
| 448 | // create charts |
| 449 | var $sizechart = $('<img style="float:left;width:380px" alt="" src="' |
| 450 | + set.layoutchart + '" />'); |
| 451 | var $densitychart = $('<img style="float:left;width:380px" alt="" src="' |
| 452 | + set.densitychart + '" />'); |
| 453 | |
| 454 | // stack up and insert the elements |
| 455 | $div.append($table).append($sizechart).append($densitychart); |
| 456 | $("#screens-chart").append($div); |
| 457 | }); |
| 458 | |
| 459 | |
| 460 | }); |
| 461 | |
| 462 | |
| 463 | |
| 464 | function changeVersionDate() { |
| 465 | var date = $('#date-versions option:selected').val(); |
| 466 | |
| 467 | $(".chart").hide(); |
| 468 | $(".chart."+date+"").show(); |
| 469 | } |
| 470 | |
| 471 | |
| 472 | function changeScreensVersionDate() { |
| 473 | var date = $('#date-screens option:selected').val(); |
| 474 | |
| 475 | $(".screens-chart").hide(); |
| 476 | $(".screens-chart."+date+"").show(); |
| 477 | } |
| 478 | |
| 479 | </script> |