Socket
Book a DemoInstallSign in
Socket

chartx

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chartx

1.0.0
bundlerRubygems
Version published
Maintainers
1
Created
Source

Chartx

Chartx is a Ruby gem helps you to develop fancy interactive data visualizations with one line of Ruby code!:) It's a ruby wrapper of nvd3, which is an attempt to build re-usable charts and chart components for d3.js without taking away the power that d3.js gives you.

Installation

To include Chartx into your rails project, add this line to your application's Gemfile:

gem 'chartx'

And then execute:

$ bundle install

To add the necessary javascript files into your asset pipeline add

//= require chartx-core
//= require chartx-model

in app/assets/javascripts/application.js

If you only need a subset of models e.g. lineChart you can add

//= require nvd3/lib/d3.v2
//= require nvd3/src/core
//= require nvd3/src/tooltip
//= require nvd3/src/utils.js
//= require nvd3/src/models/lineChart
//= require nvd3/src/models/legend.js
//= require nvd3/src/models/axis.js
//= require nvd3/src/models/scatter.js
//= require nvd3/src/models/line.js

to your application.js. All the models can be found in https://github.com/xianhengma/nvd3/tree/chartx-branch/src/models

Examples

Pie Chart:

<%= pie_chart @pie_data %>

ScreenShot

Line Chart:

<%= line_chart @line_data %>

ScreenShot

Discrete Bar Chart:

<%= discrete_bar_chart @discrete_bar_data %>

ScreenShot

Line Chart with Focus (View Finder):

<%= line_with_focus_chart @line_with_focus_data %>

ScreenShot

Scatter Chart:

<%= scatter_chart @scatter_data %>

ScreenShot

Bullet Chart:

<%= bullet_chart @bullet_data %>

ScreenShot

Stacked Area Bar Chart:

<%= stacked_area_chart @stacked_area_data %>

ScreenShot

ScreenShot

Multi Bar Chart:

<%= multi_bar_chart @multi_bar_data %>

ScreenShot

Multi Horizontal Bar Chart:

<%= multi_bar_horizontal_chart @multi_bar_horizontal_data %>

ScreenShot

Data Format

Data for Chartx (except Pie Chart) are in the following format:

@data = [
	{
		:key => "<Series name>",
		:color => "<CSS color>"
		:values => [
			{:label => 0, :value => 10},
			{:label => 1, :value => 20},
			{:label => 2, :value => 30}
			....
		]
	},
	{
		key: "<Series name>"
		...
	}
]

Data for Pie Chart is in the following format:

@data = [
	{
		:label => "<name1>",
		:value => 31
	},
	{
		:label => "<name2>",
		:value => 31

	},
	{
		...
	}
		
]

Contributing

  • Fork it
  • Create your feature branch (git checkout -b my-new-feature)
  • Commit your changes (git commit -am 'Add some feature')
  • Push to the branch (git push origin my-new-feature)
  • Create new Pull Request

FAQs

Package last updated on 18 Jul 2013

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.