anychart_helpers 0.0.0.pre1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -3
- data/anychart_helpers.gemspec +2 -2
- data/lib/anychart_helpers.rb +2 -2
- data/lib/column_chart_multi_series_with_simple_legend.rb +58 -4
- metadata +3 -3
data/VERSION
CHANGED
data/anychart_helpers.gemspec
CHANGED
@@ -5,9 +5,9 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{anychart_helpers}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.1.0"
|
9
9
|
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new("
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["jduarte"]
|
12
12
|
s.date = %q{2010-02-17}
|
13
13
|
s.description = %q{AnyChart will build the necessary XML files and some helpers to support some AnyChart charts}
|
data/lib/anychart_helpers.rb
CHANGED
@@ -1,17 +1,71 @@
|
|
1
1
|
class ColumnChartMultiSeriesWithSimpleLegend
|
2
|
+
# USAGE: Options
|
3
|
+
# :animation => true by default ; Sets if chart has animation on load
|
4
|
+
# :tooltip => false by default ; Set the tooltip to use on chart element hover
|
5
|
+
# :title => false by default ; Set the title to show in the chart
|
6
|
+
@@default_xml_options = {
|
7
|
+
:animation => true,
|
8
|
+
:tooltip => "{%Name} - {%YValue}",
|
9
|
+
:title => false
|
10
|
+
}
|
11
|
+
|
2
12
|
def self.xml(options={})
|
3
13
|
require 'nokogiri'
|
4
14
|
|
15
|
+
p = @@default_xml_options.merge(options)
|
16
|
+
|
5
17
|
builder = Nokogiri::XML::Builder.new do |xml|
|
6
18
|
xml.anychart {
|
7
19
|
xml.settings {
|
8
|
-
|
20
|
+
if p[:animation]
|
21
|
+
xml.animation(:enabled => "True")
|
22
|
+
else
|
23
|
+
xml.animation(:enabled => "False")
|
24
|
+
end
|
9
25
|
}
|
10
26
|
xml.charts {
|
11
27
|
xml.chart(:plot_type => "CategorizedVertical") {
|
12
|
-
xml.data_plot_settings(:default_series_type => "Bar") {
|
13
|
-
|
14
|
-
|
28
|
+
xml.data_plot_settings(:default_series_type => "Bar") {
|
29
|
+
xml.bar_series(:point_padding => "0.2", :group_padding => "1") {
|
30
|
+
xml.tooltip_settings(:enabled => "True") {
|
31
|
+
xml.format "{%Name} - {%YValue}"
|
32
|
+
}
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
xml.chart_settings {
|
37
|
+
xml.title(:enabled => "True") {
|
38
|
+
xml.text "Title Here"
|
39
|
+
}
|
40
|
+
xml.legend(:enabled => "True", :position => "Right", :align => "Near") {
|
41
|
+
xml.format "{%Icon} {%Name} ({%Value})"
|
42
|
+
xml.template {}
|
43
|
+
xml.title(:enabled => "false") {}
|
44
|
+
xml.columns_separator(:enabled => "false") {}
|
45
|
+
xml.background {
|
46
|
+
xml.inside_margin(:left => "10", :right => "10") {}
|
47
|
+
}
|
48
|
+
}
|
49
|
+
xml.axes {
|
50
|
+
xml.y_axis {
|
51
|
+
xml.labels {
|
52
|
+
xml.format "{%Value}{numDecimals:0}"
|
53
|
+
}
|
54
|
+
}
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
xml.data {
|
59
|
+
# As varias series
|
60
|
+
[1].each do |serie|
|
61
|
+
xml.series(:name => "Nome Serie #{serie}") {
|
62
|
+
# Os varios pontos
|
63
|
+
[12,24,45,54,94].each do |point|
|
64
|
+
xml.point(:name => "Nome Ponto #{point}", :y => point.to_s)
|
65
|
+
end
|
66
|
+
}
|
67
|
+
end
|
68
|
+
}
|
15
69
|
}
|
16
70
|
}
|
17
71
|
}
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: anychart_helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jduarte
|
@@ -70,9 +70,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
70
70
|
version:
|
71
71
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: "0"
|
76
76
|
version:
|
77
77
|
requirements: []
|
78
78
|
|