
Security News
Astral Launches pyx: A Python-Native Package Registry
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
See an example on heroku (Example Source Code)
Chart ships with the following awesome charts:
chart
I was reading up on rails engine and decided to test out my new knowledge by making a gem. As my previous project involves making multiple charts, I understand the pain of having duplicate data structure and functions in javascript and ruby just for the different charts.
Chart is my solution to quickly add Javascript/HTML chart into rails. You can write coffeescript/javascript to further interact with the rendered chart. Chart is inspired by another awesome gem chartkick
The limitation of chart is that it generates in-line javascript and it does not aim to be a 100% wrapper for all chart.
Chart works with Sprockets and your asset pipeline.
Several flavours to choose from.
ChartJS (MIT License)
<%= bar :id_of_your_chart, size, data %>
<%= line :id, size, data %>
<%= pie :id, size, data %>
<%= radar :id, size, data %>
NVD3 (MIT License)
<%= boxplot :id, size, data %>
<%= discrete_bar :id, size, data %>
<%= horizontal_grouped_bar :id, size, data %>
Google Chart (Open Source)
<%= gBar :id, size, data %>
<%= gLine :id, size, data %>
<%= gPie :id, size, data %>
Highchart (Free for Personal usage but paid for Commercial)
<%= hBar %>
<%= hLine %>
<%= hPie %>
<%= hArea %>
Add this line to your application's Gemfile:
gem 'chart'
At Application.js, write //= require chart
after turbolinks. Only require the chart if you need them.
//= require turbolinks
//= require chart
//= require chart2 (not compatible with chart 1.1.1)
//= require nvd3
//= require google
//= require highcharts
At Application.css, write *= require nvd3
*= require_tree .
*= require nvd3
At your View
<%= pie :pie_chart, @pieSize, @pieData%>
At your Controller
@pieSize = {
:height => 500,
:width => 500
}
@pieData = [
{
value: 300,
color:"#F7464A",
highlight: "#FF5A5E",
label: "Red"
},
{
value: 50,
color: "#46BFBD",
highlight: "#5AD3D1",
label: "Green"
},
{
value: 100,
color: "#FDB45C",
highlight: "#FFC870",
label: "Yellow"
},
{
value: 40,
color: "#949FB1",
highlight: "#A8B3C5",
label: "Grey"
},
{
value: 120,
color: "#4D5360",
highlight: "#616774",
label: "Dark Grey"
}
].to_json
After checking out the repo, run bin/setup
to install dependencies. Then, run rake false
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/ytbryan/chart. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.
📮 Bryan Lim ytbryan@gmail.com
FAQs
Unknown package
We found that chart demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.