ambling 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/MIT-LICENSE +20 -0
- data/README +188 -0
- data/Rakefile +24 -0
- data/ambling.gemspec +24 -0
- data/init.rb +4 -0
- data/lib/ambling.rb +10 -0
- data/lib/ambling/base.rb +69 -0
- data/lib/ambling/column.rb +1332 -0
- data/lib/ambling/data.rb +255 -0
- data/lib/ambling/line.rb +1822 -0
- data/lib/ambling/pie.rb +830 -0
- data/lib/ambling/railtie.rb +12 -0
- data/lib/ambling/stock.rb +1964 -0
- data/lib/ambling/utils.rb +120 -0
- data/lib/ambling/version.rb +3 -0
- data/lib/ambling/xy.rb +1511 -0
- data/lib/ambling_helper.rb +83 -0
- data/test/base_test.rb +54 -0
- data/test/data_test.rb +82 -0
- data/test/generator_test.rb +98 -0
- data/test/test_helper.rb +7 -0
- data/test/xmls/advanced_chart_data.xml +13 -0
- data/test/xmls/advanced_settings.xml +51 -0
- data/test/xmls/amcolumn_settings.xml +328 -0
- data/test/xmls/amline_settings.xml +402 -0
- data/test/xmls/ampie_settings.xml +195 -0
- data/test/xmls/amxy_settings.xml +335 -0
- data/test/xmls/simple.xml +17 -0
- data/test/xmls/simple_chart_data.xml +15 -0
- data/test/xmls/simple_pie_data.xml +5 -0
- data/test/xmls/simple_xy_data.xml +8 -0
- metadata +79 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2008 Andrew Hobson
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sub license, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NON INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
|
data/README
ADDED
@@ -0,0 +1,188 @@
|
|
1
|
+
#
|
2
|
+
# Ambling is a rails plugin makes it easy to generate XML needed by the wonderfully slick
|
3
|
+
# Amcharts[http://www.amcharts.com/].
|
4
|
+
#
|
5
|
+
# Amcharts has two kinds of XML: the data xml and the settings xml. Ambling can help with both.
|
6
|
+
#
|
7
|
+
# To install, do the usual rails incancation:
|
8
|
+
# ruby script/plugin install svn://rubyforge.org//var/svn/ambling/trunk
|
9
|
+
#
|
10
|
+
# Ambling expects amcharts to be installed under public/amcharts. Put the
|
11
|
+
# licence key (if any), swf files, fonts and plugins directories under here
|
12
|
+
#
|
13
|
+
#
|
14
|
+
# Amcharts uses swfobject.js, so put that in public/javascripts and include it
|
15
|
+
# in your layout. It does not work with swfobject version 2.x so you'll need
|
16
|
+
# to find swfobject 1.x
|
17
|
+
#
|
18
|
+
# Ambling uses expressinstall.swf by default, so put that in public/amcharts.
|
19
|
+
#
|
20
|
+
#
|
21
|
+
#
|
22
|
+
# Ambling is also now on github: http://github.com/ahobson/ambling/tree/master
|
23
|
+
#
|
24
|
+
# Examples:
|
25
|
+
#
|
26
|
+
# In your controller, generate the data xml for a pie chart
|
27
|
+
# def pie_data
|
28
|
+
# chart = Ambling::Data::Pie.new
|
29
|
+
# FavoriteColor.count(:color, :group => :color).each do |data|
|
30
|
+
# chart.slices << Ambling::Data::Slice.new(data.last, :title => data.first,
|
31
|
+
# :url => favorite_colors_path(:color => data.first))
|
32
|
+
# end
|
33
|
+
# render :xml => chart.to_xml
|
34
|
+
# end
|
35
|
+
#
|
36
|
+
# In your view, embed the flash and customize the settings
|
37
|
+
#
|
38
|
+
# <%=
|
39
|
+
# ambling_chart(:pie, :data_file => url_for(:action => 'pie_data', :escape => false),
|
40
|
+
# :id => 'pie_data', :width => 290, :height => 200,
|
41
|
+
# :chart_settings => Ambling::Pie::Settings.new({
|
42
|
+
# :pie => {
|
43
|
+
# :x => 110,
|
44
|
+
# :y => 110,
|
45
|
+
# :radius => 80,
|
46
|
+
# :colors => '#B40000,#F7941D,#0265AC',
|
47
|
+
# :outline_color => '#000000',
|
48
|
+
# :outline_alpha => 50,
|
49
|
+
# },
|
50
|
+
# :animation => {
|
51
|
+
# :pull_out_on_click => false,
|
52
|
+
# },
|
53
|
+
# :data_labels => {
|
54
|
+
# :show => cdata_section("<b>{value}</b>"), :radius => -30,
|
55
|
+
# },
|
56
|
+
# :legend => {
|
57
|
+
# :enabled => true, :x => 195, :y => 20, :width => 100, :text_color => '#000',
|
58
|
+
# :max_columns => 1, :spacing => 2, :text_size => 10,
|
59
|
+
# :key => {:size => 10}
|
60
|
+
# },
|
61
|
+
# :labels => {
|
62
|
+
# :label =>
|
63
|
+
# {:x => 40, :y => 5, :text => cdata_section("<b>Favorite Colors</b>"),
|
64
|
+
# :text_size => 16, :text_color => '#0265AC'},
|
65
|
+
# }
|
66
|
+
# }).to_xml) do
|
67
|
+
# content_tag('p', "To see this page properly, you need to upgrade your Flash Player")
|
68
|
+
# end
|
69
|
+
# %>
|
70
|
+
#
|
71
|
+
# How about a combo bar and line graph?
|
72
|
+
#
|
73
|
+
# In your controller:
|
74
|
+
# def graph_data
|
75
|
+
# avg_attendence = Movies.find_average_attendence_last_thirty_days
|
76
|
+
# colors = %w{#B40000 #F7941D #0265AC #DF5858 #FFC580 #6FAFF3 #5AAB6D #E99393 #9DCFA9 #A4CBF3}
|
77
|
+
# chart = Ambling::Data::ColumnChart.new
|
78
|
+
# chart.graphs << Ambling::Data::LineGraph.new([], :title => "Average Attendence", :color => '#000000')
|
79
|
+
# avg_attendence.each do |day,avg_attendence|
|
80
|
+
# chart.series << Ambling::Data::Value.new(day.to_s(:pretty_day), :xid => day.to_i)
|
81
|
+
# chart.graphs.last << Ambling::Data::Value.new(avg_attendence, :xid => day.to_i)
|
82
|
+
# end
|
83
|
+
# all_movie_names = Movies.find_movie_names
|
84
|
+
# all_movie_names.each_with_index do |movie_name, i|
|
85
|
+
# chart.graphs << Ambling::Data::ColumnGraph.new([], :title => movie_name, :color => colors[i])
|
86
|
+
# movie_attendence = Movies.find_attendence_by_name(movie_name)
|
87
|
+
# movie_attendence.each do |day, attendence|
|
88
|
+
# chart.graphs.last << Ambling::Data::Value.new(attendence, :xid => day.to_i)
|
89
|
+
# end
|
90
|
+
# end
|
91
|
+
#
|
92
|
+
# render :xml => chart.to_xml
|
93
|
+
# end
|
94
|
+
#
|
95
|
+
# In your view:
|
96
|
+
#
|
97
|
+
# <%=
|
98
|
+
# ambling_chart(:column, :data_file => url_for(:action => 'graph_data', :escape => false),
|
99
|
+
# :id => "graph_data", :width => 900, :height => 250,
|
100
|
+
# :chart_settings => Ambling::Column::Settings.new({
|
101
|
+
# :column => {
|
102
|
+
# :type => "stacked", :width => 90, :spacing => 5,
|
103
|
+
# :balloon_text => "{value} people attended the movie {title} on {series}"
|
104
|
+
# },
|
105
|
+
# :grid => {
|
106
|
+
# :category => {:alpha => 0}, :value => {:alpha => 10}
|
107
|
+
# },
|
108
|
+
# :values => {
|
109
|
+
# :category => {:enabled => true, :frequency => 3}
|
110
|
+
# },
|
111
|
+
# :plot_area => {
|
112
|
+
# :margins => {:left => 30, :top => 40, :right => 100, :bottom => 40}
|
113
|
+
# },
|
114
|
+
# :legend => {
|
115
|
+
# :enabled => true, :x => 805, :y => 20, :width => 100, :text_color => '#000',
|
116
|
+
# :max_columns => 1, :spacing => 2, :text_size => 10,
|
117
|
+
# :key => {:size => 10}
|
118
|
+
# },
|
119
|
+
# :labels => {
|
120
|
+
# :label => [
|
121
|
+
# {:x => 350, :y => 5, :text => cdata_section("<b>Movie Attendence</b>"),
|
122
|
+
# :text_size => 16, :text_color => '#0265AC'}
|
123
|
+
# ]
|
124
|
+
# },
|
125
|
+
# :graphs => {
|
126
|
+
# :graph => [
|
127
|
+
# {:type => 'line', :gid => 1, :width => 3}
|
128
|
+
# ]
|
129
|
+
# }
|
130
|
+
# }).to_xml) do
|
131
|
+
# content_tag('p', "To see this page properly, you need to upgrade your Flash Player")
|
132
|
+
# end
|
133
|
+
# %>
|
134
|
+
#
|
135
|
+
# Here's a column example.
|
136
|
+
#
|
137
|
+
# In your controller:
|
138
|
+
#
|
139
|
+
# def column_data
|
140
|
+
# colors = %w{#B40000 #F7941D #0265AC}
|
141
|
+
# chart = Ambling::Data::ColumnChart.new
|
142
|
+
# chart.series << Ambling::Data::Value.new(1, :xid => 1)
|
143
|
+
# [["Chocolate", 55], ["Ice Cream", 34], ["Cookies", 22]].each_with_index do |kv, i|
|
144
|
+
# chart.graphs << Ambling::Data::ColumnGraph.new([], :gid => i, :title => kv.first, :color => color[i])
|
145
|
+
# chart.graphs.last << Ambling::Data::Value.new(kv.last, {:xid => 1})
|
146
|
+
# end
|
147
|
+
# render :xml => chart.to_xml
|
148
|
+
# end
|
149
|
+
#
|
150
|
+
# In your view:
|
151
|
+
#
|
152
|
+
# <%=
|
153
|
+
# ambling_chart(:column, :data_file => url_for(:action => 'column_data', :escape => false),
|
154
|
+
# :id => 'column_data', :width => 290, :height => 200,
|
155
|
+
# :chart_settings => Ambling::Column::Settings.new({
|
156
|
+
# :column => {
|
157
|
+
# :type => "bar", :width => 97, :spacing => 0,
|
158
|
+
# :balloon_text => cdata_section("{value} people bought {title}")
|
159
|
+
# },
|
160
|
+
# :grid => {
|
161
|
+
# :category => {:alpha => 0}, :value => {:alpha => 10}
|
162
|
+
# },
|
163
|
+
# :values => {
|
164
|
+
# :category => {:enabled => false}
|
165
|
+
# },
|
166
|
+
# :plot_area => {
|
167
|
+
# :margins => {:left => 40, :top => 40, :right => 100, :bottom => 40}
|
168
|
+
# },
|
169
|
+
# :legend => {
|
170
|
+
# :enabled => true, :x => 195, :y => 20, :width => 100, :text_color => '#000',
|
171
|
+
# :max_columns => 1, :spacing => 1, :text_size => 10,
|
172
|
+
# :key => {:size => 10}
|
173
|
+
# },
|
174
|
+
# :labels => {
|
175
|
+
# :label => [
|
176
|
+
# {:x => 20, :y => 5, :text => cdata_section("<b>Dessert</b>"),
|
177
|
+
# :text_size => 16, :text_color => '#0265AC'},
|
178
|
+
# {:x => 30, :y => 170, :text => "Sweet Sales", :align => "center", :width => 180,
|
179
|
+
# :text_size => 12}
|
180
|
+
# ]
|
181
|
+
# }
|
182
|
+
# }).to_xml) do
|
183
|
+
# content_tag('p', "To see this page properly, you need to upgrade your Flash Player")
|
184
|
+
# end
|
185
|
+
# %>
|
186
|
+
|
187
|
+
# Thanks to the ziya plugin for inspiration
|
188
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'rake/testtask'
|
2
|
+
|
3
|
+
task :doc do
|
4
|
+
sh "rdoc -S -m README init.rb lib README"
|
5
|
+
end
|
6
|
+
|
7
|
+
task :rubyforge => [:doc] do
|
8
|
+
sh "rsync -Car doc/* rubyforge.org:/var/www/gforge-projects/ambling"
|
9
|
+
end
|
10
|
+
|
11
|
+
|
12
|
+
Rake::TestTask.new(:non_generate_tests) do |t|
|
13
|
+
t.test_files = FileList['test/*_test.rb'].exclude("test/generator_test.rb")
|
14
|
+
t.verbose = true
|
15
|
+
end
|
16
|
+
|
17
|
+
# The generate tests need to be run separately because they define
|
18
|
+
# classes used in the other tests
|
19
|
+
Rake::TestTask.new(:generate_tests) do |t|
|
20
|
+
t.test_files = FileList['test/generator_test.rb']
|
21
|
+
t.verbose = true
|
22
|
+
end
|
23
|
+
|
24
|
+
task :test => [:generate_tests, :non_generate_tests]
|
data/ambling.gemspec
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "ambling/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "ambling"
|
7
|
+
s.version = Ambling::VERSION
|
8
|
+
s.authors = ["Daniel Vandersluis"]
|
9
|
+
s.email = ["daniel@codexed.com"]
|
10
|
+
s.homepage = "https://github.com/dvandersluis/ambling"
|
11
|
+
s.summary = %q{Makes generating XML for amcharts through Rails easy.}
|
12
|
+
s.description = %q{Ambling is a rails plugin makes it easy to generate XML needed by the wonderfully slick Amcharts (http://www.amcharts.com/).}
|
13
|
+
|
14
|
+
s.rubyforge_project = "ambling"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
# specify any dependencies here; for example:
|
22
|
+
# s.add_development_dependency "rspec"
|
23
|
+
# s.add_runtime_dependency "rest-client"
|
24
|
+
end
|
data/init.rb
ADDED
data/lib/ambling.rb
ADDED
data/lib/ambling/base.rb
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
# Base module for settings
|
2
|
+
require 'active_support'
|
3
|
+
require 'active_support/builder' unless defined?(Builder)
|
4
|
+
|
5
|
+
module Ambling #:nodoc
|
6
|
+
# debugging
|
7
|
+
# class BaseLogger
|
8
|
+
# cattr_accessor :logger, :instance_writer => false
|
9
|
+
# end
|
10
|
+
|
11
|
+
#
|
12
|
+
# All settings classses include these base functions that populate
|
13
|
+
# the data from a hash and generate the xml
|
14
|
+
#
|
15
|
+
module Base
|
16
|
+
def initialize(hash = {})
|
17
|
+
populate(hash)
|
18
|
+
end
|
19
|
+
|
20
|
+
#
|
21
|
+
# populate the settings with data from the hash
|
22
|
+
#
|
23
|
+
def populate(hash = {})
|
24
|
+
hash.each do |k,v|
|
25
|
+
val = if v.is_a?(Hash)
|
26
|
+
klass = self.class.const_get(k.to_s.camelize)
|
27
|
+
klass.new(v)
|
28
|
+
elsif v.is_a?(Array)
|
29
|
+
klass = self.class.const_get(k.to_s.camelize)
|
30
|
+
v.collect {|i| klass.new(i)}
|
31
|
+
else
|
32
|
+
v
|
33
|
+
end
|
34
|
+
self.send("#{k}=", val)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
#
|
39
|
+
# Return an xml representation of these settings
|
40
|
+
#
|
41
|
+
def to_xml(builder = nil)
|
42
|
+
builder ||= Builder::XmlMarkup.new
|
43
|
+
tag = self.class.to_s.split("::").last.downcase
|
44
|
+
attr_list = self.class.send(:const_get, :ATTRIBUTES) rescue []
|
45
|
+
attrs = attr_list.inject({}) do |h,a|
|
46
|
+
val = self.send(a)
|
47
|
+
val.nil? ? h : h.merge(a => val)
|
48
|
+
end
|
49
|
+
builder.tag!(tag, attrs) { self.build_xml(builder) }
|
50
|
+
builder.target!
|
51
|
+
end
|
52
|
+
|
53
|
+
#
|
54
|
+
# build an xml representation of this subcomponent of the settings using the provided builder
|
55
|
+
#
|
56
|
+
def build_xml(builder)
|
57
|
+
self.class.send(:const_get, :VALUES).each do |a|
|
58
|
+
val = self.send(a)
|
59
|
+
if val.respond_to? :build_xml
|
60
|
+
builder.tag!(a) {|b| val.build_xml(b) }
|
61
|
+
elsif val.is_a? Array
|
62
|
+
val.each {|v| builder << v.to_xml }
|
63
|
+
elsif not val.nil?
|
64
|
+
builder.tag! a, val
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,1332 @@
|
|
1
|
+
# Auto generated from XML file
|
2
|
+
require 'ambling/base'
|
3
|
+
module Ambling
|
4
|
+
class Column
|
5
|
+
|
6
|
+
#
|
7
|
+
# "!" before x or y position (for example: <x>!20</x>) means that the coordinate will be calculated from the right side or the bottom
|
8
|
+
#
|
9
|
+
class Settings
|
10
|
+
include Base
|
11
|
+
|
12
|
+
VALUES = [:type,:data_type,:csv_separator,:skip_rows,:font,:text_size,:text_color,:decimals_separator,:thousands_separator,:digits_after_decimal,:redraw,:reload_data_interval,:preloader_on_reload,:add_time_stamp,:precision,:depth,:angle,:colors,:column,:line,:background,:plot_area,:grid,:values,:axes,:balloon,:legend,:export_as_image,:error_messages,:strings,:context_menu,:labels,:graphs,:guides]
|
13
|
+
#
|
14
|
+
# [column] (column / bar)
|
15
|
+
#
|
16
|
+
attr_accessor :type
|
17
|
+
|
18
|
+
#
|
19
|
+
# [xml] (xml / csv)
|
20
|
+
#
|
21
|
+
attr_accessor :data_type
|
22
|
+
|
23
|
+
#
|
24
|
+
# [;] (string) csv file data separator (you need it only if you are using csv file for your data)
|
25
|
+
#
|
26
|
+
attr_accessor :csv_separator
|
27
|
+
|
28
|
+
#
|
29
|
+
# [0] (Number) if you are using csv data type, you can set the number of rows which should be skipped here
|
30
|
+
#
|
31
|
+
attr_accessor :skip_rows
|
32
|
+
|
33
|
+
#
|
34
|
+
# [Arial] (font name) use device fonts, such as Arial, Times New Roman, Tahoma, Verdana...
|
35
|
+
#
|
36
|
+
attr_accessor :font
|
37
|
+
|
38
|
+
#
|
39
|
+
# [11] (Number) text size of all texts. Every text size can be set individually in the settings below
|
40
|
+
#
|
41
|
+
attr_accessor :text_size
|
42
|
+
|
43
|
+
#
|
44
|
+
# [#000000] (hex color code) main text color. Every text color can be set individually in the settings below
|
45
|
+
#
|
46
|
+
attr_accessor :text_color
|
47
|
+
|
48
|
+
#
|
49
|
+
# [,] (string) decimal separator. Note, that this is for displaying data only. Decimals in data xml file must be separated with a dot
|
50
|
+
#
|
51
|
+
attr_accessor :decimals_separator
|
52
|
+
|
53
|
+
#
|
54
|
+
# [ ] (string) thousand separator. use "none" if you don't want to separate
|
55
|
+
#
|
56
|
+
attr_accessor :thousands_separator
|
57
|
+
|
58
|
+
#
|
59
|
+
# [] (Number) if your value has less digits after decimal then is set here, zeroes will be added
|
60
|
+
#
|
61
|
+
attr_accessor :digits_after_decimal
|
62
|
+
|
63
|
+
#
|
64
|
+
# this function is beta, be careful. Legend, buttons labels will not be repositioned if you set your x and y values for these objects
|
65
|
+
#
|
66
|
+
attr_accessor :redraw
|
67
|
+
|
68
|
+
#
|
69
|
+
# [0] (Number) how often data should be reloaded (time in seconds)
|
70
|
+
#
|
71
|
+
attr_accessor :reload_data_interval
|
72
|
+
|
73
|
+
#
|
74
|
+
# [false] (true / false) Whether to show preloaded when data or settings are reloaded
|
75
|
+
#
|
76
|
+
attr_accessor :preloader_on_reload
|
77
|
+
|
78
|
+
#
|
79
|
+
# [false] (true / false) if true, a unique number will be added every time flash loads data. Mainly this feature is useful if you set reload _data_interval
|
80
|
+
#
|
81
|
+
attr_accessor :add_time_stamp
|
82
|
+
|
83
|
+
#
|
84
|
+
# [2] (Number) shows how many numbers should be shown after comma for calculated values (percents)
|
85
|
+
#
|
86
|
+
attr_accessor :precision
|
87
|
+
|
88
|
+
#
|
89
|
+
# [0] (Number) the depth of chart and columns (for 3D effect)
|
90
|
+
#
|
91
|
+
attr_accessor :depth
|
92
|
+
|
93
|
+
#
|
94
|
+
# [30] (0 - 90) angle of chart area and columns (for 3D effect)
|
95
|
+
#
|
96
|
+
attr_accessor :angle
|
97
|
+
|
98
|
+
#
|
99
|
+
# [#FF6600,#FCD202,#B0DE09,#0D8ECF,#2A0CD0,#CD0D74,#CC0000,#00CC00,#0000CC,#DDDDDD,#999999,#333333,#990000] Colors of graphs. if the graph color is not set, color from this array will be used
|
100
|
+
#
|
101
|
+
attr_accessor :colors
|
102
|
+
|
103
|
+
#
|
104
|
+
#
|
105
|
+
#
|
106
|
+
attr_accessor :column
|
107
|
+
|
108
|
+
#
|
109
|
+
# Here are general settings for "line" graph type. You can set most of these settings for individual lines in graph settings below
|
110
|
+
#
|
111
|
+
attr_accessor :line
|
112
|
+
|
113
|
+
#
|
114
|
+
# BACKGROUND
|
115
|
+
#
|
116
|
+
attr_accessor :background
|
117
|
+
|
118
|
+
#
|
119
|
+
# PLOT AREA (the area between axes)
|
120
|
+
#
|
121
|
+
attr_accessor :plot_area
|
122
|
+
|
123
|
+
#
|
124
|
+
# GRID
|
125
|
+
#
|
126
|
+
attr_accessor :grid
|
127
|
+
|
128
|
+
#
|
129
|
+
# VALUES
|
130
|
+
#
|
131
|
+
attr_accessor :values
|
132
|
+
|
133
|
+
#
|
134
|
+
# axes
|
135
|
+
#
|
136
|
+
attr_accessor :axes
|
137
|
+
|
138
|
+
#
|
139
|
+
# BALLOON
|
140
|
+
#
|
141
|
+
attr_accessor :balloon
|
142
|
+
|
143
|
+
#
|
144
|
+
# LEGEND
|
145
|
+
#
|
146
|
+
attr_accessor :legend
|
147
|
+
|
148
|
+
#
|
149
|
+
# export_as_image feature works only on a web server
|
150
|
+
#
|
151
|
+
attr_accessor :export_as_image
|
152
|
+
|
153
|
+
#
|
154
|
+
# "error_messages" settings will be applied for all error messages except the one which is showed if settings file wasn't found
|
155
|
+
#
|
156
|
+
attr_accessor :error_messages
|
157
|
+
|
158
|
+
#
|
159
|
+
#
|
160
|
+
#
|
161
|
+
attr_accessor :strings
|
162
|
+
|
163
|
+
#
|
164
|
+
# <menu function_name="printChart" title="Print chart"></menu>
|
165
|
+
#
|
166
|
+
attr_accessor :context_menu
|
167
|
+
|
168
|
+
#
|
169
|
+
# labels can also be added in data xml file, using exactly the same structure like it is here
|
170
|
+
#
|
171
|
+
attr_accessor :labels
|
172
|
+
|
173
|
+
#
|
174
|
+
# if graph settings are defined both here and in data file, the ones from data file are used
|
175
|
+
#
|
176
|
+
attr_accessor :graphs
|
177
|
+
|
178
|
+
#
|
179
|
+
# guides are straight lines drawn through all plot area at a give value. Can also be filled with color
|
180
|
+
#
|
181
|
+
attr_accessor :guides
|
182
|
+
|
183
|
+
|
184
|
+
#
|
185
|
+
#
|
186
|
+
#
|
187
|
+
class Column
|
188
|
+
include Base
|
189
|
+
|
190
|
+
VALUES = [:type,:width,:spacing,:grow_time,:grow_effect,:sequenced_grow,:alpha,:border_color,:border_alpha,:data_labels,:data_labels_text_color,:data_labels_text_size,:data_labels_position,:balloon_text,:link_target,:gradient,:bullet_offset,:hover_brightness]
|
191
|
+
#
|
192
|
+
# [clustered] (clustered, stacked, 100% stacked, 3d column)
|
193
|
+
#
|
194
|
+
attr_accessor :type
|
195
|
+
|
196
|
+
#
|
197
|
+
# [80] (0 - 100) width of column (in percents)
|
198
|
+
#
|
199
|
+
attr_accessor :width
|
200
|
+
|
201
|
+
#
|
202
|
+
# [5] (Number) space between columns of one category axis value, in pixels. Negative values can be used.
|
203
|
+
#
|
204
|
+
attr_accessor :spacing
|
205
|
+
|
206
|
+
#
|
207
|
+
# [0] (Number) grow time in seconds. Leave 0 to appear instantly
|
208
|
+
#
|
209
|
+
attr_accessor :grow_time
|
210
|
+
|
211
|
+
#
|
212
|
+
# [elastic] (elastic, regular, strong)
|
213
|
+
#
|
214
|
+
attr_accessor :grow_effect
|
215
|
+
|
216
|
+
#
|
217
|
+
# [false] (true / false) whether columns should grow at the same time or one after another
|
218
|
+
#
|
219
|
+
attr_accessor :sequenced_grow
|
220
|
+
|
221
|
+
#
|
222
|
+
# [100] (Number) alpha of all columns
|
223
|
+
#
|
224
|
+
attr_accessor :alpha
|
225
|
+
|
226
|
+
#
|
227
|
+
# [#FFFFFF] (hex color code)
|
228
|
+
#
|
229
|
+
attr_accessor :border_color
|
230
|
+
|
231
|
+
#
|
232
|
+
# [0] (Number)
|
233
|
+
#
|
234
|
+
attr_accessor :border_alpha
|
235
|
+
|
236
|
+
#
|
237
|
+
# [] ({title} {value} {series} {percents} {start} {difference} {total}) You can format any data label: {title} will be replaced with real title, {value} - with value and so on. You can add your own text or html code too.
|
238
|
+
#
|
239
|
+
attr_accessor :data_labels
|
240
|
+
|
241
|
+
#
|
242
|
+
# [text_color] (hex color code)
|
243
|
+
#
|
244
|
+
attr_accessor :data_labels_text_color
|
245
|
+
|
246
|
+
#
|
247
|
+
# [text_size] (Number)
|
248
|
+
#
|
249
|
+
attr_accessor :data_labels_text_size
|
250
|
+
|
251
|
+
#
|
252
|
+
# if you set "above" for column chart, the data label will be displayed inside column, rotated by 90 degrees
|
253
|
+
#
|
254
|
+
attr_accessor :data_labels_position
|
255
|
+
|
256
|
+
#
|
257
|
+
# [] ({title} {value} {series} {percents} {start} {difference} {total}) You can format any data label: {title} will be replaced with real title, {value} - with value and so on. You can add your own text or html code too.
|
258
|
+
#
|
259
|
+
attr_accessor :balloon_text
|
260
|
+
|
261
|
+
#
|
262
|
+
# [] (_blank, _top ...)
|
263
|
+
#
|
264
|
+
attr_accessor :link_target
|
265
|
+
|
266
|
+
#
|
267
|
+
# [vertical] (horizontal / vertical) Direction of column gradient. Gradient colors are defined in graph settings below.
|
268
|
+
#
|
269
|
+
attr_accessor :gradient
|
270
|
+
|
271
|
+
#
|
272
|
+
# [0] (Number) distance from column / bar to the bullet
|
273
|
+
#
|
274
|
+
attr_accessor :bullet_offset
|
275
|
+
|
276
|
+
#
|
277
|
+
# [0] (from -255 to 255) The column may darken/lighten when the use rolls over it. The intensity may be set here
|
278
|
+
#
|
279
|
+
attr_accessor :hover_brightness
|
280
|
+
end
|
281
|
+
#
|
282
|
+
# Here are general settings for "line" graph type. You can set most of these settings for individual lines in graph settings below
|
283
|
+
#
|
284
|
+
class Line
|
285
|
+
include Base
|
286
|
+
|
287
|
+
VALUES = [:connect,:width,:alpha,:fill_alpha,:bullet,:bullet_size,:data_labels,:data_labels_text_color,:data_labels_text_size,:balloon_text,:link_target]
|
288
|
+
#
|
289
|
+
# [false] (true / false) whether to connect points if data is missing
|
290
|
+
#
|
291
|
+
attr_accessor :connect
|
292
|
+
|
293
|
+
#
|
294
|
+
# [2] (Number) line width
|
295
|
+
#
|
296
|
+
attr_accessor :width
|
297
|
+
|
298
|
+
#
|
299
|
+
# [100] (Number) line alpha
|
300
|
+
#
|
301
|
+
attr_accessor :alpha
|
302
|
+
|
303
|
+
#
|
304
|
+
# [0] (Number) fill alpha
|
305
|
+
#
|
306
|
+
attr_accessor :fill_alpha
|
307
|
+
|
308
|
+
#
|
309
|
+
# [] (square, round, square_outlined, round_outlined, square_outline, round_outline, filename.swf) can be used predefined bullets or loaded custom bullets. Leave empty if you don't want to have bullets at all. Outlined bullets use plot area color for outline color
|
310
|
+
#
|
311
|
+
attr_accessor :bullet
|
312
|
+
|
313
|
+
#
|
314
|
+
# [8] (Number) bullet size
|
315
|
+
#
|
316
|
+
attr_accessor :bullet_size
|
317
|
+
|
318
|
+
#
|
319
|
+
# [] ({title} {value} {series} {percents} {start} {difference} {total}) You can format any data label: {title} will be replaced with real title, {value} - with value and so on. You can add your own text or html code too.
|
320
|
+
#
|
321
|
+
attr_accessor :data_labels
|
322
|
+
|
323
|
+
#
|
324
|
+
# [text_color] (hex color code)
|
325
|
+
#
|
326
|
+
attr_accessor :data_labels_text_color
|
327
|
+
|
328
|
+
#
|
329
|
+
# [text_size] (Number)
|
330
|
+
#
|
331
|
+
attr_accessor :data_labels_text_size
|
332
|
+
|
333
|
+
#
|
334
|
+
# [] use the same formatting rules as for data labels
|
335
|
+
#
|
336
|
+
attr_accessor :balloon_text
|
337
|
+
|
338
|
+
#
|
339
|
+
# [] (_blank, _top ...)
|
340
|
+
#
|
341
|
+
attr_accessor :link_target
|
342
|
+
end
|
343
|
+
#
|
344
|
+
# BACKGROUND
|
345
|
+
#
|
346
|
+
class Background
|
347
|
+
include Base
|
348
|
+
|
349
|
+
VALUES = [:color,:alpha,:border_color,:border_alpha,:file]
|
350
|
+
#
|
351
|
+
# [#FFFFFF] (hex color code) Separate color codes with comas for gradient
|
352
|
+
#
|
353
|
+
attr_accessor :color
|
354
|
+
|
355
|
+
#
|
356
|
+
# [0] (0 - 100) use 0 if you are using custom swf or jpg for background
|
357
|
+
#
|
358
|
+
attr_accessor :alpha
|
359
|
+
|
360
|
+
#
|
361
|
+
# [#000000] (hex color code)
|
362
|
+
#
|
363
|
+
attr_accessor :border_color
|
364
|
+
|
365
|
+
#
|
366
|
+
# [0] (0 - 100)
|
367
|
+
#
|
368
|
+
attr_accessor :border_alpha
|
369
|
+
|
370
|
+
#
|
371
|
+
# The chart will look for this file in "path" folder ("path" is set in HTML)
|
372
|
+
#
|
373
|
+
attr_accessor :file
|
374
|
+
end
|
375
|
+
#
|
376
|
+
# PLOT AREA (the area between axes)
|
377
|
+
#
|
378
|
+
class PlotArea
|
379
|
+
include Base
|
380
|
+
|
381
|
+
VALUES = [:color,:alpha,:border_color,:border_alpha,:margins]
|
382
|
+
#
|
383
|
+
# [#FFFFFF](hex color code) Separate color codes with comas for gradient
|
384
|
+
#
|
385
|
+
attr_accessor :color
|
386
|
+
|
387
|
+
#
|
388
|
+
# [0] (0 - 100) if you want it to be different than background color, use bigger than 0 value
|
389
|
+
#
|
390
|
+
attr_accessor :alpha
|
391
|
+
|
392
|
+
#
|
393
|
+
# [#000000] (hex color code)
|
394
|
+
#
|
395
|
+
attr_accessor :border_color
|
396
|
+
|
397
|
+
#
|
398
|
+
# [0] (0 - 100)
|
399
|
+
#
|
400
|
+
attr_accessor :border_alpha
|
401
|
+
|
402
|
+
#
|
403
|
+
# plot area margins
|
404
|
+
#
|
405
|
+
attr_accessor :margins
|
406
|
+
|
407
|
+
|
408
|
+
#
|
409
|
+
# plot area margins
|
410
|
+
#
|
411
|
+
class Margins
|
412
|
+
include Base
|
413
|
+
|
414
|
+
VALUES = [:left,:top,:right,:bottom]
|
415
|
+
#
|
416
|
+
# [60](Number)
|
417
|
+
#
|
418
|
+
attr_accessor :left
|
419
|
+
|
420
|
+
#
|
421
|
+
# [60](Number)
|
422
|
+
#
|
423
|
+
attr_accessor :top
|
424
|
+
|
425
|
+
#
|
426
|
+
# [60](Number)
|
427
|
+
#
|
428
|
+
attr_accessor :right
|
429
|
+
|
430
|
+
#
|
431
|
+
# [80](Number)
|
432
|
+
#
|
433
|
+
attr_accessor :bottom
|
434
|
+
end
|
435
|
+
end
|
436
|
+
#
|
437
|
+
# GRID
|
438
|
+
#
|
439
|
+
class Grid
|
440
|
+
include Base
|
441
|
+
|
442
|
+
VALUES = [:category,:value]
|
443
|
+
#
|
444
|
+
# category axis grid
|
445
|
+
#
|
446
|
+
attr_accessor :category
|
447
|
+
|
448
|
+
#
|
449
|
+
# value axis grid
|
450
|
+
#
|
451
|
+
attr_accessor :value
|
452
|
+
|
453
|
+
|
454
|
+
#
|
455
|
+
# category axis grid
|
456
|
+
#
|
457
|
+
class Category
|
458
|
+
include Base
|
459
|
+
|
460
|
+
VALUES = [:color,:alpha,:dashed,:dash_length]
|
461
|
+
#
|
462
|
+
# [#000000] (hex color code)
|
463
|
+
#
|
464
|
+
attr_accessor :color
|
465
|
+
|
466
|
+
#
|
467
|
+
# [15] (0 - 100)
|
468
|
+
#
|
469
|
+
attr_accessor :alpha
|
470
|
+
|
471
|
+
#
|
472
|
+
# [false](true / false)
|
473
|
+
#
|
474
|
+
attr_accessor :dashed
|
475
|
+
|
476
|
+
#
|
477
|
+
# [5] (Number)
|
478
|
+
#
|
479
|
+
attr_accessor :dash_length
|
480
|
+
end
|
481
|
+
#
|
482
|
+
# value axis grid
|
483
|
+
#
|
484
|
+
class Value
|
485
|
+
include Base
|
486
|
+
|
487
|
+
VALUES = [:color,:alpha,:dashed,:dash_length,:approx_count,:fill_color,:fill_alpha]
|
488
|
+
#
|
489
|
+
# [#000000] (hex color code)
|
490
|
+
#
|
491
|
+
attr_accessor :color
|
492
|
+
|
493
|
+
#
|
494
|
+
# [15] (0 - 100)
|
495
|
+
#
|
496
|
+
attr_accessor :alpha
|
497
|
+
|
498
|
+
#
|
499
|
+
# [false] (true / false)
|
500
|
+
#
|
501
|
+
attr_accessor :dashed
|
502
|
+
|
503
|
+
#
|
504
|
+
# [5] (Number)
|
505
|
+
#
|
506
|
+
attr_accessor :dash_length
|
507
|
+
|
508
|
+
#
|
509
|
+
# [10] (Number) approximate number of gridlines
|
510
|
+
#
|
511
|
+
attr_accessor :approx_count
|
512
|
+
|
513
|
+
#
|
514
|
+
# [#FFFFFF] (hex color code) every second area between gridlines will be filled with this color (you will need to set fill_alpha > 0)
|
515
|
+
#
|
516
|
+
attr_accessor :fill_color
|
517
|
+
|
518
|
+
#
|
519
|
+
# [0] (0 - 100) opacity of fill
|
520
|
+
#
|
521
|
+
attr_accessor :fill_alpha
|
522
|
+
end
|
523
|
+
end
|
524
|
+
#
|
525
|
+
# VALUES
|
526
|
+
#
|
527
|
+
class Values
|
528
|
+
include Base
|
529
|
+
|
530
|
+
VALUES = [:category,:value]
|
531
|
+
#
|
532
|
+
# category axis
|
533
|
+
#
|
534
|
+
attr_accessor :category
|
535
|
+
|
536
|
+
#
|
537
|
+
# value axis
|
538
|
+
#
|
539
|
+
attr_accessor :value
|
540
|
+
|
541
|
+
|
542
|
+
#
|
543
|
+
# category axis
|
544
|
+
#
|
545
|
+
class Category
|
546
|
+
include Base
|
547
|
+
|
548
|
+
VALUES = [:enabled,:frequency,:start_from,:rotate,:color,:text_size,:inside]
|
549
|
+
#
|
550
|
+
# [true] (true / false)
|
551
|
+
#
|
552
|
+
attr_accessor :enabled
|
553
|
+
|
554
|
+
#
|
555
|
+
# [1] (Number) how often values should be placed
|
556
|
+
#
|
557
|
+
attr_accessor :frequency
|
558
|
+
|
559
|
+
#
|
560
|
+
# [1] (Number) you can set series from which category values will be displayed
|
561
|
+
#
|
562
|
+
attr_accessor :start_from
|
563
|
+
|
564
|
+
#
|
565
|
+
# [0] (0 - 90) angle of rotation. If you want to rotate by degree from 1 to 89, you must have font.swf file in fonts folder
|
566
|
+
#
|
567
|
+
attr_accessor :rotate
|
568
|
+
|
569
|
+
#
|
570
|
+
# [text_color] (hex color code)
|
571
|
+
#
|
572
|
+
attr_accessor :color
|
573
|
+
|
574
|
+
#
|
575
|
+
# [text_size] (Number)
|
576
|
+
#
|
577
|
+
attr_accessor :text_size
|
578
|
+
|
579
|
+
#
|
580
|
+
# [false] (true / false) if set to true, axis values will be displayed inside plot area. This setting will not work for values rotated by 1-89 degrees (0 and 90 only)
|
581
|
+
#
|
582
|
+
attr_accessor :inside
|
583
|
+
end
|
584
|
+
#
|
585
|
+
# value axis
|
586
|
+
#
|
587
|
+
class Value
|
588
|
+
include Base
|
589
|
+
|
590
|
+
VALUES = [:enabled,:reverse,:min,:max,:strict_min_max,:frequency,:rotate,:skip_first,:skip_last,:color,:text_size,:unit,:unit_position,:integers_only,:inside]
|
591
|
+
#
|
592
|
+
# [true] (true / false)
|
593
|
+
#
|
594
|
+
attr_accessor :enabled
|
595
|
+
|
596
|
+
#
|
597
|
+
# [false] (true / false) whether to reverse this axis values or not. If set to true, values will start from biggest number and will end with a smallest number
|
598
|
+
#
|
599
|
+
attr_accessor :reverse
|
600
|
+
|
601
|
+
#
|
602
|
+
# [] (Number) minimum value of this axis. If empty, this value will be calculated automatically.
|
603
|
+
#
|
604
|
+
attr_accessor :min
|
605
|
+
|
606
|
+
#
|
607
|
+
# [] (Number) maximum value of this axis. If empty, this value will be calculated automatically
|
608
|
+
#
|
609
|
+
attr_accessor :max
|
610
|
+
|
611
|
+
#
|
612
|
+
# [false] (true / false) by default, if your values are bigger then defined max (or smaller then defined min), max and min is changed so that all the chart would fit to chart area. If you don't want this, set this option to true.
|
613
|
+
#
|
614
|
+
attr_accessor :strict_min_max
|
615
|
+
|
616
|
+
#
|
617
|
+
# [1] (Number) how often values should be placed, 1 - near every gridline, 2 - near every second gridline...
|
618
|
+
#
|
619
|
+
attr_accessor :frequency
|
620
|
+
|
621
|
+
#
|
622
|
+
# [0] (0 - 90) angle of rotation. If you want to rotate by degree from 1 to 89, you must have font.swf file in fonts folder
|
623
|
+
#
|
624
|
+
attr_accessor :rotate
|
625
|
+
|
626
|
+
#
|
627
|
+
# [true] (true / false) to skip or not first value
|
628
|
+
#
|
629
|
+
attr_accessor :skip_first
|
630
|
+
|
631
|
+
#
|
632
|
+
# [false] (true / false) to skip or not last value
|
633
|
+
#
|
634
|
+
attr_accessor :skip_last
|
635
|
+
|
636
|
+
#
|
637
|
+
# [text_color] (hex color code)
|
638
|
+
#
|
639
|
+
attr_accessor :color
|
640
|
+
|
641
|
+
#
|
642
|
+
# [text_size] (Number)
|
643
|
+
#
|
644
|
+
attr_accessor :text_size
|
645
|
+
|
646
|
+
#
|
647
|
+
# [] (text)
|
648
|
+
#
|
649
|
+
attr_accessor :unit
|
650
|
+
|
651
|
+
#
|
652
|
+
# [right] (right / left)
|
653
|
+
#
|
654
|
+
attr_accessor :unit_position
|
655
|
+
|
656
|
+
#
|
657
|
+
# [false] (true / false) if set to true, values with decimals will be omitted
|
658
|
+
#
|
659
|
+
attr_accessor :integers_only
|
660
|
+
|
661
|
+
#
|
662
|
+
# [false] (true / false) if set to true, axis values will be displayed inside plot area. This setting will not work for values rotated by 1-89 degrees (0 and 90 only)
|
663
|
+
#
|
664
|
+
attr_accessor :inside
|
665
|
+
end
|
666
|
+
end
|
667
|
+
#
|
668
|
+
# axes
|
669
|
+
#
|
670
|
+
class Axes
|
671
|
+
include Base
|
672
|
+
|
673
|
+
VALUES = [:category,:value]
|
674
|
+
#
|
675
|
+
# category axis
|
676
|
+
#
|
677
|
+
attr_accessor :category
|
678
|
+
|
679
|
+
#
|
680
|
+
# value axis
|
681
|
+
#
|
682
|
+
attr_accessor :value
|
683
|
+
|
684
|
+
|
685
|
+
#
|
686
|
+
# category axis
|
687
|
+
#
|
688
|
+
class Category
|
689
|
+
include Base
|
690
|
+
|
691
|
+
VALUES = [:color,:alpha,:width,:tick_length]
|
692
|
+
#
|
693
|
+
# [#000000] (hex color code)
|
694
|
+
#
|
695
|
+
attr_accessor :color
|
696
|
+
|
697
|
+
#
|
698
|
+
# [100] (0 - 100)
|
699
|
+
#
|
700
|
+
attr_accessor :alpha
|
701
|
+
|
702
|
+
#
|
703
|
+
# [2] (Number) line width, 0 for hairline
|
704
|
+
#
|
705
|
+
attr_accessor :width
|
706
|
+
|
707
|
+
#
|
708
|
+
# [7] (Number)
|
709
|
+
#
|
710
|
+
attr_accessor :tick_length
|
711
|
+
end
|
712
|
+
#
|
713
|
+
# value axis
|
714
|
+
#
|
715
|
+
class Value
|
716
|
+
include Base
|
717
|
+
|
718
|
+
VALUES = [:color,:alpha,:width,:tick_length,:logarithmic]
|
719
|
+
#
|
720
|
+
# [#000000] (hex color code)
|
721
|
+
#
|
722
|
+
attr_accessor :color
|
723
|
+
|
724
|
+
#
|
725
|
+
# [100] (0 - 100)
|
726
|
+
#
|
727
|
+
attr_accessor :alpha
|
728
|
+
|
729
|
+
#
|
730
|
+
# [2] (Number) line width, 0 for hairline
|
731
|
+
#
|
732
|
+
attr_accessor :width
|
733
|
+
|
734
|
+
#
|
735
|
+
# [7] (Number)
|
736
|
+
#
|
737
|
+
attr_accessor :tick_length
|
738
|
+
|
739
|
+
#
|
740
|
+
# [false] (true / false) If set to true, this axis will use logarithmic scale instead of linear
|
741
|
+
#
|
742
|
+
attr_accessor :logarithmic
|
743
|
+
end
|
744
|
+
end
|
745
|
+
#
|
746
|
+
# BALLOON
|
747
|
+
#
|
748
|
+
class Balloon
|
749
|
+
include Base
|
750
|
+
|
751
|
+
VALUES = [:enabled,:color,:alpha,:text_color,:text_size,:max_width,:corner_radius,:border_width,:border_alpha,:border_color]
|
752
|
+
#
|
753
|
+
# [true] (true / false)
|
754
|
+
#
|
755
|
+
attr_accessor :enabled
|
756
|
+
|
757
|
+
#
|
758
|
+
# [] (hex color code) balloon background color. If empty, slightly darker then current column color will be used
|
759
|
+
#
|
760
|
+
attr_accessor :color
|
761
|
+
|
762
|
+
#
|
763
|
+
# [100] (0 - 100)
|
764
|
+
#
|
765
|
+
attr_accessor :alpha
|
766
|
+
|
767
|
+
#
|
768
|
+
# [#FFFFFF] (hex color code)
|
769
|
+
#
|
770
|
+
attr_accessor :text_color
|
771
|
+
|
772
|
+
#
|
773
|
+
# [text_size] (Number)
|
774
|
+
#
|
775
|
+
attr_accessor :text_size
|
776
|
+
|
777
|
+
#
|
778
|
+
# [220] (Number) The maximum width of a balloon
|
779
|
+
#
|
780
|
+
attr_accessor :max_width
|
781
|
+
|
782
|
+
#
|
783
|
+
# [0] (Number) Corner radius of a balloon. If you set it > 0, the balloon will not display arrow
|
784
|
+
#
|
785
|
+
attr_accessor :corner_radius
|
786
|
+
|
787
|
+
#
|
788
|
+
# [0] (Number)
|
789
|
+
#
|
790
|
+
attr_accessor :border_width
|
791
|
+
|
792
|
+
#
|
793
|
+
# [balloon.alpha] (Number)
|
794
|
+
#
|
795
|
+
attr_accessor :border_alpha
|
796
|
+
|
797
|
+
#
|
798
|
+
# [balloon.color] (hex color code)
|
799
|
+
#
|
800
|
+
attr_accessor :border_color
|
801
|
+
end
|
802
|
+
#
|
803
|
+
# LEGEND
|
804
|
+
#
|
805
|
+
class Legend
|
806
|
+
include Base
|
807
|
+
|
808
|
+
VALUES = [:enabled,:x,:y,:width,:max_columns,:color,:alpha,:border_color,:border_alpha,:text_color,:text_size,:spacing,:margins,:reverse_order,:align,:key]
|
809
|
+
#
|
810
|
+
# [true] (true / false)
|
811
|
+
#
|
812
|
+
attr_accessor :enabled
|
813
|
+
|
814
|
+
#
|
815
|
+
# [] (Number / Number% / !Number) if empty, will be equal to left margin
|
816
|
+
#
|
817
|
+
attr_accessor :x
|
818
|
+
|
819
|
+
#
|
820
|
+
# [] (Number / Number% / !Number) if empty, will be below plot area
|
821
|
+
#
|
822
|
+
attr_accessor :y
|
823
|
+
|
824
|
+
#
|
825
|
+
# [] (Number / Number%) if empty, will be equal to plot area width
|
826
|
+
#
|
827
|
+
attr_accessor :width
|
828
|
+
|
829
|
+
#
|
830
|
+
# [] (Number) the maximum number of columns in the legend
|
831
|
+
#
|
832
|
+
attr_accessor :max_columns
|
833
|
+
|
834
|
+
#
|
835
|
+
# [#FFFFFF] (hex color code) background color. Separate color codes with comas for gradient
|
836
|
+
#
|
837
|
+
attr_accessor :color
|
838
|
+
|
839
|
+
#
|
840
|
+
# [0] (0 - 100) background alpha
|
841
|
+
#
|
842
|
+
attr_accessor :alpha
|
843
|
+
|
844
|
+
#
|
845
|
+
# [#000000] (hex color code) border color
|
846
|
+
#
|
847
|
+
attr_accessor :border_color
|
848
|
+
|
849
|
+
#
|
850
|
+
# [0] (0 - 100) border alpha
|
851
|
+
#
|
852
|
+
attr_accessor :border_alpha
|
853
|
+
|
854
|
+
#
|
855
|
+
# [text_color] (hex color code)
|
856
|
+
#
|
857
|
+
attr_accessor :text_color
|
858
|
+
|
859
|
+
#
|
860
|
+
# [text_size] (Number)
|
861
|
+
#
|
862
|
+
attr_accessor :text_size
|
863
|
+
|
864
|
+
#
|
865
|
+
# [10] (Number) vertical and horizontal gap between legend entries
|
866
|
+
#
|
867
|
+
attr_accessor :spacing
|
868
|
+
|
869
|
+
#
|
870
|
+
# [0] (Number) legend margins (space between legend border and legend entries, recommended to use only if legend border is visible or background color is different from chart area background color)
|
871
|
+
#
|
872
|
+
attr_accessor :margins
|
873
|
+
|
874
|
+
#
|
875
|
+
# [false] (true / false) whether to sort legend entries in a reverse order
|
876
|
+
#
|
877
|
+
attr_accessor :reverse_order
|
878
|
+
|
879
|
+
#
|
880
|
+
# [left] (left / center / right) alignment of legend entries
|
881
|
+
#
|
882
|
+
attr_accessor :align
|
883
|
+
|
884
|
+
#
|
885
|
+
# KEY (the color box near every legend entry)
|
886
|
+
#
|
887
|
+
attr_accessor :key
|
888
|
+
|
889
|
+
|
890
|
+
#
|
891
|
+
# KEY (the color box near every legend entry)
|
892
|
+
#
|
893
|
+
class Key
|
894
|
+
include Base
|
895
|
+
|
896
|
+
VALUES = [:size,:border_color]
|
897
|
+
#
|
898
|
+
# [16] (Number) key size
|
899
|
+
#
|
900
|
+
attr_accessor :size
|
901
|
+
|
902
|
+
#
|
903
|
+
# [] (hex color code) leave empty if you don't want to have border
|
904
|
+
#
|
905
|
+
attr_accessor :border_color
|
906
|
+
end
|
907
|
+
end
|
908
|
+
#
|
909
|
+
# export_as_image feature works only on a web server
|
910
|
+
#
|
911
|
+
class ExportAsImage
|
912
|
+
include Base
|
913
|
+
|
914
|
+
VALUES = [:file,:target,:x,:y,:color,:alpha,:text_color,:text_size]
|
915
|
+
#
|
916
|
+
# [] (filename) if you set filename here, context menu (then user right clicks on flash movie) "Export as image" will appear. This will allow user to export chart as an image. Collected image data will be posted to this file name (use amcolumn/export.php or amcolumn/export.aspx)
|
917
|
+
#
|
918
|
+
attr_accessor :file
|
919
|
+
|
920
|
+
#
|
921
|
+
# [] (_blank, _top ...) target of a window in which export file must be called
|
922
|
+
#
|
923
|
+
attr_accessor :target
|
924
|
+
|
925
|
+
#
|
926
|
+
# [0] (Number / Number% / !Number) x position of "Collecting data" text
|
927
|
+
#
|
928
|
+
attr_accessor :x
|
929
|
+
|
930
|
+
#
|
931
|
+
# [] (Number / Number% / !Number) y position of "Collecting data" text. If not set, will be aligned to the bottom of flash movie
|
932
|
+
#
|
933
|
+
attr_accessor :y
|
934
|
+
|
935
|
+
#
|
936
|
+
# [#BBBB00] (hex color code) background color of "Collecting data" text
|
937
|
+
#
|
938
|
+
attr_accessor :color
|
939
|
+
|
940
|
+
#
|
941
|
+
# [0] (0 - 100) background alpha
|
942
|
+
#
|
943
|
+
attr_accessor :alpha
|
944
|
+
|
945
|
+
#
|
946
|
+
# [text_color] (hex color code)
|
947
|
+
#
|
948
|
+
attr_accessor :text_color
|
949
|
+
|
950
|
+
#
|
951
|
+
# [text_size] (Number)
|
952
|
+
#
|
953
|
+
attr_accessor :text_size
|
954
|
+
end
|
955
|
+
#
|
956
|
+
# "error_messages" settings will be applied for all error messages except the one which is showed if settings file wasn't found
|
957
|
+
#
|
958
|
+
class ErrorMessages
|
959
|
+
include Base
|
960
|
+
|
961
|
+
VALUES = [:enabled,:x,:y,:color,:alpha,:text_color,:text_size]
|
962
|
+
#
|
963
|
+
# [true] (true / false)
|
964
|
+
#
|
965
|
+
attr_accessor :enabled
|
966
|
+
|
967
|
+
#
|
968
|
+
# [] (Number / Number% / !Number) x position of error message. If not set, will be aligned to the center
|
969
|
+
#
|
970
|
+
attr_accessor :x
|
971
|
+
|
972
|
+
#
|
973
|
+
# [] (Number / Number% / !Number) y position of error message. If not set, will be aligned to the center
|
974
|
+
#
|
975
|
+
attr_accessor :y
|
976
|
+
|
977
|
+
#
|
978
|
+
# [#BBBB00] (hex color code) background color of error message. Separate color codes with comas for gradient
|
979
|
+
#
|
980
|
+
attr_accessor :color
|
981
|
+
|
982
|
+
#
|
983
|
+
# [100] (0 - 100) background alpha
|
984
|
+
#
|
985
|
+
attr_accessor :alpha
|
986
|
+
|
987
|
+
#
|
988
|
+
# [#FFFFFF] (hex color code)
|
989
|
+
#
|
990
|
+
attr_accessor :text_color
|
991
|
+
|
992
|
+
#
|
993
|
+
# [text_size] (Number)
|
994
|
+
#
|
995
|
+
attr_accessor :text_size
|
996
|
+
end
|
997
|
+
#
|
998
|
+
#
|
999
|
+
#
|
1000
|
+
class Strings
|
1001
|
+
include Base
|
1002
|
+
|
1003
|
+
VALUES = [:no_data,:export_as_image,:collecting_data]
|
1004
|
+
#
|
1005
|
+
# [No data for selected period] (text) if data is missing, this message will be displayed
|
1006
|
+
#
|
1007
|
+
attr_accessor :no_data
|
1008
|
+
|
1009
|
+
#
|
1010
|
+
# [Export as image] (text) text for right click menu
|
1011
|
+
#
|
1012
|
+
attr_accessor :export_as_image
|
1013
|
+
|
1014
|
+
#
|
1015
|
+
# [Collecting data] (text) this text is displayed while exporting chart to an image
|
1016
|
+
#
|
1017
|
+
attr_accessor :collecting_data
|
1018
|
+
end
|
1019
|
+
#
|
1020
|
+
# <menu function_name="printChart" title="Print chart"></menu>
|
1021
|
+
#
|
1022
|
+
class ContextMenu
|
1023
|
+
include Base
|
1024
|
+
|
1025
|
+
VALUES = [:default_items]
|
1026
|
+
#
|
1027
|
+
#
|
1028
|
+
#
|
1029
|
+
attr_accessor :default_items
|
1030
|
+
|
1031
|
+
|
1032
|
+
#
|
1033
|
+
#
|
1034
|
+
#
|
1035
|
+
class DefaultItems
|
1036
|
+
include Base
|
1037
|
+
|
1038
|
+
VALUES = [:zoom,:print]
|
1039
|
+
#
|
1040
|
+
# [true] (true / false) to show or not flash players zoom menu
|
1041
|
+
#
|
1042
|
+
attr_accessor :zoom
|
1043
|
+
|
1044
|
+
#
|
1045
|
+
# [true] (true / false) to show or not flash players print menu
|
1046
|
+
#
|
1047
|
+
attr_accessor :print
|
1048
|
+
end
|
1049
|
+
end
|
1050
|
+
#
|
1051
|
+
# labels can also be added in data xml file, using exactly the same structure like it is here
|
1052
|
+
#
|
1053
|
+
class Labels
|
1054
|
+
include Base
|
1055
|
+
|
1056
|
+
VALUES = [:label]
|
1057
|
+
#
|
1058
|
+
#
|
1059
|
+
#
|
1060
|
+
attr_accessor :label
|
1061
|
+
|
1062
|
+
|
1063
|
+
#
|
1064
|
+
#
|
1065
|
+
#
|
1066
|
+
class Label
|
1067
|
+
include Base
|
1068
|
+
|
1069
|
+
VALUES = [:x,:y,:rotate,:width,:align,:text_color,:text_size,:text]
|
1070
|
+
ATTRIBUTES = [:lid]
|
1071
|
+
#
|
1072
|
+
# [0] (Number / Number% / !Number)
|
1073
|
+
#
|
1074
|
+
attr_accessor :x
|
1075
|
+
|
1076
|
+
#
|
1077
|
+
# [0] (Number / Number% / !Number)
|
1078
|
+
#
|
1079
|
+
attr_accessor :y
|
1080
|
+
|
1081
|
+
#
|
1082
|
+
# [false] (true / false)
|
1083
|
+
#
|
1084
|
+
attr_accessor :rotate
|
1085
|
+
|
1086
|
+
#
|
1087
|
+
# [] (Number / Number%) if empty, will stretch from left to right untill label fits
|
1088
|
+
#
|
1089
|
+
attr_accessor :width
|
1090
|
+
|
1091
|
+
#
|
1092
|
+
# [left] (left / center / right)
|
1093
|
+
#
|
1094
|
+
attr_accessor :align
|
1095
|
+
|
1096
|
+
#
|
1097
|
+
# [text_color] (hex color code) button text color
|
1098
|
+
#
|
1099
|
+
attr_accessor :text_color
|
1100
|
+
|
1101
|
+
#
|
1102
|
+
# [text_size](Number) button text size
|
1103
|
+
#
|
1104
|
+
attr_accessor :text_size
|
1105
|
+
|
1106
|
+
#
|
1107
|
+
# [] (text) html tags may be used (supports <b>, <i>, <u>, <font>, <a href="">, <br/>. Enter text between []: <![CDATA[your <b>bold</b> and <i>italic</i> text]]>
|
1108
|
+
#
|
1109
|
+
attr_accessor :text
|
1110
|
+
|
1111
|
+
#
|
1112
|
+
# xml attribute
|
1113
|
+
#
|
1114
|
+
attr_accessor :lid
|
1115
|
+
end
|
1116
|
+
end
|
1117
|
+
#
|
1118
|
+
# if graph settings are defined both here and in data file, the ones from data file are used
|
1119
|
+
#
|
1120
|
+
class Graphs
|
1121
|
+
include Base
|
1122
|
+
|
1123
|
+
VALUES = [:graph]
|
1124
|
+
#
|
1125
|
+
# if you are using XML data file, graph "gid" must match graph "gid" in data file
|
1126
|
+
#
|
1127
|
+
attr_accessor :graph
|
1128
|
+
|
1129
|
+
|
1130
|
+
#
|
1131
|
+
# if you are using XML data file, graph "gid" must match graph "gid" in data file
|
1132
|
+
#
|
1133
|
+
class Graph
|
1134
|
+
include Base
|
1135
|
+
|
1136
|
+
VALUES = [:type,:title,:color,:alpha,:data_labels,:gradient_fill_colors,:balloon_color,:balloon_alpha,:balloon_text_color,:balloon_text,:fill_alpha,:width,:bullet,:bullet_size,:bullet_color,:visible_in_legend]
|
1137
|
+
ATTRIBUTES = [:gid]
|
1138
|
+
#
|
1139
|
+
# [column] (column/line)
|
1140
|
+
#
|
1141
|
+
attr_accessor :type
|
1142
|
+
|
1143
|
+
#
|
1144
|
+
# [] (graph title)
|
1145
|
+
#
|
1146
|
+
attr_accessor :title
|
1147
|
+
|
1148
|
+
#
|
1149
|
+
# [] (hex color code)
|
1150
|
+
#
|
1151
|
+
attr_accessor :color
|
1152
|
+
|
1153
|
+
#
|
1154
|
+
# [column.alpha (line.alpha)] (0 - 100)
|
1155
|
+
#
|
1156
|
+
attr_accessor :alpha
|
1157
|
+
|
1158
|
+
#
|
1159
|
+
# [column.data_labels (line.data_labels)] ({title} {value} {series} {percents} {start} {difference} {total}) You can format any data label: {title} will be replaced with real title, {value} - with value and so on. You can add your own text or html code too.
|
1160
|
+
#
|
1161
|
+
attr_accessor :data_labels
|
1162
|
+
|
1163
|
+
#
|
1164
|
+
# [] (hex color codes separated by comas) columns can be filled with gradients. Set any number of colors here. Note, that the legend key will be filled with color value, not with gradient.
|
1165
|
+
#
|
1166
|
+
attr_accessor :gradient_fill_colors
|
1167
|
+
|
1168
|
+
#
|
1169
|
+
# [balloon.color] (hex color code) leave empty to use the same color as graph
|
1170
|
+
#
|
1171
|
+
attr_accessor :balloon_color
|
1172
|
+
|
1173
|
+
#
|
1174
|
+
# [balloon.alpha] (0 - 100)
|
1175
|
+
#
|
1176
|
+
attr_accessor :balloon_alpha
|
1177
|
+
|
1178
|
+
#
|
1179
|
+
# [balloon.text_color] (hex color code)
|
1180
|
+
#
|
1181
|
+
attr_accessor :balloon_text_color
|
1182
|
+
|
1183
|
+
#
|
1184
|
+
# [column(line).balloon.text] ({title} {value} {series} {description} {percents}) You can format any balloon text: {title} will be replaced with real title, {value} - with value and so on. You can add your own text or html code too.
|
1185
|
+
#
|
1186
|
+
attr_accessor :balloon_text
|
1187
|
+
|
1188
|
+
#
|
1189
|
+
# [0] (0 - 100) fill alpha (use it if you want to have area chart)
|
1190
|
+
#
|
1191
|
+
attr_accessor :fill_alpha
|
1192
|
+
|
1193
|
+
#
|
1194
|
+
# [2] (Number) line width
|
1195
|
+
#
|
1196
|
+
attr_accessor :width
|
1197
|
+
|
1198
|
+
#
|
1199
|
+
# [line.bullet] (round, square, round_outlined, square_outline, round_outline, square_outlined, filename)
|
1200
|
+
#
|
1201
|
+
attr_accessor :bullet
|
1202
|
+
|
1203
|
+
#
|
1204
|
+
# [line.bullet_size] (Number) bullet size
|
1205
|
+
#
|
1206
|
+
attr_accessor :bullet_size
|
1207
|
+
|
1208
|
+
#
|
1209
|
+
# [] (hex color code) bullet color. If not defined, line color is used
|
1210
|
+
#
|
1211
|
+
attr_accessor :bullet_color
|
1212
|
+
|
1213
|
+
#
|
1214
|
+
# [true] (true / false) whether to show legend entry for this graph or not
|
1215
|
+
#
|
1216
|
+
attr_accessor :visible_in_legend
|
1217
|
+
|
1218
|
+
#
|
1219
|
+
# xml attribute
|
1220
|
+
#
|
1221
|
+
attr_accessor :gid
|
1222
|
+
end
|
1223
|
+
end
|
1224
|
+
#
|
1225
|
+
# guides are straight lines drawn through all plot area at a give value. Can also be filled with color
|
1226
|
+
#
|
1227
|
+
class Guides
|
1228
|
+
include Base
|
1229
|
+
|
1230
|
+
VALUES = [:max_min,:guide]
|
1231
|
+
#
|
1232
|
+
# [false] (true / false) whether to include guides' values when calculating min and max of a chart
|
1233
|
+
#
|
1234
|
+
attr_accessor :max_min
|
1235
|
+
|
1236
|
+
#
|
1237
|
+
# there can be any number of quides. guides can also be set in data xml file, using the same syntax as here
|
1238
|
+
#
|
1239
|
+
attr_accessor :guide
|
1240
|
+
|
1241
|
+
|
1242
|
+
#
|
1243
|
+
# there can be any number of quides. guides can also be set in data xml file, using the same syntax as here
|
1244
|
+
#
|
1245
|
+
class Guide
|
1246
|
+
include Base
|
1247
|
+
|
1248
|
+
VALUES = [:behind,:start_value,:end_value,:title,:width,:color,:alpha,:fill_color,:fill_alpha,:inside,:centered,:rotate,:text_size,:text_color,:dashed,:dash_length]
|
1249
|
+
#
|
1250
|
+
# [false] (true / false) whether your guides should appear in front of columns or behind them
|
1251
|
+
#
|
1252
|
+
attr_accessor :behind
|
1253
|
+
|
1254
|
+
#
|
1255
|
+
# (number) value at which guide should be placed
|
1256
|
+
#
|
1257
|
+
attr_accessor :start_value
|
1258
|
+
|
1259
|
+
#
|
1260
|
+
# (number) if you set value here too, another quide will be drawn. If you set fill alpha > 0, then the area between these quides will be filled with color
|
1261
|
+
#
|
1262
|
+
attr_accessor :end_value
|
1263
|
+
|
1264
|
+
#
|
1265
|
+
# (string) text which will be displayed near the guide
|
1266
|
+
#
|
1267
|
+
attr_accessor :title
|
1268
|
+
|
1269
|
+
#
|
1270
|
+
# [0] (Number) width of a guide line (0 for hairline)
|
1271
|
+
#
|
1272
|
+
attr_accessor :width
|
1273
|
+
|
1274
|
+
#
|
1275
|
+
# [#000000] (hex color code) color of guide line
|
1276
|
+
#
|
1277
|
+
attr_accessor :color
|
1278
|
+
|
1279
|
+
#
|
1280
|
+
# [100] (0 - 100) opacity of guide line
|
1281
|
+
#
|
1282
|
+
attr_accessor :alpha
|
1283
|
+
|
1284
|
+
#
|
1285
|
+
# [guide.color] (hex color code) fill color. If not defined, color of a guide will be used. Separate color codes with comas for gradient
|
1286
|
+
#
|
1287
|
+
attr_accessor :fill_color
|
1288
|
+
|
1289
|
+
#
|
1290
|
+
# [0] (0 - 100) opacity of a fill
|
1291
|
+
#
|
1292
|
+
attr_accessor :fill_alpha
|
1293
|
+
|
1294
|
+
#
|
1295
|
+
# [values.value.inside] whether to place title inside plot area
|
1296
|
+
#
|
1297
|
+
attr_accessor :inside
|
1298
|
+
|
1299
|
+
#
|
1300
|
+
# [true] (true / false) if you have start and end values defined, title can be placed in the middle between these values. If false, it will be placed near start_value
|
1301
|
+
#
|
1302
|
+
attr_accessor :centered
|
1303
|
+
|
1304
|
+
#
|
1305
|
+
# [values.value.rotate] (0 - 90) angle of rotation of title.
|
1306
|
+
#
|
1307
|
+
attr_accessor :rotate
|
1308
|
+
|
1309
|
+
#
|
1310
|
+
# [values.value.text_size] (Number)
|
1311
|
+
#
|
1312
|
+
attr_accessor :text_size
|
1313
|
+
|
1314
|
+
#
|
1315
|
+
# [values.value.color] (hex color code)
|
1316
|
+
#
|
1317
|
+
attr_accessor :text_color
|
1318
|
+
|
1319
|
+
#
|
1320
|
+
# [false] (true / false)
|
1321
|
+
#
|
1322
|
+
attr_accessor :dashed
|
1323
|
+
|
1324
|
+
#
|
1325
|
+
# [5] (Number)
|
1326
|
+
#
|
1327
|
+
attr_accessor :dash_length
|
1328
|
+
end
|
1329
|
+
end
|
1330
|
+
end
|
1331
|
+
end
|
1332
|
+
end
|