Gear Calculator v4.4.2

This program is a work in progress
Please send comments, suggestions, and bug reports to:
Mike Sherman at mike.sherman@earthlink.net

       


Help

Top
Calculator
My hope is that the program is pretty self-explainatory, but here are a few notes on what everything is:

Inputs    
  Cassette Select the Rear sprockets, either from a preset on the pull-down menu, or by editing the individual sprockets with +/- buttons.
The X button removes the sprocket.
  Chainrings Select the Chainrings by editing the individual sprockets with +/- buttons.
The X button removes the sprocket.
  Wheel Select a wheel and tire size from the pull down menu.
  Crank Select a crank arm length from the pull down menu.
This value is only used for Sheldon Brown's Gain Ratio Table.
Outputs    
  Gear Inch Chart This is the traditional Gear Inch Chart.
The values are the equivalent diameter of a direct drive wheel.
Sheldon Brown has a good description on his
  Semi-Log Graph This is my personal favorite. The log graph can give you a pretty good idea of what a set of gears will feel like. Evenly spaced gears on this graph will feel evenly spaced to your legs.
  Gain Ratio Table The Link explains it better than I can.
  Rollout Table This table show how far the bike moves with each revolution of the pedals.
It is usually expressed in meters. I provide English or Metric units.
This measurement is also know as development
  Speed over RPM Range The title pretty much explains it. You can set the upper and lower limits of your cadance.
  Speed table Shows you speed at the selected crank RPM.
  Save/Recall/Swap Buttons This is intended to help you compair two gearing configurations.
The Save button saves the current selections to a cookie on your system.
The Recall button will recall the saved selections. It does not save the current selections first.
The Swap button swaps the current selections with the last saved selections. The current selections are saved.
  Bookmark I thought it would be great to be able be able to bookmark a complete set of gears. Unfortuneatly, some browsers don't allow you to make a bookmark from javascript. I can see why they did that.
On some browsers, the bookmark button will re-load the page with all of the settings imbeded in the URL and puts up a pop-up to tell you what it did. You can then bookmark the page the normal way to save a gear set.
  Highlighting While the mouse is any of the cog change buttons, the element changing it will effect is highlighted on the gear table, the log graph, and the speed graph.
It does force more redrawing of the effected tables
A checkbox at the bottom enables this.

Notes about Gearing
There are lots of ways to look at bicycle gearing. There are many people with strong opinions about how bicycle gearing should be set up. I have my own opinions. I have tried not to allow them to influence the calculator too much, but some has crept in. A user pointed this out to me with the way the sorting works on the speed range graph.

I suggest you look at Sheldon Brown's article Gear Theory for Bicyclists (edited by John Allen).

If you're interested in half-step gearing you might want to look at Appleblock web tools half-step gearing designer.


Credits

Top
Calculator
This program began it's life for me as a fortran program I wrote in about 1975.
It has evolved and morphed over the years to Basic, C, perl/cgi, and Javascript versions.
Major influences over the years have been a BASIC program written in 1978 by my friend Richard Curtiss of Seattle,
and a C program posted on 17 Aug 1994 23:21:36 GMT on rec.bicycles.tech by speed@etecnw.com (Paul W. Laudon x7241 (sun)).
The program is now a client side javascript program. It was developed in 2004 because I lost my access to a server to run the perl/cgi program.
That loss turned out to be a good thing. This javascript version has evolved quite a bit with the addition of real graphics and is proving to be quite popular.
Thanks to JimG for the derailleur capacity code.
Thanks to Sheldon Brown for wheel diameter data and his gain ratio display method.
Thanks to www.walterzorn.com for the DHTML JavaScript VectorGraphics Library (seems to have been hijacked link farm)
And thanks very much to the many users who have made suggestions and reported bugs.


Calling the calculator with a set configuration

Top
Calculator
The major new feature of v4.2 is the ability to call the page with a gear configuration in the URL. This, combined with a bookmark button will allow the user to bookmark the page with all the parameters they had selected and recall the complete selection later.
It will also allow other web pages to open the calculator with a specific configuration.
Programming notes
Append the parameters to the url by adding a question mark (?) followed by the program parameters you want in the format NAME=VALUE.
   NAME=VALUE pairs must be separated by a "&" character.
   Only the sprockets listed in the URL will be displayed
   Any values, other than sprockets, not included in the URL will be set to the default values.
   Any spaces in the TITLE should be replaced with %20.
Example:

http://home.earthlink.net/~mike.sherman/shift.html?R0=30&R1=40&R2=50&C0=13&C1=15&C2=18&C3=21&C4=25&C5=30&CR=180&TITLE=Loaded%20from%20URL

Argument NAME
Description
Value
"R0"
Smallest or Single Chainring
integer
"R1"
Middle or Largest Chainring
integer
"R2"
Largest Chaingring (if there are 3)
integer
"C0"
Smallest Cassette or Freewheel Cog
integer
"C1"
Second Smallest Cog
integer
"C2" - "C9"
Freewheel or Cassette Cogs
integer
"C10"
Largest Cassette Cog on an 11 speed
integer
"CAS"
Index of selected Cassette
integer
"WI"
 
Wheel Index
sorry, this is messy
integer
 
"CR"
Crank Arm Length in mm
integer
"RT"
 
Rollout Display type
0 = Meters, 1 = inches ????
integer
 
"ST"
Speed Display type (0/1)
integer
"RPM"
RPM for "Speed at" table
integer
"SRT"
Units for "Speed at" table
integer
"lRPM"
Low RPM for Speed over RPM range display
integer
"hRMP"
High RPM for Speed over RPM range display
integer
"G"
 
Grid on/off for Speed over RPM range display
("show"/"hide")
string
 
"S"
 
Sort on/off for Speed over RPM range display
("yes"/"no")
string
 
"HL"
 
Enable mouseover highlighting
1=ON / 0=OFF
integer
 
"TITLE"
 
Page Title
Spaces must be replaced with "%20"
string
 


revision history

Top
Calculator
08/04/2004 created
08/11/2004 Added Cookies with save/recall/swap
Fixed direct data entry bug with < max # cogs or rings

 
Version 2.0
07/13/2005 - 03/08/2007 Derailleur capacity added by Jim G
Added 650B wheel sizes
Change some input areas to text areas (looks nicer)
gearTableLabel (rearcap, frontcap)
Added speed table

 
Version 3.0
04/15/2009 - 04/18/2009 Graphical log plot with Walter Zorn's DHTML JavaScript VectorGraphics Library
11 speed support, Campy 11 speed cassettes
Added DuraAce 10 speed cassettes
Center the ascii tables when not 11 speed Fixed bug in new centering - with 1 or 2 rings

 
Version 3.1
04/19/2009 - 05/05/2009 Split the original file up into 3 pieces
Put text areas inside div's so one html file can support both ASCII and vector graphic displays.
Change graph fonts to blue.
Added 29er wheels 1.95, 2.1, 2.2, more tubular widths
All tables drawn with vector graphics library
Some code cleanup, output functions last
Added error checking logic when incrementing/decrementing cog values
Added sachs 13-28, 6 sp and 13-32, 7 sp

 
Version 3.2
07/21/2009 check the RolloutType and SpeedType each time you draw the tables fixes a bug where display and radio buttons don't agree after a reload

 
Version 3.3
10/24/2009 - 01/07/2010 Added zinn crank lengths request from Greg M
130, 135, 140, 145, 150, 155, 160 and 190, 195, 200, 205, 210, 215, 220
Add 700x23 wheel size per user request

 
Version 4.0
02/01/2010 - 02/06/2010 Add rpm/speed range display
Fixed ghosted gear number labels on the top gear table
Auto scale the rpm/speed range table
Add some error handling on rpm range values
Switchable horizontal lines in rpm/speed range table
Fix errors in cassette numbering
Add labels to sorted and unsorted speed range displays
Sorted rpm/speed range display

 
Version 4.1
02/08/2010 - 03/24/2010 Resize canvas for rpm/speed
Add rpm range to cookie/save/load
Add spacing between label and rpm range chart
Make all color selections in the graphics functions variables.
- there was a private release of the code up to this point
Add zero checking to readRings() and readCogs() for when users enter

 
Version 4.2
11/17/2010 - 1/1/2011 Fix display 3.00 value on gain ratio tables
Fix bug displaying rollout > 10 meters
Add ability to read parameters from URL
Add credits page (this page)
Add setCrank() function
Add bookmark buttons - w & w/o the data
Add bookmark/url info to credits page
Add revision history to credits page.
Add IRD freewheels to selectCassette.js
Fix bug when typing in cogs or rings
Add same fix to a few other inputs
Fix typo on main page - Graphical

 
Version 4.3
02/23/2011 - 04/17/2011 Add 20x1.5 wheel size to javascript (36) 40-406 tire (20")
change bookmark to go to shift.html directly
Add SRAM X5 cassette to selectCassette.js & shift.html (11-34, 9-speed)
Clean up my internal documentation a bit.
load with recall and swap - always comes back sorted
sortgears is not and int - not read properly from cookie (as was showgrid)
sortgears = "yes" | "no" some places it was "on" | "off"
split shift.js (this file) into a bunch of smaller files for easier management
selectCassette.js renamed to shiftCassettes.js
recall fixed. was reading 'sort' and 'grid' from cookie w parse()= WRONG!
tighten up the display a bit (shift.html)
tighten up the display a bit more (shift.html) fix problem with testing if there is a cookie - swap/recall problems
fix a bunch of html issues (thanks to chrome)
update the links to the sources, moved to credits page

 Version 4.3.1
04/09/2011 - 05/19/2011 Move some functions around again.
Bug fix - add update to setRPM - now display will update
Bookmark set now reopens link with the arguments and posts an alert to save w Ctrl-D
Speed up bookmark load - was updating screen too often
Remove bookmark button (not the bookmarkSet button)
Work on bookmarkSet
Change default upper rpm to 100 (speed/rpm graph)
Fixed problems with setting rpms on speed/rpm graph fixed parseInt problem.
Same parseInt problem fixed in other areas of the code
Add 700x30 wheel size
Add selectedCassette() to the URL save
Add code to select the correct items in the pull down menus when loaded from URL. Now all picklists update from bookmarks
Changed the names of the functions from 'write' to 'update'
Add a small help section to this page
Move the speed table to the bottom
Fix so Check boxes get updated reading bookmarks

 Version 4.4
05/20/2011 - 05/26/2011 Updates to this page.
Add Help button on calculator page. Move bookmark button above the chart type selection
Add highlight to gear table gear on hover over cog control buttons
Add highlight to log and speed graphs
Add checkbox to enable/disable highlighting
Add highlighting to cog text boxes
Editing a cog directly removes selected cassette

 Version 4.4.1
06/06/2011 - 06/07/2011 Remove border from Derailer Capacity display and link to Sheldon.
Make all href's open on new page/tab
Do some formatting cleanup.

 Version 4.4.2
06/13/2011 - 07/01/2011 Code cleanup - standardize display I/O function names.
Add URL text box to main page.
Fix save/swap/recall with Chrome. Tested w FF4, FF5, Chrome, and IE7.

A more detailed change log can be found at the top of shift.js.


Source Code

Top
Calculator
If you'd like to download a local copy for your computer, you will need these files:

shift.html, mike_shift.css, shiftBookmarks.js, shiftCassettes.js, shiftCookies.js, shift_credits.html, shiftGearChart.js, shiftInputs.js, shift.js, shiftLogChart.js, shiftReadDisplay.js, shiftRollout.js, shiftSheldon.js, shiftSpeedChart.js, shiftSpeedTable.js, shiftUpdateDisplay.js, shiftWheels.js, and the www.walterzorn.com DHTML JavaScript VectorGraphics Library


Return to My Gear Calculator
Return to My bike page
Return to My main page