Thank you for considering contributing to Trackplot! This guide will help you get started.
- Clone the repository
git clone https://github.com/eagerworks/trackplot.git
cd trackplot- Install dependencies
bundle install- Run the test suite
bundle exec rakeOr run tests directly:
ruby -Ilib -Itest -e "Dir['test/**/*_test.rb'].each { |f| require File.expand_path(f) }"- Run the dummy Rails app (for visual testing)
cd test/dummy
bin/rails serverThen open http://localhost:3000/charts in your browser.
We use Standard Ruby for code formatting:
bundle exec standardrbTo auto-fix violations:
bundle exec standardrb --fixlib/trackplot/
chart_builder.rb # Main DSL builder
sparkline_builder.rb # Sparkline mini-chart builder
data_adapter.rb # Normalizes input data
theme.rb # Theme presets and resolution
engine.rb # Rails engine setup
components/ # One file per chart/component type
base.rb, line.rb, bar.rb, area.rb, pie.rb, ...
app/
assets/javascripts/trackplot/
index.js # Complete JS engine (D3 rendering)
helpers/trackplot/
chart_helper.rb # View helpers
test/
trackplot/
chart_builder_test.rb # Ruby DSL tests
dummy/ # Rails dummy app for integration testing
- Open an issue at https://github.com/eagerworks/trackplot/issues
- Include: Ruby/Rails version, browser, minimal reproduction steps, expected vs actual behavior
- Fork the repository
- Create a feature branch (
git checkout -b feature/my-feature) - Make your changes
- Add tests for new functionality
- Run the full test suite (
bundle exec rake) - Run the linter (
bundle exec standardrb) - Commit with a descriptive message
- Push to your fork and open a Pull Request
- Follow Standard Ruby style
- Ruby components follow the existing pattern: inherit from
Components::Base, implementto_config - JS renderers follow the pattern:
renderXxx(g, data, ..., theme, chartElement)function - Keep the JS in a single
index.jsfile (no build step) - Test Ruby DSL output (config hashes), not HTML rendering
- Use
transform_keys(stdlib) instead ofsymbolize_keys(ActiveSupport) in gem code
- Create
lib/trackplot/components/my_chart.rbinheriting fromBase - Add autoload in
lib/trackplot.rb - Add DSL method in
chart_builder.rb - Add renderer function in
index.js - Register the type in
ALL_SERIES_TYPESconstant - Add tooltip support if applicable
- Add tests in
chart_builder_test.rb - Add demo in
test/dummy/app/views/charts/index.html.erb