ziya 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +4 -0
- data/Manifest.txt +127 -0
- data/README.txt +137 -0
- data/Rakefile +45 -0
- data/bin/ziyafy +51 -0
- data/charts/charts.swf +0 -0
- data/charts/charts_library/arno.swf +0 -0
- data/charts/charts_library/arst.swf +0 -0
- data/charts/charts_library/brfl.swf +0 -0
- data/charts/charts_library/brno.swf +0 -0
- data/charts/charts_library/brst.swf +0 -0
- data/charts/charts_library/cl3d.swf +0 -0
- data/charts/charts_library/clfl.swf +0 -0
- data/charts/charts_library/clno.swf +0 -0
- data/charts/charts_library/clp3.swf +0 -0
- data/charts/charts_library/cls3.swf +0 -0
- data/charts/charts_library/clst.swf +0 -0
- data/charts/charts_library/cnno.swf +0 -0
- data/charts/charts_library/lnno.swf +0 -0
- data/charts/charts_library/mxno.swf +0 -0
- data/charts/charts_library/pi3d.swf +0 -0
- data/charts/charts_library/pino.swf +0 -0
- data/charts/charts_library/pono.swf +0 -0
- data/charts/charts_library/scno.swf +0 -0
- data/charts/themes/commando/bar_chart.yml +9 -0
- data/charts/themes/commando/base_chart.yml +65 -0
- data/charts/themes/commando/column_chart.yml +13 -0
- data/charts/themes/commando/column_threed_chart.yml +25 -0
- data/charts/themes/commando/parallel_threed_column_chart.yml +17 -0
- data/charts/themes/commando/pie_chart.yml +22 -0
- data/charts/themes/commando/pie_threed_chart.yml +28 -0
- data/charts/themes/commando/polar_chart.yml +11 -0
- data/charts/themes/commando/stacked_bar_chart.yml +9 -0
- data/charts/themes/commando/stacked_column_chart.yml +14 -0
- data/charts/themes/commando/stacked_threed_column_chart.yml +17 -0
- data/charts/themes/default/bar_chart.yml +3 -0
- data/charts/themes/default/base_chart.yml +67 -0
- data/charts/themes/default/column_chart.yml +13 -0
- data/charts/themes/default/column_threed_chart.yml +25 -0
- data/charts/themes/default/parallel_threed_column_chart.yml +17 -0
- data/charts/themes/default/pie_chart.yml +29 -0
- data/charts/themes/default/pie_threed_chart.yml +28 -0
- data/charts/themes/default/polar_chart.yml +12 -0
- data/charts/themes/default/stacked_bar_chart.yml +3 -0
- data/charts/themes/default/stacked_column_chart.yml +14 -0
- data/charts/themes/default/stacked_threed_column_chart.yml +17 -0
- data/charts/themes/default/test.yml +4 -0
- data/lib/ziya.rb +100 -0
- data/lib/ziya/charts/area.rb +13 -0
- data/lib/ziya/charts/bar.rb +11 -0
- data/lib/ziya/charts/base.rb +435 -0
- data/lib/ziya/charts/candle_stick.rb +11 -0
- data/lib/ziya/charts/column.rb +11 -0
- data/lib/ziya/charts/column_threed.rb +11 -0
- data/lib/ziya/charts/floating_bar.rb +11 -0
- data/lib/ziya/charts/floating_column.rb +11 -0
- data/lib/ziya/charts/line.rb +11 -0
- data/lib/ziya/charts/mixed.rb +11 -0
- data/lib/ziya/charts/parallel_threed_column.rb +11 -0
- data/lib/ziya/charts/pie.rb +11 -0
- data/lib/ziya/charts/pie_threed.rb +11 -0
- data/lib/ziya/charts/polar.rb +11 -0
- data/lib/ziya/charts/scatter.rb +11 -0
- data/lib/ziya/charts/stacked_area.rb +11 -0
- data/lib/ziya/charts/stacked_bar.rb +11 -0
- data/lib/ziya/charts/stacked_column.rb +11 -0
- data/lib/ziya/charts/stacked_threed_column.rb +11 -0
- data/lib/ziya/components/area.rb +14 -0
- data/lib/ziya/components/axis_category.rb +69 -0
- data/lib/ziya/components/axis_ticks.rb +37 -0
- data/lib/ziya/components/axis_value.rb +59 -0
- data/lib/ziya/components/base.rb +100 -0
- data/lib/ziya/components/chart_border.rb +33 -0
- data/lib/ziya/components/chart_grid_h.rb +28 -0
- data/lib/ziya/components/chart_grid_v.rb +28 -0
- data/lib/ziya/components/chart_pref.rb +22 -0
- data/lib/ziya/components/chart_rect.rb +36 -0
- data/lib/ziya/components/chart_transition.rb +26 -0
- data/lib/ziya/components/chart_value.rb +71 -0
- data/lib/ziya/components/circle.rb +13 -0
- data/lib/ziya/components/draw.rb +45 -0
- data/lib/ziya/components/image.rb +13 -0
- data/lib/ziya/components/legend_label.rb +18 -0
- data/lib/ziya/components/legend_rect.rb +19 -0
- data/lib/ziya/components/legend_transition.rb +18 -0
- data/lib/ziya/components/line.rb +12 -0
- data/lib/ziya/components/link.rb +29 -0
- data/lib/ziya/components/link_data.rb +19 -0
- data/lib/ziya/components/live_update.rb +21 -0
- data/lib/ziya/components/rect.rb +13 -0
- data/lib/ziya/components/series_color.rb +35 -0
- data/lib/ziya/components/series_explode.rb +38 -0
- data/lib/ziya/components/series_gap.rb +18 -0
- data/lib/ziya/components/series_switch.rb +25 -0
- data/lib/ziya/components/text.rb +13 -0
- data/lib/ziya/helpers/base_helper.rb +37 -0
- data/lib/ziya/utils/logger.rb +125 -0
- data/lib/ziya/utils/text.rb +33 -0
- data/lib/ziya/version.rb +15 -0
- data/lib/ziya/ziya_helper.rb +147 -0
- data/spec/charts/base_spec.rb +120 -0
- data/spec/charts/chart_type_spec.rb +42 -0
- data/spec/components/area_spec.rb +60 -0
- data/spec/components/draw_spec.rb +33 -0
- data/spec/components/link_spec.rb +23 -0
- data/spec/components/series_color_spec.rb +40 -0
- data/spec/components/series_explode_spec.rb +40 -0
- data/spec/components/series_switch_spec.rb +19 -0
- data/spec/helpers/base_helper_spec.rb +22 -0
- data/spec/spec_helper.rb +7 -0
- data/spec/themes/default/fred.yml +6 -0
- data/spec/themes/default/line_chart.yml +6 -0
- data/spec/utils/logger_spec.rb +57 -0
- data/spec/utils/text_spec.rb +34 -0
- data/spec/ziya_helper_spec.rb +40 -0
- data/spec/ziya_spec.rb +19 -0
- data/tasks/ann.rake +76 -0
- data/tasks/annotations.rake +22 -0
- data/tasks/doc.rake +48 -0
- data/tasks/gem.rake +110 -0
- data/tasks/manifest.rake +49 -0
- data/tasks/post_load.rake +26 -0
- data/tasks/rubyforge.rake +57 -0
- data/tasks/setup.rb +227 -0
- data/tasks/spec.rake +61 -0
- data/tasks/svn.rake +44 -0
- data/tasks/test.rake +38 -0
- metadata +190 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
# Generates necessary xml for candlestick chart
|
|
3
|
+
# -----------------------------------------------------------------------------
|
|
4
|
+
module Ziya::Charts
|
|
5
|
+
class CandleStick < Base
|
|
6
|
+
def initialize( license=nil, chart_id=nil)
|
|
7
|
+
super( license, chart_id )
|
|
8
|
+
@type = "candlestick"
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
# Generates necessary xml for a StackColumn chart
|
|
3
|
+
# -----------------------------------------------------------------------------
|
|
4
|
+
module Ziya::Charts
|
|
5
|
+
class Column < Base
|
|
6
|
+
def initialize( license=nil, chart_id=nil)
|
|
7
|
+
super( license, chart_id )
|
|
8
|
+
@type = "column"
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
# Generates necessary xml for 3D column chart
|
|
3
|
+
# -----------------------------------------------------------------------------
|
|
4
|
+
module Ziya::Charts
|
|
5
|
+
class ColumnThreed < Base
|
|
6
|
+
def initialize( license=nil, chart_id=nil)
|
|
7
|
+
super( license, chart_id )
|
|
8
|
+
@type = "3d column"
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
# Generates necessary xml for floating bar chart
|
|
3
|
+
# -----------------------------------------------------------------------------
|
|
4
|
+
module Ziya::Charts
|
|
5
|
+
class FloatingBar < Base
|
|
6
|
+
def initialize( license=nil, chart_id=nil)
|
|
7
|
+
super( license, chart_id )
|
|
8
|
+
@type = "floating bar"
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
# Generates necessary xml for a floating column chart
|
|
3
|
+
# -----------------------------------------------------------------------------
|
|
4
|
+
module Ziya::Charts
|
|
5
|
+
class FloatingColumn < Base
|
|
6
|
+
def initialize( license=nil, chart_id=nil)
|
|
7
|
+
super( license, chart_id )
|
|
8
|
+
@type = "floating column"
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
# Generates necessary xml for a StackColumn chart
|
|
3
|
+
# -----------------------------------------------------------------------------
|
|
4
|
+
module Ziya::Charts
|
|
5
|
+
class Line < Base
|
|
6
|
+
def initialize( license=nil, chart_id=nil)
|
|
7
|
+
super( license, chart_id )
|
|
8
|
+
@type = "line"
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
# Generates necessary xml for mixed chart
|
|
3
|
+
# -----------------------------------------------------------------------------
|
|
4
|
+
module Ziya::Charts
|
|
5
|
+
class Mixed < Base
|
|
6
|
+
def initialize( license=nil, chart_id=nil )
|
|
7
|
+
super( license, chart_id )
|
|
8
|
+
@type = nil
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
# Generates necessary xml for parallel 3D column chart
|
|
3
|
+
# -----------------------------------------------------------------------------
|
|
4
|
+
module Ziya::Charts
|
|
5
|
+
class ParallelThreedColumn < Base
|
|
6
|
+
def initialize( license=nil, chart_id=nil)
|
|
7
|
+
super( license, chart_id )
|
|
8
|
+
@type = "parallel 3d column"
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
#
|
|
3
|
+
# -----------------------------------------------------------------------------
|
|
4
|
+
module Ziya::Charts
|
|
5
|
+
class Pie < Base
|
|
6
|
+
def initialize( license=nil, chart_id=nil)
|
|
7
|
+
super( license, chart_id )
|
|
8
|
+
@type = "pie"
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
# Generates necessary xml for 3D pie chart
|
|
3
|
+
# -----------------------------------------------------------------------------
|
|
4
|
+
module Ziya::Charts
|
|
5
|
+
class PieThreed < Base
|
|
6
|
+
def initialize( license=nil, chart_id=nil)
|
|
7
|
+
super( license, chart_id )
|
|
8
|
+
@type = "3d pie"
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
#
|
|
3
|
+
# -----------------------------------------------------------------------------
|
|
4
|
+
module Ziya::Charts
|
|
5
|
+
class Polar < Base
|
|
6
|
+
def initialize( license=nil, chart_id=nil)
|
|
7
|
+
super( license, chart_id )
|
|
8
|
+
@type = "polar"
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
# Generates necessary xml for scatter chart
|
|
3
|
+
# -----------------------------------------------------------------------------
|
|
4
|
+
module Ziya::Charts
|
|
5
|
+
class Scatter < Base
|
|
6
|
+
def initialize( license=nil, chart_id=nil)
|
|
7
|
+
super( license, chart_id )
|
|
8
|
+
@type = "scatter"
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
# Generates necessary xml for stacked area chart
|
|
3
|
+
# -----------------------------------------------------------------------------
|
|
4
|
+
module Ziya::Charts
|
|
5
|
+
class StackedArea < Base
|
|
6
|
+
def initialize( license=nil, chart_id=nil)
|
|
7
|
+
super( license, chart_id )
|
|
8
|
+
@type = "stacked area"
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
# Generates necessary xml for a stacked bar chart
|
|
3
|
+
# -----------------------------------------------------------------------------
|
|
4
|
+
module Ziya::Charts
|
|
5
|
+
class StackedBar < Base
|
|
6
|
+
def initialize( license=nil, chart_id=nil)
|
|
7
|
+
super( license, chart_id )
|
|
8
|
+
@type = "stacked bar"
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
# Generates necessary xml for a stack column chart
|
|
3
|
+
# -----------------------------------------------------------------------------
|
|
4
|
+
module Ziya::Charts
|
|
5
|
+
class StackedColumn < Base
|
|
6
|
+
def initialize( license=nil, chart_id=nil)
|
|
7
|
+
super( license, chart_id )
|
|
8
|
+
@type = "stacked column"
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
# Generates necessary xml for a stacked 3d column chart
|
|
3
|
+
# -----------------------------------------------------------------------------
|
|
4
|
+
module Ziya::Charts
|
|
5
|
+
class StackedThreedColumn < Base
|
|
6
|
+
def initialize( license=nil, chart_id=nil)
|
|
7
|
+
super( license, chart_id )
|
|
8
|
+
@type = "stacked 3d column"
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
# Defines an area on a chart. Typically used to embed links and buttons
|
|
3
|
+
#
|
|
4
|
+
# Author:: Fernand Galiana
|
|
5
|
+
# Date:: Dec 15th, 2006
|
|
6
|
+
# -----------------------------------------------------------------------------
|
|
7
|
+
require 'ziya/components/base'
|
|
8
|
+
|
|
9
|
+
module Ziya::Components
|
|
10
|
+
class Area < Base
|
|
11
|
+
has_attribute :x, :y, :width, :height, :url, :priority, :target, :text,
|
|
12
|
+
:font, :bold, :size, :color, :background_color, :alpha
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
# Sets the label attributes for the category-axis.
|
|
3
|
+
#
|
|
4
|
+
# <tt>skip</tt>: If this axis holds too many labels, the skip key allows skipping (hiding) some labels.
|
|
5
|
+
# A zero value doesn't hide any labels. If the skip value is 1, then the first label is
|
|
6
|
+
# displayed, the following label is skipped, and so on. If the skip value is 2, then the
|
|
7
|
+
# first label is displayed, the following 2 are skipped, and so on. Another way to hide
|
|
8
|
+
# labels is by passing empty strings to chart_data in place of category labels.
|
|
9
|
+
# The default is zero.
|
|
10
|
+
# <tt>font</tt>: The font used in the category-axis. See the Fonts section below.
|
|
11
|
+
# The default is Arial.
|
|
12
|
+
# <tt>bold</tt>: A boolean value that indicates whether the font is bold or not.
|
|
13
|
+
# The default is true.
|
|
14
|
+
# <tt>size</tt>: The font's size.
|
|
15
|
+
# The default font size is calculated based on the chart size.
|
|
16
|
+
# <tt>color</tt>: The font's color. This must be a string holding triple hexadecimal values representing
|
|
17
|
+
# the red, green, and blue components for a color.
|
|
18
|
+
# The default is "000000" (black).
|
|
19
|
+
# <tt>alpha</tt>: This affects the labels' transparency, only when the embedded font is used (see the Fonts
|
|
20
|
+
# section below.) Valid values are 0 (fully transparent) to 100 (fully opaque).
|
|
21
|
+
# The default is 90. To hide all labels in this axis, set the alpha to 0
|
|
22
|
+
# <tt>orientation</tt>: This affects the labels' orientation, only when the embedded font is used (see the Fonts
|
|
23
|
+
# section below.) Valid values are horizontal, diagonal_up, diagonal_down, vertical_up, and
|
|
24
|
+
# vertical_down. Polar charts also accept the value circular.
|
|
25
|
+
# The default value is horizontal.
|
|
26
|
+
# <tt>margin</tt>: This applies to area, stacked area, and line charts only. It's a boolean value that
|
|
27
|
+
# indicates whether to leave a margin on the left and right of the graph, or bump it against
|
|
28
|
+
# the left and right chart borders.
|
|
29
|
+
# The default is false (no margin.) In mixed charts, there's always a margin to algin area
|
|
30
|
+
# and line charts with column charts.
|
|
31
|
+
# <tt>min</tt>: This applies to scatter charts only, when the category-axis is calculated like the value-axis.
|
|
32
|
+
# This determines the minimum value to start this axis with.
|
|
33
|
+
# The default is calculated from the chart's data.
|
|
34
|
+
# <tt>max</tt>: This applies to scatter charts only, when the category-axis is calculated like the value-axis.
|
|
35
|
+
# This determines the maximum value to end this axis with.
|
|
36
|
+
# The default is calculated from the chart's data.
|
|
37
|
+
# <tt>steps</tt>: This applies to scatter charts only, when the category-axis is calculated like the value-axis.
|
|
38
|
+
# This determines the number of steps between the minimum and maximum values. If the minimum value
|
|
39
|
+
# is negative, and the maximum value is positive, then 'steps' is the number of steps between zero
|
|
40
|
+
# and the larger of max and absolute min.
|
|
41
|
+
# The default is 4.
|
|
42
|
+
# <tt>prefix</tt>: This applies to scatter charts only, when the category-axis is calculated like the value-axis.
|
|
43
|
+
# This determines the characters to add before the value numbers (example: $10).
|
|
44
|
+
# The default is nothing.
|
|
45
|
+
# <tt>suffix</tt>: This applies to scatter charts only, when the category-axis is calculated like the value-axis.
|
|
46
|
+
# This determines the characters to add after the value numbers (example: 10%).
|
|
47
|
+
# The default is nothing.
|
|
48
|
+
# <tt>decimals</tt>: This applies to scatter charts only, when the category-axis is calculated like the value-axis.
|
|
49
|
+
# This determines the number of decimal places to the right of the decimal point (example: 10.45).
|
|
50
|
+
# The default is zero (no decimals).
|
|
51
|
+
# <tt>decimal_char</tt>: This applies to scatter charts only, when the category-axis is calculated like the value-axis.
|
|
52
|
+
# This determines the character to use at the left of a decimal fraction (example: 1.5).
|
|
53
|
+
# The default is '.' (dot or full stop).
|
|
54
|
+
# <tt>separator</tt>: This applies to scatter charts only, when the category-axis is calculated like the value-axis.
|
|
55
|
+
# This determines the character to place between every group of thousands (example: 1,00,000).
|
|
56
|
+
# The default is nothing.
|
|
57
|
+
#
|
|
58
|
+
# See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=axis_category
|
|
59
|
+
# for additional documentation, examples and futher detail.
|
|
60
|
+
# Author:: Fernand Galiana
|
|
61
|
+
# Date:: Dec 15th, 2006
|
|
62
|
+
# -----------------------------------------------------------------------------
|
|
63
|
+
module Ziya::Components
|
|
64
|
+
class AxisCategory < Base
|
|
65
|
+
has_attribute :skip, :font, :bold, :size, :color, :alpha, :orientation,
|
|
66
|
+
:margin, :min, :max, :steps, :prefix, :suffix, :decimals,
|
|
67
|
+
:decimal_char, :separator
|
|
68
|
+
end
|
|
69
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# ------------------------------------------------------------------------------
|
|
2
|
+
# Describe the ticks configuration of the chart axis
|
|
3
|
+
#
|
|
4
|
+
# Sets the tick marks on the chart axes.
|
|
5
|
+
#
|
|
6
|
+
# <tt>value_ticks</tt>: A boolean value that indicates whether the ticks on the value axis are visible or not.
|
|
7
|
+
# The default is false.
|
|
8
|
+
# <tt>category_ticks</tt>: A boolean value that indicates whether the ticks on the category axis are visible or not.
|
|
9
|
+
# The default is true.
|
|
10
|
+
# <tt>position</tt>: A string that determines where on the axis to display the ticks. Valid values are "outside",
|
|
11
|
+
# "inside", and "centered".
|
|
12
|
+
# The default is "outside".
|
|
13
|
+
# <tt>major_thickness</tt>: The thickness of major ticks. Major ticks are those appearing with the axis labels.
|
|
14
|
+
# The default is 2 pixels.
|
|
15
|
+
# <tt>major_color</tt>: The color of major ticks. This must be a string holding triple hexadecimal values representing
|
|
16
|
+
# the red, green, and blue components for a color.
|
|
17
|
+
# The default is "000000" (black).
|
|
18
|
+
# <tt>minor_thickness</tt>: The thickness of minor ticks. Minor ticks are those appearing between major ticks.
|
|
19
|
+
# The default is 1 pixel.
|
|
20
|
+
# <tt>minor_color</tt>: The color of minor ticks. This must be a string holding triple hexadecimal values representing
|
|
21
|
+
# the red, green, and blue components for a color.
|
|
22
|
+
# The default is "000000" (black).
|
|
23
|
+
# <tt>minor_count</tt>: This applies to the value axis only. It sets the number of minor ticks between every 2 major ticks.
|
|
24
|
+
# The default is 4. The category axis displays minor ticks only where its labels get skipped.
|
|
25
|
+
#
|
|
26
|
+
# See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=axis_ticks
|
|
27
|
+
# for additional documentation, examples and futher detail.
|
|
28
|
+
#
|
|
29
|
+
# Author:: Fernand Galiana
|
|
30
|
+
# Date:: Dec 15th, 2006
|
|
31
|
+
# ------------------------------------------------------------------------------
|
|
32
|
+
module Ziya::Components
|
|
33
|
+
class AxisTicks < Base
|
|
34
|
+
has_attribute :value_ticks, :category_ticks, :position, :major_thickness,
|
|
35
|
+
:major_color, :minor_thickness, :minor_color, :minor_count
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
# Setup configuration on the chart value axis
|
|
3
|
+
#
|
|
4
|
+
# Sets the label attributes for the value-axis.
|
|
5
|
+
#
|
|
6
|
+
# <tt>min</tt>: The minimum value to start the value-axis with.
|
|
7
|
+
# The default is calculated from the chart's data. In 3D column charts, the minimum value
|
|
8
|
+
# is always zero.
|
|
9
|
+
# <tt>max</tt>: The maximum value to end the value-axis with.
|
|
10
|
+
# The default is calculated from the chart's data.
|
|
11
|
+
# <tt>steps</tt>: The number of steps between the minimum and maximum values. If the minimum value is negative,
|
|
12
|
+
# and the maximum value is positive, then 'steps' is the number of steps between zero and the
|
|
13
|
+
# larger of max and absolute min.
|
|
14
|
+
# The default is 4.
|
|
15
|
+
# <tt>prefix</tt>: The characters to add before the value numbers (example: $10).
|
|
16
|
+
# The default is nothing.
|
|
17
|
+
# <tt>suffix</tt>: The characters to add after the value numbers (example: 10%).
|
|
18
|
+
# The default is nothing.
|
|
19
|
+
# <tt>decimals</tt>: The number of decimal places to the right of the decimal point (example: 10.45).
|
|
20
|
+
# The default is zero (no decimals).
|
|
21
|
+
# <tt>decimal_char</tt>: The character to use at the left of a decimal fraction (example: 1.5).
|
|
22
|
+
# The default is '.' (dot or full stop.)
|
|
23
|
+
# <tt>separator</tt>: The character to place between every group of thousands (example: 1,00,000).
|
|
24
|
+
# The default is nothing.
|
|
25
|
+
# <tt>show_min</tt>: A boolean that indicates whether show or hide the first label in the value-axis. Hiding this
|
|
26
|
+
# first label might be necessary if it overlaps with the first label in the category axis.
|
|
27
|
+
# The default is true (show the first label).
|
|
28
|
+
# <tt>font</tt>: The font used in the value-axis.
|
|
29
|
+
# The default is Arial.
|
|
30
|
+
# <tt>bold</tt>: A boolean value that indicates whether the font is bold or not.
|
|
31
|
+
# The default is true.
|
|
32
|
+
# <tt>size</tt>: The font's size.
|
|
33
|
+
# The default font size is calculated based on the chart size.
|
|
34
|
+
# <tt>color</tt>: The font's color. This must be a string holding triple hexadecimal values representing the red,
|
|
35
|
+
# green, and blue components for a color.
|
|
36
|
+
# The default is "000000" (black).
|
|
37
|
+
# <tt>background_color</tt>: This applies to Polar charts only. It determines the labels' background color to make them visible
|
|
38
|
+
# over the graph. When omitted, axis_value labels have no background. This must be a string holding
|
|
39
|
+
# triple hexadecimal values representing the red, green, and blue components for a color.
|
|
40
|
+
# The default is omitted (no background).
|
|
41
|
+
# <tt>alpha</tt>: This affects the labels' transparency, only when the embedded font is used. Valid values are
|
|
42
|
+
# 0 (fully transparent) to 100 (fully opaque).
|
|
43
|
+
# The default is 90. To hide all labels in this axis, set the alpha to 0.
|
|
44
|
+
# <tt>orientation</tt>: This affects the labels' orientation, only when the embedded font is used. Valid values are
|
|
45
|
+
# "horizontal", "diagonal_up", "diagonal_down", "vertical_up", and "vertical_down."
|
|
46
|
+
# The default value is "horizontal".
|
|
47
|
+
#
|
|
48
|
+
# See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=axis_value
|
|
49
|
+
# for additional documentation, examples and futher detail.
|
|
50
|
+
# Author:: Fernand Galiana
|
|
51
|
+
# Date:: Dec 15th, 2006
|
|
52
|
+
# -----------------------------------------------------------------------------
|
|
53
|
+
module Ziya::Components
|
|
54
|
+
class AxisValue < Base
|
|
55
|
+
has_attribute :min, :max, :steps, :prefix, :suffix, :decimals,
|
|
56
|
+
:decimal_char, :separator, :show_min, :font, :bold,
|
|
57
|
+
:size, :color, :background_color, :alpha, :orientation
|
|
58
|
+
end
|
|
59
|
+
end
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
# Abstract class representing the base class for all chart preferences
|
|
3
|
+
# TODO Not getting parents inherited properties if defined as defaults
|
|
4
|
+
#
|
|
5
|
+
# TODO: Change attributes to be per class instance
|
|
6
|
+
#
|
|
7
|
+
# Author:: Fernand Galiana
|
|
8
|
+
# Date:: Dec 15th, 2006
|
|
9
|
+
# -----------------------------------------------------------------------------
|
|
10
|
+
module Ziya::Components
|
|
11
|
+
class Base
|
|
12
|
+
include Ziya::Utils::Text
|
|
13
|
+
|
|
14
|
+
# class methods...
|
|
15
|
+
class << self
|
|
16
|
+
# -----------------------------------------------------------------------
|
|
17
|
+
# defines attribute accessors for a given component
|
|
18
|
+
def has_attribute(*args)
|
|
19
|
+
class_name = self.to_s
|
|
20
|
+
args.each do |attribute|
|
|
21
|
+
# add the attribute to the collection making sure to create a new array if one doesn't exist
|
|
22
|
+
attributes[class_name] = [] if attributes[class_name].nil?
|
|
23
|
+
attributes[class_name] << attribute
|
|
24
|
+
# create the accessor methods for the attribute
|
|
25
|
+
unless self.instance_methods.include?(attribute.to_s) && self.instance_methods.include?("#{attribute.to_s}=")
|
|
26
|
+
self.module_eval "attr_accessor :#{attribute}"
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# -----------------------------------------------------------------------
|
|
32
|
+
# Class accessor. Retrieve class level preferences
|
|
33
|
+
def attributes
|
|
34
|
+
@attributes ||= {}
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# -------------------------------------------------------------------------
|
|
39
|
+
# merge attributes with overriden component
|
|
40
|
+
def merge( parent_attributes, force=false )
|
|
41
|
+
attributes_for(self).each do |attr|
|
|
42
|
+
unless parent_attributes.send(attr).nil?
|
|
43
|
+
send("#{attr}=", parent_attributes.send(attr))
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# -------------------------------------------------------------------------
|
|
49
|
+
# handles simple flatten operation
|
|
50
|
+
def method_missing(method, *args)
|
|
51
|
+
case method
|
|
52
|
+
when :flatten
|
|
53
|
+
xml = args.first
|
|
54
|
+
clazz = self.class.name.gsub!( /Ziya::Components::/, '' )
|
|
55
|
+
pref = underscore( clazz )
|
|
56
|
+
self.class.module_eval "xml.#{pref}( #{options_as_string} )"
|
|
57
|
+
else
|
|
58
|
+
super.method_missing(method, *args)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# -------------------------------------------------------------------------
|
|
63
|
+
# checks if a give component properties have been set.
|
|
64
|
+
# return true if one or more props have been set. False otherwise...
|
|
65
|
+
def configured?
|
|
66
|
+
!options.empty?
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# -------------------------------------------------------------------------
|
|
70
|
+
# calls all attribute methods and gather the various props into a hash
|
|
71
|
+
def options
|
|
72
|
+
options = {}
|
|
73
|
+
attributes_for(self).each do |p|
|
|
74
|
+
option = self.send(p.to_sym)
|
|
75
|
+
options[p] = option if option
|
|
76
|
+
end
|
|
77
|
+
options
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# -------------------------------------------------------------------------
|
|
81
|
+
# Turns options hash into string representation
|
|
82
|
+
def options_as_string
|
|
83
|
+
buff = []
|
|
84
|
+
opts = options
|
|
85
|
+
opts.keys.sort{ |a,b| a.to_s <=> b.to_s }.each do |k|
|
|
86
|
+
value = opts[k]
|
|
87
|
+
buff << sprintf( ":%s => '%s'", k, value.to_s ) if value
|
|
88
|
+
end
|
|
89
|
+
buff.join( "," )
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# -------------------------------------------------------------------------
|
|
93
|
+
# fetch attributes for a give component
|
|
94
|
+
def attributes_for( an_instance )
|
|
95
|
+
attrs = self.class.attributes[an_instance.class.name]
|
|
96
|
+
raise "Unable to get attributes for #{an_instance}" unless attrs
|
|
97
|
+
attrs
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|