49

Screenshot

reputation graph

About

I've never been a fan of the reputation graph, but it seems a few people miss it since it has been removed.

This user script adds a little "graph" link to a user's reputation tab. Clicking it will show a graph of the user's total and daily reputation (using Google's chart API).

Note that Google has deprecated this API. Because of that, this script will probably stop working after April 20, 2015.

install / update scriptview source

Update history

  • 2012-06-18: Fixed several issues causing the script not to work anymore due to changes in the user profile page structure.
  • 2011-03-15: Visual improvements; ability to zoom into the graph by highlighting the range you want to see.
  • 2011-03-16: Fix to work with the new paged view. Any missing data will be retrieved from the server before the graph is shown; to avoid hammering the server, there's a 500ms delay between requests (so Jon Skeet's graph takes a few seconds to load).
  • 2011-03-16: Visual improvements; fixed a bug that caused an unnecessary request; improved zoom-in precision; fixed an issue where decreasing reputation could mess up the graph
  • 2011-03-18: Fixed a bug that could cause not all data to be loaded.
  • 2011-03-19: The maximum number of reputation changes that can be retrieved from the server in one request was decreased, causing the graphing to fail. This is fixed, with the side effect that it takes longer to retrieve the data, because more requests have to be made.
  • 2011-03-26 Updated to work alongside the new official reputation graph. This script's graph is now called "line graph". The "line graph" button will not show up until you visit "by time" or "by post" first, because some necessary information isn't available on "graph" (there's a way to work around this; I may look at that later).

Contact

This script is created by Benjamin Dumke-von der Ehe. Note that this is a free-time project of mine, and has nothing to do with my employment at Stack Overflow. See my profile for contact details; you can also often find me in the Tavern on Meta Stack Exchange chat.

30
  • 2
    Nice. Perhaps the graph width could be relative to the browser width instead of fixed at 640 px. Mar 14, 2011 at 1:18
  • @balpha, I feel guilty. I've got more upvotes from citing your script than you have got from the script itself! :(
    – Benjol
    Mar 15, 2011 at 17:49
  • @Benjol: meta.stackoverflow.com/questions/82431/… :)
    – balpha Staff
    Mar 15, 2011 at 18:04
  • 1
    Related: stackapps.com/questions/1471/… (Shameless plug)
    – jjnguy
    Mar 15, 2011 at 18:07
  • does this script break because of this fix? meta.stackoverflow.com/questions/83329/…
    – YOU
    Mar 16, 2011 at 1:49
  • I just installed the new version and it's doing some weird scale fail. It's hard to describe. Chrome, if it makes any difference. Mar 16, 2011 at 3:04
  • @S.Mark: Yes, it indeed does. Nick broke it :) Will work on it
    – balpha Staff
    Mar 16, 2011 at 6:02
  • @DennisWilliamson: Can you post a screenshot? Unless you mean the fact that the data seems to go back only a short time now -- that's what S.Mark was referring to.
    – balpha Staff
    Mar 16, 2011 at 6:04
  • Ah, that explains the data truncation and the Y-scale issue. Sorry I didn't look at that link before. I'll wait. Mar 16, 2011 at 6:24
  • @S.Mark: Fixed.
    – balpha Staff
    Mar 16, 2011 at 9:07
  • 1
    @DennisWilliamson: Fixed.
    – balpha Staff
    Mar 16, 2011 at 9:08
  • Thanks. I like how you integrated the Graph "button" and have a progress meter. If you put the key under the graph, there would be even more width available. "Give me an inch and I'll take a mile." ;) Mar 16, 2011 at 13:44
  • Thanks. Wow, a parsec! I was only going to ask for a light year. Mar 16, 2011 at 18:48
  • 1
    @MatthewFlaschen: [status-completed] :)
    – balpha Staff
    Mar 26, 2011 at 15:40
  • 1
    Is this post even required any more? We do have a reputation graph in the user profile page now. Mar 29, 2018 at 12:28

2 Answers 2

4

The graph never activates for me on FF14, there appear to be several changes on the reputation tab that are not accounted for in this script.

First there is too much whitespace around the text "reputation" when checking for the active tab:

$("#tabs .youarehere").text()
"\n                        \n                reputation\n            "

Using a quick whitespace cleanup call solves this for me:

$("#tabs .youarehere").text().replace(/[ \n]/g, '') != "reputation"
false

The next problem is that currently the reputation tab HTML id tabs-reputation is no longer there and thus the "line graph" button doesn't show up.

I am not sure if I am now using the correct ID for this, but if I change the button to be prepended to user-tab-reputation things work for me:

var button = $("<a href='#'>line graph<span id='graph-loading-info'></span></a>").prependTo("#user-tab-reputation").click(function(evt) {

Third, the pager has been renamed, instead of the id #reputation-pager it is now the class .user-tab-paging that needs to be looked for. Once the three references to these are fixed, you run into a 404 error loading the data:

http://stackoverflow.com/users/rep/show?sort=time&userid=100297&pagesize=30&page=2&_=1340023751083

This I fixed by altering the generated URLs with:

$.get("/users/" + userId + "?tab=reputation&pagesize=" + retrievePageSize + "&page=" + n, function (data) {

This works but leads to a series of redirects as well as the full username isn't included in the URL (for me they are redirected from http://stackoverflow.com/users/100297 to http://stackoverflow.com/users/100297/martijn-pieters for every page loaded).

I guess you'd need to parse out the username as well from the current document.location value but I was too lazy right now to add that as well.

With these edits in place it appears to work for me, but since I haven't used this script before the SO reputation tab was changed there is a chance there is still something wrong with the output.

7
  • Wow, this script was broken in several spots for ages. I guess hardly anyone uses it anymore :) Fixed now.
    – balpha Staff
    Jun 18, 2012 at 12:47
  • @balpha: debugging is ongoing :-P Jun 18, 2012 at 12:48
  • @balpha: Done, I think. Jun 18, 2012 at 13:07
  • Did you miss the "fixed now" in my previous comment? :)
    – balpha Staff
    Jun 18, 2012 at 13:09
  • @balpha: no, but I didn't actually check what you had changed either :-P I was too busy tinkering! Jun 18, 2012 at 13:10
  • @balpha: I should have realized that you'd be on the ball and fix all the issues, seeing as you have an unfair advantage over me knowing the SO site inside out.. Jun 18, 2012 at 13:11
  • 1
    This particular script doesn't really use any inside knowledge (hardly any of them do, actually) -- it's e.g. usually easier to check "what's the name of that AJAX route" by clicking and seeing what gets requested, instead of finding the relevant code (nobody can possibly know all that by hand). I go about creating user scripts like any non-SE dev would.
    – balpha Staff
    Jun 18, 2012 at 13:17
2

New (smaller) problem: when the line graph has been added to the page, switching between the representation buttons (post, time, graph) removes the line graph and disables it until reloading the page.

Steps to reproduce:

  1. load reputation page, either on post or time
  2. click the line graph button, wait for it to load all data.
  3. click one of the inactive post, time or graph buttons.
  4. graph disappears, line graph button becomes inactive
  5. clicking the line graph button activates it but nothing else happens.

Furthermore, the line graph data is empty (logically) when you first click the line graph button when on the 'graph' view of your reputation tab. Perhaps the button should be inactive there, but that could be a pain to implement.

2
  • Re the second part: This is actually prevented at least if you were on the "graph" section on page load (not after an AJAX-tab change, though). Re both of them: I'll probably not fix those; considering how long it took someone to report the other issues, hardly anyone is using this script anymore (this includes myself, obviously), so I don't think it's worth polishing any further.
    – balpha Staff
    Jun 18, 2012 at 13:36
  • @balpha: understood; I'll leave this here for others to find as a "known issue". Jun 18, 2012 at 13:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .