metrics-graphics-rails 2.1.3 → 2.1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -4
- data/lib/metrics-graphics-rails/version.rb +1 -1
- data/lib/metrics-graphics-rails/view_helpers.rb +2 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8da0bab8c6ef3a6995f28b59c711085d295741e8
|
4
|
+
data.tar.gz: 8a9b0a6531af1e55ef1c4ded1c31e6be9c9bcf68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69e9bd0bd03c253f248c00096fe726b24a573e50010f5c9c38e5241f8fbd2ddda617565a6fe2d6cb2934d6e7a42d04d316948e60560694319de75c69ecbe0053
|
7
|
+
data.tar.gz: 5869bacda9651c885b05a5661b71dbd1f81f640fb31ce0acadae5b6efb4227b2973a5b613643723c761166c78992224b4ff24920a4f07d9a502f21089d1518bc
|
data/README.md
CHANGED
@@ -9,7 +9,7 @@ The **metrics-graphics-rails** provides metrics-graphics for Rails and the asset
|
|
9
9
|
|
10
10
|
Add this gem to your Gemfile:
|
11
11
|
|
12
|
-
gem 'metrics-graphics-rails'
|
12
|
+
gem 'metrics-graphics-rails'
|
13
13
|
|
14
14
|
Add the following directive to your Javascript manifest file (application.js), after the `//= require jquery`:
|
15
15
|
|
@@ -40,14 +40,16 @@ From the [metrics-graphics example](http://metricsgraphicsjs.org/):
|
|
40
40
|
height: 250,
|
41
41
|
target: '#downloads',
|
42
42
|
x_accessor: 'date',
|
43
|
-
y_accessor: 'value'
|
43
|
+
y_accessor: 'value'
|
44
44
|
})
|
45
45
|
|
46
46
|
This graph can be rendered in a Rails view template with this helper:
|
47
47
|
|
48
|
-
= metrics_graphic_for data, title: "Downloads", description: "This graphic shows a time-series of downloads.", width: 600, height: 250, target: '#downloads', x_accessor: 'date', y_accessor: 'value'
|
48
|
+
= metrics_graphic_for data, title: "Downloads", description: "This graphic shows a time-series of downloads.", width: 600, height: 250, target: '#downloads', x_accessor: 'date', y_accessor: 'value', time_format: '%Y-%m-%d'
|
49
49
|
|
50
|
-
where ``data`` is an Array of Hashes of points with a ``date`` and a ``value`` keys and values. Ex: ``[{date: '2014-11-01', value: 12}, date: '2014-11-02', value: 18}]``
|
50
|
+
where ``data`` is an Array of Hashes of points with a ``date`` and a ``value`` keys and values. Ex: ``[{date: '2014-11-01', value: 12}, {date: '2014-11-02', value: 18}]``
|
51
|
+
|
52
|
+
`width`, `height`, `time_format` and `description` are optional options.
|
51
53
|
|
52
54
|
## Versioning
|
53
55
|
|
@@ -12,11 +12,12 @@ module MetricsGraphicsRails
|
|
12
12
|
description = options.fetch(:description) { '' }
|
13
13
|
width = options.fetch(:width) { 600 }
|
14
14
|
height = options.fetch(:height) { 250 }
|
15
|
+
time_format = options.fetch(:time_format) { '%Y-%m-%d' }
|
15
16
|
|
16
17
|
javascript_tag <<-SCRIPT
|
17
18
|
var data = #{json_data};
|
18
19
|
|
19
|
-
MG.convert.date(data, 'date', '
|
20
|
+
MG.convert.date(data, 'date', '#{time_format}');
|
20
21
|
|
21
22
|
MG.data_graphic({
|
22
23
|
title: "#{title}",
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metrics-graphics-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.3
|
4
|
+
version: 2.1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Gil
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
@@ -78,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
78
78
|
version: '0'
|
79
79
|
requirements: []
|
80
80
|
rubyforge_project:
|
81
|
-
rubygems_version: 2.2.
|
81
|
+
rubygems_version: 2.2.2
|
82
82
|
signing_key:
|
83
83
|
specification_version: 4
|
84
84
|
summary: metrics-graphics-rails is an assets gem for metrics-graphics
|