Changeset 203

Show
Ignore:
Timestamp:
08/24/08 10:12:00 (10 months ago)
Author:
rgrp
Message:

[shakespeare/stats][s]: bugfixes to stats WUI to get it looking nice and word chart working.

Location:
trunk/shakespeare
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/shakespeare/controllers/stats.py

    r199 r203  
    4444        c.stats = stats.word_stats(word) 
    4545        # will not have that many texts so do not need to limit c.stats 
    46         data = [ (s.text.title, s.freq) for s in c.stats ] 
     46        data = [ (s.text.title[:min(len(s.text.title), 10)], s.freq) for s in c.stats ] 
    4747        c.img_url = self.vertical_bar_chart(data) 
    4848        return render('stats/word') 
    4949 
    5050    # TODO: factor this out to its module (?) 
    51     def vertical_bar_chart(self, data, width=500): 
     51    def vertical_bar_chart(self, data, width=300): 
    5252        if not data: 
    5353            return '' 
  • trunk/shakespeare/templates/stats/text.html

    r199 r203  
    1212      Sorry, no statistics are available for ${c.text.title} (name: ${c.text.name}) 
    1313    </p> 
    14     <table style="margin-left: 550px;"> 
     14    <table> 
    1515    <thead> 
    1616      <tr> 
  • trunk/shakespeare/templates/stats/word.html

    r199 r203  
    1010 
    1111    <p py:if="not c.stats"> 
    12       Sorry, no statistics are available for ${c.text.title} (name: ${c.text.name}) 
     12      Sorry, no statistics are available for ${c.word} (NB: words are stemmed for stats purposes, so loved becomes love, bloody becomes blood etc). 
    1313    </p> 
    14     <table style="margin-left: 550px;"> 
     14                <table> 
    1515    <thead> 
    1616      <tr>