Making WordPress.org

Changeset 1240


Ignore:
Timestamp:
02/10/2015 12:43:47 AM (12 years ago)
Author:
obenland
Message:

WP.org Themes: Improve downloads graph display.

  • Use data from the past tow years.
  • Avoid circumstances where the most current stats were cut off.

See #745.

Location:
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/content-single.php

    r1239 r1240  
    106106                                        function drawThemeDownloadsChart() {
    107107                                                jQuery(document).ready(function($){
    108                                                         jQuery.getJSON('https://api.wordpress.org/stats/themes/1.0/downloads.php?slug=<?php echo $theme->slug; ?>&limit=267&callback=?', function (downloads) {
     108                                                        jQuery.getJSON('https://api.wordpress.org/stats/themes/1.0/downloads.php?slug=<?php echo $theme->slug; ?>&limit=730&callback=?', function (downloads) {
    109109                                                                var data = new google.visualization.DataTable(),
    110                                                                         count = 0,
    111                                                                         sml;
     110                                                                        count = 0;
    112111
    113112                                                                data.addColumn('string', _wpThemeSettings.l10n.date);
     
    121120                                                                });
    122121
    123                                                                 sml = data.getNumberOfRows() < 225;
    124 
    125122                                                                new google.visualization.ColumnChart(document.getElementById('theme-download-stats-<?php echo esc_attr( $theme->slug ); ?>')).draw(data, {
    126123                                                                        colors: ['#253578'],
     
    132129                                                                        chartArea: {
    133130                                                                                height: 280,
    134                                                                                 left: sml ? 30 : 0,
    135                                                                                 width: sml ? '80%' : '100%'
     131                                                                                left: 35,
     132                                                                                width: '98%'
    136133                                                                        },
    137134                                                                        hAxis: {
     
    140137                                                                        vAxis: {
    141138                                                                                format: '###,###',
    142                                                                                 textPosition: sml ? 'out' : 'in',
     139                                                                                textPosition: 'out',
    143140                                                                                viewWindowMode: 'explicit',
    144141                                                                                viewWindow: {min: 0}
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/js/theme.js

    r1209 r1240  
    244244                        var self = this;
    245245
    246                         $.getJSON( 'https://api.wordpress.org/stats/themes/1.0/downloads.php?slug=' + self.model.get( 'id' ) + '&limit=230&callback=?', function( downloads ) {
     246                        $.getJSON( 'https://api.wordpress.org/stats/themes/1.0/downloads.php?slug=' + self.model.get( 'id' ) + '&limit=730&callback=?', function( downloads ) {
    247247                                var data = new google.visualization.DataTable(),
    248                                         count = 0,
    249                                         sml;
     248                                        count = 0;
    250249
    251250                                data.addColumn('string', _wpThemeSettings.l10n.date);
     
    258257                                        count++;
    259258                                });
    260 
    261                                 sml = data.getNumberOfRows() < 225;
    262259
    263260                                new google.visualization.ColumnChart(document.getElementById('theme-download-stats-' + self.model.get( 'id' ) )).draw(data, {
     
    270267                                        chartArea: {
    271268                                                height: 280,
    272                                                 left: sml ? 30 : 0,
    273                                                 width: sml ? '80%' : '100%'
     269                                                left: 35,
     270                                                width: '98%'
    274271                                        },
    275272                                        hAxis: {
     
    278275                                        vAxis: {
    279276                                                format: '###,###',
    280                                                 textPosition: sml ? 'out' : 'in',
     277                                                textPosition: 'out',
    281278                                                viewWindowMode: 'explicit',
    282279                                                viewWindow: {min: 0}
Note: See TracChangeset for help on using the changeset viewer.