By Ryan Sandor Richards
Epoch is a general purpose charting library for application developers and visualization designers. It focuses on two different aspects of visualization programming: basic charts for creating historical reports, and real-time charts for displaying frequently updating timeseries data.
To get started using Epoch, please refer to the Epoch Project Site. There you can find full documentation and guides to help you start using Epoch right away.
Epoch can be easily installed via the following package managers:
Important: Epoch requires d3. In order to work properly your page must load d3 before epoch.
Public CDN URLs
If you don't want to host the files yourself, you can use jsDelivr to serve the files:
- Visit epoch page on jsDelvr.
- Copy the provided URL's and link to them in your project.
Developing Epoch is a reasonably straight forward process. In this section we'll cover the basic on how to develop Epoch by detailing common build task, exploring how the source is arranged, and finally show how to use rendering tests to aid development.
Configuring Development Environment
Epoch requires the following for development:
Once both are installed on your machine you will need to run
npm install from the repository's root directory in order to install the npm packages required to develop epoch.
Once you have installed the required npm packages you can use
gulp build to fully rebuild the source (see more information about gulp tasks below).
Basic Development Process
The best way to start contributing to Epoch is to follow these steps:
- Change to the source directory for the project
gulp watchto recompile the project after source files change
- Make changes in a source file (either in
- In a web browser open the
test/index.htmland browse the rendering tests
- Use the rendering tests to see if your changes had the desired result
- Ensure unit tests with pass
Epoch uses two types of testing to ensure that changes do not cause unintended side effects. The first, unit tests, ensure that the core functional components of the library work as expected. The second, rendering tests, allow you to ensure that charts and graphs are correctly rendered.
It is important to keep both unit test and rendering tests up-to-date! When developing, use the following guidelines:
- When adding new features make sure to add new tests
- When changing existing functionality, ensure that the appropriate both types of tests still pass
- If you want to make a new type of chart, add a whole new test suite for that chart!
Keeping the tests current makes it easier for others to review your code and spot issues. Also, pull requests without appropriate testing will not be merged.
Epoch uses gulp to perform various tasks. The
gulpfile.js file defines the following tasks:
gulp clean- Cleans the
gulp build- Builds the CoffeeScript and Sass source into the
gulp watch- Starts a watch script to recompile CoffeeScript and Sass when any files change.
The directory structure for the Epoch project follows some basic guidelines, here's an overview of how it is structured:
npm testand ensure all tests pass
npm version [major|minor|patch]
- Update CHANGELOG.md with the changes since last release
- Update the
gh-pagesbranch's library version in