ambling 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,83 @@
1
+ # Generates chart object tag with given url to fetch the xml data.
2
+ # See README for more information
3
+
4
+ module Ambling #:nodoc
5
+ module Helper #:nodoc
6
+ class AmblingHelperError < StandardError #:nodoc
7
+ end
8
+
9
+ CHART_PATH = "/amcharts" unless defined? CHART_PATH
10
+
11
+ # Generates chart object tag with given url to fetch the xml data.
12
+ # See Ambling for examples
13
+ # Chart Options:
14
+ # * <tt>:width</tt> - The width of the chart
15
+ # * <tt>:height</tt> - The height of the chart
16
+ # * <tt>:swf_path</tt> - The path that contains the chart.swf. Defaults to /amcharts
17
+ # * <tt>:flash_version</tt> - Supported flash version. Defaults to 8
18
+ # * <tt>:background_color</tt> - The chart background color. Defaults to '#FFFFFF'
19
+ # * <tt>:preloader_color</tt> - The color of the preloading text. Defaults to '#000000'
20
+ # * <tt>:express_install</tt> - Use the swfobject express install if the browser does not have flash installed. Defaults to true
21
+ # * <tt>:id</tt> - The id of the DOM element that will be replaced
22
+ # * <tt>:settings_file</tt> - The path to the xml settings file (could be url)
23
+ # * <tt>:chart_settings</tt> - Inline xml settings. Use one of settings_file and chart_settings
24
+ # * <tt>:swf_params</tt> - Hash of params to be set on SWFObject (with so.addParam()).
25
+ # * <tt>:additional_chart_settings</tt> - More inline xml settings.
26
+ # * <tt>:data_file</tt> - The path to the xml data file (could be url)
27
+ # * <tt>:chart_data</tt> - Inline xml data. Use one of data_file and chart_data
28
+ def ambling_chart(chart_type, chart_options = {}, &block)
29
+ options = { :width => "400",
30
+ :height => "300",
31
+ :swf_path => CHART_PATH,
32
+ :flash_version => "8",
33
+ :background_color => "#FFFFFF",
34
+ :preloader_color => "#000000",
35
+ :express_install => true,
36
+ :id => "ambling_chart"
37
+ }.merge!(chart_options)
38
+ script = "var so = new SWFObject('#{options[:swf_path]}/am#{chart_type}.swf', " +
39
+ "'swf_#{options[:id]}', '#{options[:width]}', '#{options[:height]}', " +
40
+ "'#{options[:flash_version]}', '#{options[:background_color]}');"
41
+ script << "so.addVariable('path', '#{options[:swf_path]}/');"
42
+ script << "so.useExpressInstall('#{options[:swf_path]}/expressinstall.swf');" if options[:express_install]
43
+
44
+ script << add_variable(options, :settings_file, true)
45
+ script << add_variable(options, :chart_settings)
46
+ script << add_variable(options, :chart_id) # this is needed for controlling charts with JS
47
+ script << add_variable(options, :additional_chart_settings)
48
+
49
+ script << add_variable(options, :data_file, true)
50
+ script << add_variable(options, :chart_data)
51
+
52
+ script << add_variable(options, :preloader_color)
53
+
54
+ script << add_swf_params(options, :swf_params, true)
55
+
56
+ script << "so.write('#{options[:id]}');"
57
+ html = yield
58
+ content_tag('div', html, :id => options[:id]) + javascript_tag(script)
59
+ end
60
+
61
+ private
62
+
63
+ # Add variable to swfobject
64
+ def add_variable(options, key, escape=false)
65
+ return "" unless options[key]
66
+ stresc = options[key].gsub('"', "%22")
67
+ val = escape ? "escape('#{stresc}')" : "'#{stresc}'"
68
+ "so.addVariable('#{key}', #{val});"
69
+ end
70
+
71
+ # Add parameters in params[key] to SWFObject
72
+ def add_swf_params(options, key, escape=false)
73
+ return "" unless options[key]
74
+ res = ""
75
+ options[key].each_pair do |key, val|
76
+ stresc = val.gsub('"', "%22")
77
+ val = escape ? "escape('#{stresc}')" : "'#{stresc}'"
78
+ res << "so.addParam('#{key}', #{val});"
79
+ end
80
+ res
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,54 @@
1
+ $:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
2
+ $:.unshift(File.dirname(__FILE__) + '/../lib')
3
+
4
+ require 'rubygems'
5
+ require 'test/unit'
6
+ require 'ambling'
7
+ require 'test_helper'
8
+
9
+ class BaseTest < Test::Unit::TestCase
10
+ include TestHelper
11
+
12
+ def setup
13
+ super
14
+ @settings_hash = {:type => 'column', :column => {:type => 'atype', :width => '*'}}
15
+ @settings = Ambling::Column::Settings.new @settings_hash
16
+
17
+ @advanced_settings = read_and_strip_xml_file "advanced_settings.xml"
18
+
19
+ end
20
+
21
+ def test_to_xml
22
+ assert_equal "<settings><type>column</type><column><type>atype</type><width>*</width></column></settings>",
23
+ @settings.to_xml
24
+
25
+ assert_equal "<column><type>column</type></column>",
26
+ Ambling::Column::Settings::Column.new(:type => 'column').to_xml
27
+
28
+ column_settings = Ambling::Column::Settings.new(
29
+ :column => {
30
+ :type => "stacked", :width => 90, :data_labels => "{total}"
31
+ },
32
+ :grid => {
33
+ :category => {:alpha => 0}, :value => {:alpha => 10}
34
+ },
35
+ :values => {
36
+ :category => {:enabled => false}
37
+ },
38
+ :plot_area => {
39
+ :margins => {:left => 40, :top => 40, :right => 200, :bottom => 100}
40
+ },
41
+ :legend => {
42
+ :enabled => true, :x => 150, :y => 100, :width => 80, :border_alpha => 100, :max_columns => 1, :text_size => 8
43
+ },
44
+ :labels => {
45
+ :label => [
46
+ {:x => 20, :y => 5, :text => "<![CDATA[<b>Bold Label</b>]]>",
47
+ :text_size => 16, :text_color => '#A0A0A0'},
48
+ {:x => 180, :y => 5, :text => "Plain"}
49
+ ]
50
+ }
51
+ )
52
+ assert_equal @advanced_settings, column_settings.to_xml
53
+ end
54
+ end
@@ -0,0 +1,82 @@
1
+ $:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
2
+ $:.unshift(File.dirname(__FILE__) + '/../lib')
3
+
4
+ require 'rubygems'
5
+ require 'test/unit/xml'
6
+ require 'ambling'
7
+ require 'test_helper'
8
+
9
+ class DataTest < Test::Unit::TestCase
10
+ include TestHelper
11
+
12
+ def setup
13
+ super
14
+ @simple_chart_xml = read_and_strip_xml_file "simple_chart_data.xml"
15
+ @advanced_chart_xml = read_and_strip_xml_file "advanced_chart_data.xml"
16
+ @simple_pie_xml = read_and_strip_xml_file "simple_pie_data.xml"
17
+ end
18
+
19
+
20
+ def test_line_column_chart_to_xml
21
+ simple_chart = Ambling::Data::LineChart.new
22
+ simple_chart.message = "Test Broadcast"
23
+ simple_chart.series = [10,20,30]
24
+ simple_chart.graphs << Ambling::Data::LineGraph.new([100,200,300])
25
+
26
+ assert_xml_equal @simple_chart_xml, simple_chart.to_xml,
27
+ "Expected |#{@simple_chart_xml}| but was |#{simple_chart.to_xml}|"
28
+
29
+ simple_chart = Ambling::Data::ColumnChart.new
30
+ simple_chart.message = Ambling::Data::Message.new "Test Broadcast"
31
+ simple_chart.series.values << Ambling::Data::Value.new(10, :xid => 1)
32
+ simple_chart.series << 20
33
+ simple_chart.series.push Ambling::Data::Value.new(30, :xid => 3)
34
+
35
+ graph = Ambling::Data::ColumnGraph.new
36
+ graph.values << Ambling::Data::Value.new(100, :xid => 1)
37
+ graph << 200
38
+ graph << Ambling::Data::Value.new(300, :xid => 3)
39
+
40
+ simple_chart.graphs << graph
41
+
42
+ assert_xml_equal @simple_chart_xml, simple_chart.to_xml,
43
+ "Expected |#{@simple_chart_xml}| but was |#{simple_chart.to_xml}|"
44
+
45
+ advanced_chart = Ambling::Data::LineChart.new
46
+ advanced_chart.message = Ambling::Data::Message.new "Advanced Broadcast", {:bg_color => '#CCCCCC'}
47
+
48
+ advanced_chart.series << Ambling::Data::Value.new(1, :xid => 100, :bg_color => '#000000')
49
+ advanced_chart.series << Ambling::Data::Value.new(2, :xid => 101, :bg_color => '#FFFFFF')
50
+
51
+ advanced_chart.graphs << Ambling::Data::LineGraph.new([], :gid => "test_gid", :title => "test_title")
52
+ advanced_chart.graphs.last << Ambling::Data::Value.new(1000, :xid => 1, :color => '#AAAAAA', :url => "http://yp.to")
53
+ advanced_chart.graphs.last << Ambling::Data::Value.new(2000, :xid => 2, :color => '#BBBBBB', :start => 5)
54
+
55
+ # puts advanced_chart.to_xml
56
+
57
+ assert_xml_equal @advanced_chart_xml, advanced_chart.to_xml,
58
+ "Expected |#{@advanced_chart_xml}| but was |#{advanced_chart.to_xml}|"
59
+
60
+ end
61
+
62
+ def test_pie_to_xml
63
+ simple_pie = Ambling::Data::Pie.new
64
+ simple_pie.message = "Pie Broadcast"
65
+ simple_pie << Ambling::Data::Slice.new(50, :title => "One Slice")
66
+ simple_pie.slices << Ambling::Data::Slice.new(25, :title => "Two Slice", :url => "http://two.foo")
67
+
68
+ assert_xml_equal @simple_pie_xml, simple_pie.to_xml,
69
+ "Expected |#{@simple_pie_xml}| but was |#{simple_pie.to_xml}|"
70
+ end
71
+
72
+ def test_xy_to_xml
73
+ simple_xy = Ambling::Data::XyChart.new
74
+ simple_xy.graphs << Ambling::Data::XyGraph.new
75
+ simple_xy.graphs.last << Ambling::Data::Point.new(:x => 1, :y => 10, :value => 100)
76
+ simple_xy.graphs.last << Ambling::Data::Point.new(:x => 2, :y => 20, :value => 200)
77
+
78
+ assert_xml_equal @simple_xy_xml, simple_xy.to_xml,
79
+ "Expected |#{@simple_xy_xml}| but was |#{simple_xy.to_xml}|"
80
+ end
81
+
82
+ end
@@ -0,0 +1,98 @@
1
+ $:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
2
+ $:.unshift(File.dirname(__FILE__) + '/../lib')
3
+
4
+ require 'test/unit'
5
+ require 'rubygems'
6
+ require 'ambling/utils'
7
+
8
+ class GeneratorTest < Test::Unit::TestCase
9
+
10
+ def setup
11
+ begin
12
+ Ambling::Column::Settings
13
+ rescue
14
+ g = Ambling::Utils::SettingsGenerator.new
15
+ Object.module_eval g.generate(:column, File.read(File.join(File.dirname(__FILE__), "xmls", "simple.xml")))
16
+ end
17
+
18
+ @settings_hash = {:one => 111, :subsettings => {:type => 'atype', :width => '*'},
19
+ :graphs => {:graph => {:gid => 1, :type => 'column'}}}
20
+ @settings = Ambling::Column::Settings.new @settings_hash
21
+ end
22
+
23
+ def test_settings_generator
24
+ const = Ambling::Column::Settings
25
+ assert_not_nil const
26
+ top_attrs = const.const_get :VALUES
27
+ assert_not_nil top_attrs
28
+ assert_equal [:one, :blank, :subsettings, :graphs], top_attrs
29
+ subattrs = const.const_get :ATTRIBUTES rescue nil
30
+ assert_nil subattrs
31
+
32
+ inst = const.new
33
+ assert inst.respond_to?(:to_xml)
34
+ assert inst.respond_to?(:build_xml)
35
+
36
+ subconst = const.const_get :Subsettings
37
+ assert_not_nil subconst
38
+ subvalues = subconst.const_get :VALUES
39
+ assert_not_nil subvalues
40
+ assert_equal [:type, :width], subvalues
41
+ subattrs = subconst.const_get :ATTRIBUTES rescue nil
42
+ assert_nil subattrs
43
+
44
+ subinst = subconst.new
45
+ assert subinst.respond_to?(:to_xml)
46
+ assert subinst.respond_to?(:build_xml)
47
+
48
+ graphs = const.const_get :Graphs
49
+ assert_not_nil graphs
50
+ subvalues = graphs.const_get :VALUES
51
+ assert_not_nil subvalues
52
+ assert_equal [:graph], subvalues
53
+
54
+ subattrs = graphs.const_get :ATTRIBUTES rescue nil
55
+ assert_nil subattrs
56
+
57
+ graph = graphs.const_get :Graph
58
+ assert_not_nil graph
59
+ subvalues = graph.const_get :VALUES
60
+ assert_not_nil subvalues
61
+ assert_equal [:type, :title], subvalues
62
+
63
+ subattrs = graph.const_get :ATTRIBUTES
64
+ assert_not_nil subattrs
65
+ assert_equal [:gid], subattrs
66
+
67
+ subinst = graph.new
68
+ assert subinst.respond_to?(:to_xml)
69
+ assert subinst.respond_to?(:build_xml)
70
+
71
+
72
+ end
73
+
74
+ def test_initialize
75
+ assert_equal @settings_hash[:one], @settings.one
76
+ assert_nil @settings.blank
77
+
78
+ assert_equal @settings_hash[:subsettings][:type], @settings.subsettings.type
79
+ assert_equal @settings_hash[:subsettings][:width], @settings.subsettings.width
80
+ assert_equal @settings_hash[:graphs][:graph][:gid], @settings.graphs.graph.gid
81
+ assert_equal @settings_hash[:graphs][:graph][:type], @settings.graphs.graph.type
82
+
83
+ begin
84
+ Ambling::Column::Settings.new(:bogus => 1)
85
+ fail "Bogus variable initialization!"
86
+ rescue NoMethodError
87
+ # all is well
88
+ end
89
+
90
+ begin
91
+ Ambling::Column::Settings.new(:one => 1, :bogus_subsettings => {:type => 1})
92
+ fail "Bogus subsetting initialization!"
93
+ rescue NameError
94
+ # all is well
95
+ end
96
+ end
97
+
98
+ end
@@ -0,0 +1,7 @@
1
+ module TestHelper
2
+ # UGH! test/unit/xml can't handle a newline in the file
3
+ # I tried REXML::Document.new(source, :compress_whitespace => :all) but that didn't work either
4
+ def read_and_strip_xml_file(filename)
5
+ File.read(File.join(File.dirname(__FILE__), "xmls", filename)).gsub(/>\s+</,"><")
6
+ end
7
+ end
@@ -0,0 +1,13 @@
1
+ <chart>
2
+ <message bg_color="#CCCCCC"><![CDATA[Advanced Broadcast]]></message>
3
+ <series>
4
+ <value xid="100" bg_color="#000000">1</value>
5
+ <value xid="101" bg_color="#FFFFFF">2</value>
6
+ </series>
7
+ <graphs>
8
+ <graph gid="test_gid" title="test_title">
9
+ <value xid="1" color="#AAAAAA" url="http://yp.to">1000</value>
10
+ <value xid="2" color="#BBBBBB" start="5">2000</value>
11
+ </graph>
12
+ </graphs>
13
+ </chart>
@@ -0,0 +1,51 @@
1
+ <settings>
2
+ <column>
3
+ <type>stacked</type>
4
+ <width>90</width>
5
+ <data_labels>{total}</data_labels>
6
+ </column>
7
+ <plot_area>
8
+ <margins>
9
+ <left>40</left>
10
+ <top>40</top>
11
+ <right>200</right>
12
+ <bottom>100</bottom>
13
+ </margins>
14
+ </plot_area>
15
+ <grid>
16
+ <category>
17
+ <alpha>0</alpha>
18
+ </category>
19
+ <value>
20
+ <alpha>10</alpha>
21
+ </value>
22
+ </grid>
23
+ <values>
24
+ <category>
25
+ <enabled>false</enabled>
26
+ </category>
27
+ </values>
28
+ <legend>
29
+ <enabled>true</enabled>
30
+ <x>150</x>
31
+ <y>100</y>
32
+ <width>80</width>
33
+ <max_columns>1</max_columns>
34
+ <border_alpha>100</border_alpha>
35
+ <text_size>8</text_size>
36
+ </legend>
37
+ <labels>
38
+ <label>
39
+ <x>20</x>
40
+ <y>5</y>
41
+ <text_color>#A0A0A0</text_color>
42
+ <text_size>16</text_size>
43
+ <text>&lt;![CDATA[&lt;b&gt;Bold Label&lt;/b&gt;]]&gt;</text>
44
+ </label>
45
+ <label>
46
+ <x>180</x>
47
+ <y>5</y>
48
+ <text>Plain</text>
49
+ </label>
50
+ </labels>
51
+ </settings>
@@ -0,0 +1,328 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!-- Value between [] brackets, for example [#FFFFFF] shows default value which is used if this parameter is not set -->
3
+ <!-- This means, that if you are happy with this value, you can delete this line at all and reduce file size -->
4
+ <!-- value or explanation between () brackets shows the range or type of values you should use for this parameter -->
5
+ <!-- the top left corner has coordinates x = 0, y = 0 -->
6
+ <!-- "!" before x or y position (for example: <x>!20</x>) means that the coordinate will be calculated from the right side or the bottom -->
7
+ <settings>
8
+ <type>column</type> <!-- [column] (column / bar) -->
9
+ <data_type>xml</data_type> <!-- [xml] (xml / csv) -->
10
+ <csv_separator></csv_separator> <!-- [;] (string) csv file data separator (you need it only if you are using csv file for your data) -->
11
+ <skip_rows></skip_rows> <!-- [0] (Number) if you are using csv data type, you can set the number of rows which should be skipped here -->
12
+ <font>Tahoma</font> <!-- [Arial] (font name) use device fonts, such as Arial, Times New Roman, Tahoma, Verdana... -->
13
+ <text_size></text_size> <!-- [11] (Number) text size of all texts. Every text size can be set individually in the settings below -->
14
+ <text_color></text_color> <!-- [#000000] (hex color code) main text color. Every text color can be set individually in the settings below-->
15
+ <decimals_separator></decimals_separator> <!-- [,] (string) decimal separator. Note, that this is for displaying data only. Decimals in data xml file must be separated with a dot -->
16
+ <thousands_separator></thousands_separator> <!-- [ ] (string) thousand separator. use "none" if you don't want to separate -->
17
+ <digits_after_decimal></digits_after_decimal> <!-- [] (Number) if your value has less digits after decimal then is set here, zeroes will be added -->
18
+ <redraw></redraw> <!-- [false] (true / false) if your chart's width or height is set in percents, and redraw is set to true, the chart will be redrawn then screen size changes -->
19
+ <!-- this function is beta, be careful. Legend, buttons labels will not be repositioned if you set your x and y values for these objects -->
20
+ <reload_data_interval></reload_data_interval> <!-- [0] (Number) how often data should be reloaded (time in seconds) -->
21
+ <preloader_on_reload></preloader_on_reload> <!-- [false] (true / false) Whether to show preloaded when data or settings are reloaded -->
22
+ <add_time_stamp></add_time_stamp> <!-- [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 -->
23
+ <precision></precision> <!-- [2] (Number) shows how many numbers should be shown after comma for calculated values (percents) -->
24
+ <depth>0</depth> <!-- [0] (Number) the depth of chart and columns (for 3D effect) -->
25
+ <angle>0</angle> <!-- [30] (0 - 90) angle of chart area and columns (for 3D effect) -->
26
+ <colors></colors> <!-- [#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 -->
27
+
28
+
29
+ <column>
30
+ <type></type> <!-- [clustered] (clustered, stacked, 100% stacked, 3d column) -->
31
+ <width>85</width> <!-- [80] (0 - 100) width of column (in percents) -->
32
+ <spacing>0</spacing> <!-- [5] (Number) space between columns of one category axis value, in pixels. Negative values can be used. -->
33
+ <grow_time>3</grow_time> <!-- [0] (Number) grow time in seconds. Leave 0 to appear instantly -->
34
+ <grow_effect></grow_effect> <!-- [elastic] (elastic, regular, strong) -->
35
+ <sequenced_grow>true</sequenced_grow> <!-- [false] (true / false) whether columns should grow at the same time or one after another -->
36
+ <alpha></alpha> <!-- [100] (Number) alpha of all columns -->
37
+ <border_color></border_color> <!-- [#FFFFFF] (hex color code) -->
38
+ <border_alpha></border_alpha> <!-- [0] (Number) -->
39
+ <data_labels>
40
+ <![CDATA[]]> <!-- [] ({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. -->
41
+ </data_labels>
42
+ <data_labels_text_color></data_labels_text_color> <!-- [text_color] (hex color code) -->
43
+ <data_labels_text_size></data_labels_text_size> <!-- [text_size] (Number) -->
44
+ <data_labels_position></data_labels_position> <!-- [] (inside, outside, above). This setting is only for clustered chart. -->
45
+ <!-- if you set "above" for column chart, the data label will be displayed inside column, rotated by 90 degrees -->
46
+ <balloon_text>
47
+ <![CDATA[]]> <!-- [] ({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. -->
48
+ </balloon_text>
49
+ <link_target></link_target> <!-- [] (_blank, _top ...) -->
50
+ <gradient></gradient> <!-- [vertical] (horizontal / vertical) Direction of column gradient. Gradient colors are defined in graph settings below. -->
51
+ <bullet_offset></bullet_offset> <!-- [0] (Number) distance from column / bar to the bullet -->
52
+ <hover_brightness>30</hover_brightness> <!-- [0] (from -255 to 255) The column may darken/lighten when the use rolls over it. The intensity may be set here -->
53
+ </column>
54
+
55
+ <line> <!-- Here are general settings for "line" graph type. You can set most of these settings for individual lines in graph settings below -->
56
+ <connect></connect> <!-- [false] (true / false) whether to connect points if data is missing -->
57
+ <width></width> <!-- [2] (Number) line width -->
58
+ <alpha></alpha> <!-- [100] (Number) line alpha -->
59
+ <fill_alpha></fill_alpha> <!-- [0] (Number) fill alpha -->
60
+ <bullet></bullet> <!-- [] (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 -->
61
+ <bullet_size></bullet_size> <!-- [8] (Number) bullet size -->
62
+ <data_labels>
63
+ <![CDATA[]]> <!-- [] ({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. -->
64
+ </data_labels>
65
+ <data_labels_text_color></data_labels_text_color> <!-- [text_color] (hex color code) -->
66
+ <data_labels_text_size></data_labels_text_size> <!-- [text_size] (Number) -->
67
+ <balloon_text>
68
+ <![CDATA[]]> <!-- [] use the same formatting rules as for data labels -->
69
+ </balloon_text>
70
+ <link_target></link_target> <!-- [] (_blank, _top ...) -->
71
+ </line>
72
+
73
+ <background> <!-- BACKGROUND -->
74
+ <color></color> <!-- [#FFFFFF] (hex color code) Separate color codes with comas for gradient -->
75
+ <alpha></alpha> <!-- [0] (0 - 100) use 0 if you are using custom swf or jpg for background -->
76
+ <border_color></border_color> <!-- [#000000] (hex color code) -->
77
+ <border_alpha>15</border_alpha> <!-- [0] (0 - 100) -->
78
+ <file></file> <!-- [] (filename) swf or jpg file of a background. Do not use progressive jpg file, it will be not visible with flash player 7 -->
79
+ <!-- The chart will look for this file in "path" folder ("path" is set in HTML) -->
80
+ </background>
81
+
82
+ <plot_area> <!-- PLOT AREA (the area between axes) -->
83
+ <color></color> <!-- [#FFFFFF](hex color code) Separate color codes with comas for gradient -->
84
+ <alpha></alpha> <!-- [0] (0 - 100) if you want it to be different than background color, use bigger than 0 value -->
85
+ <border_color></border_color> <!-- [#000000] (hex color code) -->
86
+ <border_alpha></border_alpha> <!-- [0] (0 - 100) -->
87
+ <margins> <!-- plot area margins -->
88
+ <left>70</left> <!-- [60](Number) -->
89
+ <top>60</top> <!-- [60](Number) -->
90
+ <right>50</right> <!-- [60](Number) -->
91
+ <bottom>80</bottom> <!-- [80](Number) -->
92
+ </margins>
93
+ </plot_area>
94
+
95
+ <grid> <!-- GRID -->
96
+ <category> <!-- category axis grid -->
97
+ <color></color> <!-- [#000000] (hex color code) -->
98
+ <alpha>5</alpha> <!-- [15] (0 - 100) -->
99
+ <dashed></dashed> <!-- [false](true / false) -->
100
+ <dash_length></dash_length> <!-- [5] (Number) -->
101
+ </category>
102
+ <value> <!-- value axis grid -->
103
+ <color></color> <!-- [#000000] (hex color code) -->
104
+ <alpha>0</alpha> <!-- [15] (0 - 100) -->
105
+ <dashed></dashed> <!-- [false] (true / false) -->
106
+ <dash_length></dash_length> <!-- [5] (Number) -->
107
+ <approx_count></approx_count> <!-- [10] (Number) approximate number of gridlines -->
108
+ <fill_color>000000</fill_color> <!-- [#FFFFFF] (hex color code) every second area between gridlines will be filled with this color (you will need to set fill_alpha > 0) -->
109
+ <fill_alpha>5</fill_alpha> <!-- [0] (0 - 100) opacity of fill -->
110
+ </value>
111
+ </grid>
112
+
113
+ <values> <!-- VALUES -->
114
+ <category> <!-- category axis -->
115
+ <enabled></enabled> <!-- [true] (true / false) -->
116
+ <frequency>3</frequency> <!-- [1] (Number) how often values should be placed -->
117
+ <start_from></start_from> <!-- [1] (Number) you can set series from which category values will be displayed -->
118
+ <rotate>45</rotate> <!-- [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 -->
119
+ <color></color> <!-- [text_color] (hex color code) -->
120
+ <text_size></text_size> <!-- [text_size] (Number) -->
121
+ <inside></inside> <!-- [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) -->
122
+ </category>
123
+ <value> <!-- value axis -->
124
+ <enabled>true</enabled> <!-- [true] (true / false) -->
125
+ <reverse></reverse> <!-- [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 -->
126
+ <min>0</min> <!-- [] (Number) minimum value of this axis. If empty, this value will be calculated automatically. -->
127
+ <max></max> <!-- [] (Number) maximum value of this axis. If empty, this value will be calculated automatically -->
128
+ <strict_min_max></strict_min_max> <!-- [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. -->
129
+ <frequency></frequency> <!-- [1] (Number) how often values should be placed, 1 - near every gridline, 2 - near every second gridline... -->
130
+ <rotate></rotate> <!-- [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 -->
131
+ <skip_first></skip_first> <!-- [true] (true / false) to skip or not first value -->
132
+ <skip_last></skip_last> <!-- [false] (true / false) to skip or not last value -->
133
+ <color></color> <!-- [text_color] (hex color code) -->
134
+ <text_size></text_size> <!-- [text_size] (Number) -->
135
+ <unit></unit> <!-- [] (text) -->
136
+ <unit_position></unit_position> <!-- [right] (right / left) -->
137
+ <integers_only></integers_only> <!-- [false] (true / false) if set to true, values with decimals will be omitted -->
138
+ <inside></inside> <!-- [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) -->
139
+ </value>
140
+ </values>
141
+
142
+ <axes> <!-- axes -->
143
+ <category> <!-- category axis -->
144
+ <color></color> <!-- [#000000] (hex color code) -->
145
+ <alpha></alpha> <!-- [100] (0 - 100) -->
146
+ <width>1</width> <!-- [2] (Number) line width, 0 for hairline -->
147
+ <tick_length></tick_length> <!-- [7] (Number) -->
148
+ </category>
149
+ <value> <!-- value axis -->
150
+ <color></color> <!-- [#000000] (hex color code) -->
151
+ <alpha></alpha> <!-- [100] (0 - 100) -->
152
+ <width>1</width> <!-- [2] (Number) line width, 0 for hairline -->
153
+ <tick_length></tick_length> <!-- [7] (Number) -->
154
+ <logarithmic></logarithmic> <!-- [false] (true / false) If set to true, this axis will use logarithmic scale instead of linear -->
155
+ </value>
156
+ </axes>
157
+
158
+ <balloon> <!-- BALLOON -->
159
+ <enabled></enabled> <!-- [true] (true / false) -->
160
+ <color></color> <!-- [] (hex color code) balloon background color. If empty, slightly darker then current column color will be used -->
161
+ <alpha>85</alpha> <!-- [100] (0 - 100) -->
162
+ <text_color></text_color> <!-- [#FFFFFF] (hex color code) -->
163
+ <text_size></text_size> <!-- [text_size] (Number) -->
164
+ <max_width></max_width> <!-- [220] (Number) The maximum width of a balloon -->
165
+ <corner_radius></corner_radius> <!-- [0] (Number) Corner radius of a balloon. If you set it > 0, the balloon will not display arrow -->
166
+ <border_width></border_width> <!-- [0] (Number) -->
167
+ <border_alpha></border_alpha> <!-- [balloon.alpha] (Number) -->
168
+ <border_color></border_color> <!-- [balloon.color] (hex color code) -->
169
+ </balloon>
170
+
171
+ <legend> <!-- LEGEND -->
172
+ <enabled>false</enabled> <!-- [true] (true / false) -->
173
+ <x></x> <!-- [] (Number / Number% / !Number) if empty, will be equal to left margin -->
174
+ <y></y> <!-- [] (Number / Number% / !Number) if empty, will be below plot area -->
175
+ <width></width> <!-- [] (Number / Number%) if empty, will be equal to plot area width -->
176
+ <max_columns></max_columns> <!-- [] (Number) the maximum number of columns in the legend -->
177
+ <color></color> <!-- [#FFFFFF] (hex color code) background color. Separate color codes with comas for gradient -->
178
+ <alpha></alpha> <!-- [0] (0 - 100) background alpha -->
179
+ <border_color></border_color> <!-- [#000000] (hex color code) border color -->
180
+ <border_alpha></border_alpha> <!-- [0] (0 - 100) border alpha -->
181
+ <text_color></text_color> <!-- [text_color] (hex color code) -->
182
+ <text_size></text_size> <!-- [text_size] (Number) -->
183
+ <spacing></spacing> <!-- [10] (Number) vertical and horizontal gap between legend entries -->
184
+ <margins></margins> <!-- [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) -->
185
+ <reverse_order></reverse_order> <!-- [false] (true / false) whether to sort legend entries in a reverse order -->
186
+ <align></align> <!-- [left] (left / center / right) alignment of legend entries -->
187
+ <key> <!-- KEY (the color box near every legend entry) -->
188
+ <size></size> <!-- [16] (Number) key size-->
189
+ <border_color></border_color> <!-- [] (hex color code) leave empty if you don't want to have border -->
190
+ </key>
191
+ </legend>
192
+
193
+ <export_as_image> <!-- export_as_image feature works only on a web server -->
194
+ <file></file> <!-- [] (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) -->
195
+ <target></target> <!-- [] (_blank, _top ...) target of a window in which export file must be called -->
196
+ <x></x> <!-- [0] (Number / Number% / !Number) x position of "Collecting data" text -->
197
+ <y></y> <!-- [] (Number / Number% / !Number) y position of "Collecting data" text. If not set, will be aligned to the bottom of flash movie -->
198
+ <color></color> <!-- [#BBBB00] (hex color code) background color of "Collecting data" text -->
199
+ <alpha></alpha> <!-- [0] (0 - 100) background alpha -->
200
+ <text_color></text_color> <!-- [text_color] (hex color code) -->
201
+ <text_size></text_size> <!-- [text_size] (Number) -->
202
+ </export_as_image>
203
+
204
+ <error_messages> <!-- "error_messages" settings will be applied for all error messages except the one which is showed if settings file wasn't found -->
205
+ <enabled></enabled> <!-- [true] (true / false) -->
206
+ <x></x> <!-- [] (Number / Number% / !Number) x position of error message. If not set, will be aligned to the center -->
207
+ <y></y> <!-- [] (Number / Number% / !Number) y position of error message. If not set, will be aligned to the center -->
208
+ <color></color> <!-- [#BBBB00] (hex color code) background color of error message. Separate color codes with comas for gradient -->
209
+ <alpha></alpha> <!-- [100] (0 - 100) background alpha -->
210
+ <text_color></text_color> <!-- [#FFFFFF] (hex color code) -->
211
+ <text_size></text_size> <!-- [text_size] (Number) -->
212
+ </error_messages>
213
+
214
+ <strings>
215
+ <no_data></no_data> <!-- [No data for selected period] (text) if data is missing, this message will be displayed -->
216
+ <export_as_image></export_as_image> <!-- [Export as image] (text) text for right click menu -->
217
+ <collecting_data></collecting_data> <!-- [Collecting data] (text) this text is displayed while exporting chart to an image -->
218
+ </strings>
219
+
220
+
221
+ <context_menu> <!-- context menu allows you to controll right-click menu items. You can add custom menu items to create custom controls -->
222
+ <!-- "function_name" specifies JavaScript function which will be called when user clicks on this menu. You can pass variables, for example: function_name="alert('something')" -->
223
+ <!-- "title" sets menu item text. Do not use for title: Show all, Zoom in, Zoom out, Print, Settings... -->
224
+ <!-- you can have any number of custom menus. Uncomment the line below to enable this menu and add apropriate JS function to your html file. -->
225
+ <!-- <menu function_name="printChart" title="Print chart"></menu> -->
226
+
227
+ <default_items>
228
+ <zoom>false</zoom> <!-- [true] (true / false) to show or not flash players zoom menu -->
229
+ <print>false</print> <!-- [true] (true / false) to show or not flash players print menu -->
230
+ </default_items>
231
+ </context_menu>
232
+
233
+
234
+ <labels> <!-- LABELS -->
235
+ <!-- you can add as many labels as you want -->
236
+ <!-- labels can also be added in data xml file, using exactly the same structure like it is here -->
237
+ <label lid="0">
238
+ <x>10</x> <!-- [0] (Number / Number% / !Number) -->
239
+ <y>400</y> <!-- [0] (Number / Number% / !Number) -->
240
+ <rotate>true</rotate> <!-- [false] (true / false) -->
241
+ <width></width> <!-- [] (Number / Number%) if empty, will stretch from left to right untill label fits -->
242
+ <align>center</align> <!-- [left] (left / center / right) -->
243
+ <text_color></text_color> <!-- [text_color] (hex color code) button text color -->
244
+ <text_size></text_size> <!-- [text_size](Number) button text size -->
245
+ <text> <!-- [] (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]]>-->
246
+ <![CDATA[<b>Temperature anomaly, C (1950 - 2005)</b>]]>
247
+ </text>
248
+ </label>
249
+ <label lid="1">
250
+ <x>0</x>
251
+ <y>380</y>
252
+ <width></width>
253
+ <align>right</align>
254
+ <text_color></text_color>
255
+ <text_size>11</text_size>
256
+ <text>
257
+ <![CDATA[Source: <a href="http://www.cru.uea.ac.uk/cru/info/warming/" target="_blank"><u>Climatic Research Unit</u></a>]]>
258
+ </text>
259
+ </label>
260
+ </labels>
261
+
262
+
263
+ <graphs> <!-- GRAPHS SETTINGS. These settings can also be specified in data file, as attributes of <graph>, in this case you can delete everything from <graphs> to </graphs> (including) -->
264
+ <!-- It is recommended to have graph settings here if you don't want to mix data with other params -->
265
+ <!-- copy <graph>...</graph> (including) as many times as many graphs you have and edit settings individually -->
266
+ <!-- if graph settings are defined both here and in data file, the ones from data file are used -->
267
+ <graph gid="1"> <!-- if you are using XML data file, graph "gid" must match graph "gid" in data file -->
268
+ <type>column</type> <!-- [column] (column/line) -->
269
+ <title>Anomaly</title> <!-- [] (graph title) -->
270
+ <color>B92F2F</color> <!-- [] (hex color code) -->
271
+ <alpha></alpha> <!-- [column.alpha (line.alpha)] (0 - 100) -->
272
+ <data_labels>
273
+ <![CDATA[]]> <!-- [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. -->
274
+ </data_labels>
275
+ <gradient_fill_colors></gradient_fill_colors> <!-- [] (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. -->
276
+ <balloon_color></balloon_color> <!-- [balloon.color] (hex color code) leave empty to use the same color as graph -->
277
+ <balloon_alpha></balloon_alpha> <!-- [balloon.alpha] (0 - 100) -->
278
+ <balloon_text_color></balloon_text_color> <!-- [balloon.text_color] (hex color code) -->
279
+ <balloon_text>
280
+ <![CDATA[Anomaly in {series}: {value}C]]> <!-- [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. -->
281
+ </balloon_text>
282
+ <fill_alpha></fill_alpha> <!-- [0] (0 - 100) fill alpha (use it if you want to have area chart) -->
283
+ <width></width> <!-- [2] (Number) line width -->
284
+ <bullet></bullet> <!-- [line.bullet] (round, square, round_outlined, square_outline, round_outline, square_outlined, filename) -->
285
+ <bullet_size></bullet_size> <!-- [line.bullet_size] (Number) bullet size -->
286
+ <bullet_color></bullet_color> <!-- [] (hex color code) bullet color. If not defined, line color is used -->
287
+ <visible_in_legend></visible_in_legend> <!-- [true] (true / false) whether to show legend entry for this graph or not -->
288
+ </graph>
289
+
290
+ <graph gid="2">
291
+ <type>line</type>
292
+ <title>Smoothed</title>
293
+ <color></color>
294
+ <alpha></alpha>
295
+ <balloon_text>
296
+ <![CDATA[Anomaly in {series}: {value}C (Smoothed)]]> <!-- [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. -->
297
+ </balloon_text>
298
+ </graph>
299
+ </graphs>
300
+
301
+ <guides> <!-- guides are straight lines drawn through all plot area at a give value. Can also be filled with color -->
302
+ <max_min></max_min> <!-- [false] (true / false) whether to include guides' values when calculating min and max of a chart -->
303
+ <guide> <!-- there can be any number of quides. guides can also be set in data xml file, using the same syntax as here -->
304
+ <behind></behind> <!-- [false] (true / false) whether your guides should appear in front of columns or behind them -->
305
+ <start_value></start_value> <!-- (number) value at which guide should be placed -->
306
+ <end_value></end_value> <!-- (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 -->
307
+ <title></title> <!-- (string) text which will be displayed near the guide -->
308
+ <width></width> <!-- [0] (Number) width of a guide line (0 for hairline) -->
309
+ <color></color> <!-- [#000000] (hex color code) color of guide line -->
310
+ <alpha></alpha> <!-- [100] (0 - 100) opacity of guide line -->
311
+ <fill_color></fill_color> <!-- [guide.color] (hex color code) fill color. If not defined, color of a guide will be used. Separate color codes with comas for gradient -->
312
+ <fill_alpha></fill_alpha> <!-- [0] (0 - 100) opacity of a fill -->
313
+ <inside></inside> <!-- [values.value.inside] whether to place title inside plot area -->
314
+ <centered></centered> <!-- [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 -->
315
+ <rotate></rotate> <!-- [values.value.rotate] (0 - 90) angle of rotation of title. -->
316
+ <text_size></text_size> <!-- [values.value.text_size] (Number) -->
317
+ <text_color></text_color> <!-- [values.value.color] (hex color code) -->
318
+ <dashed></dashed> <!-- [false] (true / false) -->
319
+ <dash_length></dash_length> <!-- [5] (Number) -->
320
+ </guide>
321
+ </guides>
322
+
323
+ <!-- DATA can also be set in settings file. Just place data in CSV or XML format between <data></data> -->
324
+
325
+ <!--<data>
326
+ </data> -->
327
+
328
+ </settings>