sleek_charts 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 96591a675128e0833a659ab5075c1b28a46ac46d
4
- data.tar.gz: 90e1a4e61d6b4b5ad68821d227024a23e7d4acbf
3
+ metadata.gz: 56c911ae5c2a47cd89b40898c520aee39c70a3f1
4
+ data.tar.gz: 9e29110b452d946e469cdf2d9b84208bd8260702
5
5
  SHA512:
6
- metadata.gz: 66e7bfb99aa289408b6a2cc4f1140c4bfacb89da0c1ba12c02e4a6c1638e6cadd981134af83eb51bce5dc2bcad857b571d6908316e938fdec02cd3752a2fc9d1
7
- data.tar.gz: b06309042fb88b55c8bbddfc656ae96fd54deeed1d2b87c9c76128d21f0582c5a6ab2dc665132abebd97a6ec12458927316d499db07281fd8109c4035f6057b6
6
+ metadata.gz: d194157ff6349e2c7a415105ec791871176fddc7bc0bba1b3ac33bd73d7441c59559b8bd1cafee38617e71e9f6e454e5e9eeac250508b7104e2dd1f939bc515f
7
+ data.tar.gz: 0bb71c5e0253faaa41eb7b7e514faa886406872087142baa08c8a67fa4268494d323763179147095216f43c3bade83a3ab17472b0f9829f66e34c39a92baffcd
@@ -1,2 +1,5 @@
1
+ ### 0.0.3
2
+ - legends are optional for donut chart
3
+
1
4
  ### 0.0.1 & 0.0.2
2
5
  - First and second minor releases with refactoring
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # SleekCharts
2
+ [![Gem Version](https://badge.fury.io/rb/sleek_charts.png)](http://badge.fury.io/rb/sleek_charts) [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/gouravtiwari/sleek_charts/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
2
3
 
3
4
  Provides Bar and Donut charts with consitent tooltip for Rails applications.
5
+ This gem uses [d3](http://d3js.org) and [d3-tip](https://github.com/Caged/d3-tip) libraries.
4
6
 
5
7
  ## Supports Rails 3.1+
6
8
 
@@ -56,3 +58,5 @@ or add donut chart to any element, e.g.
56
58
  3. Commit your changes (`git commit -am 'Add some feature'`)
57
59
  4. Push to the branch (`git push origin my-new-feature`)
58
60
  5. Create new Pull Request
61
+
62
+
@@ -17,6 +17,7 @@
17
17
  // tipValue: tipValue, for each bar, default is 'value'
18
18
  // tipText: tipText which you want to display with 'label' and 'value', default is ''
19
19
  // totalLabel: totalLabel to add a label for sum e.g. ' Views'
20
+ // legend: default set to true to show legends
20
21
 
21
22
  function mergeConfigOptions(defaults,options){
22
23
  var mergedConfig = {};
@@ -41,7 +42,8 @@ function donutTip(options){
41
42
  tipLabel: '',
42
43
  tipValue: 'value',
43
44
  tipText: '',
44
- totalLabel: ''
45
+ totalLabel: '',
46
+ legend: true
45
47
  };
46
48
 
47
49
  var config = (options) ? mergeConfigOptions(defaults,options) : defaults;
@@ -132,30 +134,31 @@ function donutTip(options){
132
134
  return config.color(i);
133
135
  }) //set the color for each slice to be chosen from the color function defined above
134
136
  .attr("d", arc); //this creates the actual SVG path using the associated data (pie) with the arc drawing function
135
-
136
- var legend = d3.select(config.selector).append("svg")
137
- .attr("class", "legend")
138
- .attr("width", config.outerRadius)
139
- .attr("height", config.outerRadius * 2)
140
- .selectAll("g")
141
- .data(data)
142
- .enter().append("g")
143
- .attr("transform", function (d, i) {
144
- return "translate(0," + i * 20 + ")";
145
- });
146
-
147
- legend.append("rect")
148
- .attr("width", 18)
149
- .attr("height", 18)
150
- .style("fill", function (d, i) {
151
- return config.color(i);
152
- });
153
-
154
- legend.append("text")
155
- .attr("x", 24)
156
- .attr("y", 9)
157
- .attr("dy", ".35em")
158
- .text(function (d) {
159
- return d[config.xDomain];
137
+ if(config.legend){
138
+ var legend = d3.select(config.selector).append("svg")
139
+ .attr("class", "legend")
140
+ .attr("width", config.outerRadius)
141
+ .attr("height", config.outerRadius * 2)
142
+ .selectAll("g")
143
+ .data(data)
144
+ .enter().append("g")
145
+ .attr("transform", function (d, i) {
146
+ return "translate(0," + i * 20 + ")";
147
+ });
148
+
149
+ legend.append("rect")
150
+ .attr("width", 18)
151
+ .attr("height", 18)
152
+ .style("fill", function (d, i) {
153
+ return config.color(i);
154
+ });
155
+
156
+ legend.append("text")
157
+ .attr("x", 24)
158
+ .attr("y", 9)
159
+ .attr("dy", ".35em")
160
+ .text(function (d) {
161
+ return d[config.xDomain];
160
162
  });
163
+ }
161
164
  }
Binary file
Binary file
@@ -1,3 +1,3 @@
1
1
  module SleekCharts
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sleek_charts
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gourav Tiwari
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-08 00:00:00.000000000 Z
11
+ date: 2014-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler