Welcome, Guest. Please Login or Register.
May 19th, 2024, 6:45am

Home Home Help Help Search Search Members Members Login Login Register Register
Arimaa Forum « Rating graphs in Javascript »


   Arimaa Forum
   Arimaa
   Site Discussion
(Moderator: supersamu)
   Rating graphs in Javascript
« Previous topic | Next topic »
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print
   Author  Topic: Rating graphs in Javascript  (Read 631 times)
omar
Forum Guru
*****



Arimaa player #2

   


Gender: male
Posts: 1003
Rating graphs in Javascript
« on: Jan 18th, 2008, 9:05pm »
Quote Quote Modify Modify

For a long time I've been wanting to show a graph of the players rating history on the players profile page. I thought I would have to do this in Java or Flash, but I just found that graphs can be created in Javascript; WOW Smiley
 
Check out this page:
http://www.dynamicdrive.com/dynamicindex11/linegraph.htm
 
It worked for me in both FF and IE.
 
To begin with I think I'll setup a web service for accessing player rating histories. That way anyone who wants to can take a crack at generating the rating graphs.
 
You would pass it a list of player names and for each player it would return back a table with game_id, game_time, and rating.
IP Logged
leo
Forum Guru
*****





   


Gender: male
Posts: 278
Re: Rating graphs in Javascript
« Reply #1 on: Jan 19th, 2008, 3:53am »
Quote Quote Modify Modify

Shocked There soon will be complete web apps all in Javascript... It might even be possible to generate SVG pictures if they can be inlined. This player history server is a good idea.
IP Logged
omar
Forum Guru
*****



Arimaa player #2

   


Gender: male
Posts: 1003
Re: Rating graphs in Javascript
« Reply #2 on: Jan 19th, 2008, 5:57am »
Quote Quote Modify Modify

Yes, you are right Leo. I think eventually we might not need any browser plugins to build fancy, cross-platform applications. Im looking forward to that day.
 
I've just created the web service to get the player rating history.
 
You call it with a comma separated list of usernames like this:
http://arimaa.com/arimaa/gameroom/playerRatingHist.cgi?u=omar,aamir
 
It returns a JSON(www.json.org) formated string with the requested data. This is a great format for easily converting back to an object in Javascript.
 
Now all we have to do is graph the data in Javascript.
 
IP Logged
omar
Forum Guru
*****



Arimaa player #2

   


Gender: male
Posts: 1003
Re: Rating graphs in Javascript
« Reply #3 on: Jan 19th, 2008, 6:42pm »
Quote Quote Modify Modify

I tried out the javascript graphs, but it seems to run too slow in the browser.  
 
You can try it out here:
http://arimaa.com/arimaa/gameroom/graphRatings.htm
 
Between the time it gets the data and the graph shows up there is a bit of a delay.
« Last Edit: Jan 19th, 2008, 6:52pm by omar » IP Logged
Fritzlein
Forum Guru
*****



Arimaa player #706

   
Email

Gender: male
Posts: 5928
Re: Rating graphs in Javascript
« Reply #4 on: Jan 19th, 2008, 6:49pm »
Quote Quote Modify Modify

on Jan 19th, 2008, 6:42pm, omar wrote:
I tried out the javascript graphs, but it seems to run too slow in the browser.  
 
You can try it out here:
http://arimaa.com/arimaa/gameroom/graphRatings.htm

Cool!  Except the rating is jumping around way more than possible from one game to the next.  Perhaps the opponents' ratings are being used for half the games?  Or else the games are not in chronological order?
IP Logged

omar
Forum Guru
*****



Arimaa player #2

   


Gender: male
Posts: 1003
Re: Rating graphs in Javascript
« Reply #5 on: Jan 19th, 2008, 6:55pm »
Quote Quote Modify Modify

Yeah, you are right. I wasn't even paying attention to the data. I just fixed it. Thanks.
IP Logged
Fritzlein
Forum Guru
*****



Arimaa player #706

   
Email

Gender: male
Posts: 5928
Re: Rating graphs in Javascript
« Reply #6 on: Jan 20th, 2008, 6:45pm »
Quote Quote Modify Modify

Hmmm... Before the graph was clearly wrong, but now I'm not getting a graph at all, just some negative numbers on the vertical axis.  Which situation is to be preferred?  Smiley
IP Logged

omar
Forum Guru
*****



Arimaa player #2

   


Gender: male
Posts: 1003
Re: Rating graphs in Javascript
« Reply #7 on: Jan 21st, 2008, 8:44am »
Quote Quote Modify Modify

Oops, missing ampersand. Try it now.
IP Logged
Fritzlein
Forum Guru
*****



Arimaa player #706

   
Email

Gender: male
Posts: 5928
Re: Rating graphs in Javascript
« Reply #8 on: Jan 21st, 2008, 9:46am »
Quote Quote Modify Modify

Excellent.  Now I get the right ratings in the right order.  Also it is much faster than it was before.  It's a nifty feature too that I can type in a second name and compare the two lines on the same graph.
 
If you want to keep improving the tool, I'd say the next feature would be the scaling of the axes.  The vertical axis would be more informative if it crossed the horizontal axis at the minimum rating rather than at zero.  The horizontal axis would be easier to understand as time rather than game number, particularly for comparing two players.
 
I have a hunch this little tool could become quite popular some day.
 
IP Logged

Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print

« Previous topic | Next topic »

Arimaa Forum » Powered by YaBB 1 Gold - SP 1.3.1!
YaBB © 2000-2003. All Rights Reserved.