Guide to making dygraphs changes

So you've made a change to dygraphs and would like to contribute it back to the open source project. Wonderful!

This is a step-by-step guide explaining how to do it.

dygraphs style

First of all, please try to follow the style of the existing dygraphs code. This will make the review process go much more smoothly.

A few salient points:

  1. We try to adhere to Google's JS style guide and would appreciate it if you try to as well. This means:
    • No tabs! Indent using two spaces.
    • Use camelCase for variable and function names.
    • Limit lines to 80 characters.
  2. Please run '' to see if you've introduced any new violations.
  3. If you've added a new feature, add a test for it (in the tests/ directory) or a gallery entry.
  4. If you've added an option, document it in dygraph-options-reference.js. You'll get lots of warnings if you don't.
  5. If you've fixed a bug or added a feature, add an auto_test for it.
    This ensures that we won't inadvertently break your feature in the future. To do this, either add to an existing auto_test in auto_tests/tests or run auto_tests/misc/ your-test-name to create a new one. There are two easy ways to run tests:
    • You can run your auto_test in any browser by visiting auto_tests/misc/local.html. This allows you to debug your test, or test against a specific browser.
    • You can run your auto_test on the command-line by running ./ (It requires installing phantomjs on your computer.)

Sending a Pull Request

dygraphs is hosted on github, which uses a "pull request" model. They have a good writeup here. These instructions discuss dygraphs more specifically.

The list of steps may look a bit daunting, but it's not too bad, especially if you have any familiarity with git or github. If you run into any problems while following the instructions, feel free to contact dygraphs-users.

Why not just take patches? This process means less work for me (the maintainer) and it also results in your name appearing in the list of dygraphs commits. This lets you take credit for your work.

  1. Create an account on github. This is free, painless and will let you claim credit for your changes.
  2. Install git. github has a good writeup here.
  3. Create a fork of the dygraphs repository on github by clicking this link and then the "Fork" button.
  4. You should see a URL along the lines of
    Copy this, open up a terminal and run
    git clone
    This pulls the dygraphs code down onto your local disk.
  5. cd into the dygraphs directory and make your changes.
    If you've already got them somewhere else, just copy them over.
  6. Be a good citizen! Make sure your code follows the guidelines above.
    You'll have to do this before we accept your changes, so you may as well do it now
  7. Commit your changes locally: run
    git add .
    git commit
    Type in a description of your change. This will eventually appear in the dygraphs commit list.
  8. Push your changes to github by running
    git push
    This will send your changes to your forked repository on github.
  9. Go to your fork of dygraphs on github (i.e.
    Click the "Pull Request" button.
    This will send me an email with a pointer to your changes.
  10. We'll review your changes and (unless your code is perfect!) give you some feedback. Make these suggested changes in your local git client and re-run "git commit" and "git push" so that we can see them.
  11. Once your change is ready, we'll pull it into the main dygraphs repository and publish it to the web.