{"id":16820336,"url":"https://github.com/dvandersluis/amcharts.rb","last_synced_at":"2025-03-22T03:31:38.133Z","repository":{"id":62553243,"uuid":"13522963","full_name":"dvandersluis/amcharts.rb","owner":"dvandersluis","description":"Ruby/Rails wrapper for Amcharts","archived":false,"fork":false,"pushed_at":"2017-05-09T16:07:05.000Z","size":3210,"stargazers_count":12,"open_issues_count":6,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-18T07:43:15.769Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dvandersluis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-10-12T14:24:40.000Z","updated_at":"2020-04-21T16:39:58.000Z","dependencies_parsed_at":"2022-11-03T04:30:24.961Z","dependency_job_id":null,"html_url":"https://github.com/dvandersluis/amcharts.rb","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvandersluis%2Famcharts.rb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvandersluis%2Famcharts.rb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvandersluis%2Famcharts.rb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dvandersluis%2Famcharts.rb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dvandersluis","download_url":"https://codeload.github.com/dvandersluis/amcharts.rb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244902929,"owners_count":20529114,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T10:56:18.478Z","updated_at":"2025-03-22T03:31:35.971Z","avatar_url":"https://github.com/dvandersluis.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AmCharts.rb [![Gem Version](https://badge.fury.io/rb/amcharts.rb.svg)](http://badge.fury.io/rb/amcharts.rb) [![Build Status](https://travis-ci.org/dvandersluis/amcharts.rb.svg?branch=master)](https://travis-ci.org/dvandersluis/amcharts.rb)\n\nRuby on Rails wrapper for creating AmCharts charts.\n\n## Usage\n\nA chart is represented by a subclass of `AmCharts::Chart` (ie. `Pie` or `Serial`), which is initialized with a data collection (should be an array\nof homogeneous hashes), and some settings passed into a block:\n\n    chart = AmCharts::Chart::Serial.new(data) do |c|\n      add_title 'My Fancy Chart', size: 18\n      loading_indicator!\n\n      c.dimensions = '800x600'\n\n      legends.new do |l|\n        l.position = 'right'\n        l.value_text = '[[percents]]%'\n      end\n\n      scrollbar {}\n    end\n\nThe setup block accepts a number of methods for ease of setting up a chart, and accepts any other assignment method as a setting\nthat will be passed directly to AmCharts when the chart is rendered. Chart components including graphs, legends, axes, scrollbars and\ncursors can also be added and configured using inner blocks. Listeners can also be defined in a similar manner.\n\nValues in the setup block can be numeric or string literals (which will be passed along as is); symbols (which will be\ngiven to `I18n.t` before being rendered); procs (which will be executed); or the `function()` method (which will act as\na literal javascript function).\n\nAn `AmCharts::Chart` object can then be rendered using the `amcharts` helper:\n\n    amcharts(chart, 'id-of-container')\n\nIf the container ID given doesn't already exist in the page, it will be automatically created before the chart is rendered\nby AmCharts.\n\n### Chart setup methods\n* `add_title(text, options: {})`: Adds a title element to the chart. `options` can be used to specify `size`, `bold` (`true`\nor `false`), `alpha` (`0..1`), and/or `color` (a hex color code).\n* `loading_indicator!`: Displays a loading indicator over the chart until it has completed rendering. The indicator makes use of\nan I18n key (`chart_data_loading`) and an image (`amcharts/loading.gif`) which both can be customized within your application.\n* `detach_legend(div: true)`: Makes the legend (if present) render in a separate div. `div` can either be `true` (which will\ncause the legend div to be given an ID the same as the main div, with a \"_legend\" suffix), or the ID you want to give the div.\n* `dimensions=('widthxheight')`: Allows width and height to be specified in one line\n\n### Defining a chart\n* Serial charts need to have their `graphs` defined on setup (this also allows multiple graphs to be defined; ie. for a multi-line chart).\nGraphs are initialized with `(name, type)`, where `type` is a [type of graph](http://docs.amcharts.com/javascriptcharts/AmGraph#type)\nthat AmCharts is aware of (`:column`, `:line`, `:step`, etc.)\n\n        AmCharts::Chart::Serial.new(data) do\n          [:col1, :col2, :col3].each do |column|\n          graphs.new(column, :smoothedLine) do |g|\n            g.title = column\n          end\n        end\n\n* Pie charts do not use `graphs`, as they get their values directly from the given data set.\n\n### Note about the Version Number\nThe version number correlates to the version of AmCharts that is included (ie. 3.1.1.0 is the first release of\namcharts.rb which uses AmCharts v3.1.1)\n\n## Using a Commercial AmCharts license\n\nIf you have purchased the commercial version of AmCharts, place the amcharts.js file it comes with inside a\n`javascripts/amcharts` directory within `(app|lib|vendor)/assets`, so that it will be used instead of the free\nversion that is included in this gem.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n    gem 'amcharts.rb'\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install amcharts.rb\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n\n## Acknowledgments\n\n* Built upon the excellent [AmCharts Javascript V3](http://www.amcharts.com/javascript-charts/) charting package.\n* Special thanks to [TalentNest](http://github.com/talentnest), who sponsored this gem's development.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdvandersluis%2Famcharts.rb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdvandersluis%2Famcharts.rb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdvandersluis%2Famcharts.rb/lists"}