ziya 1.0.0 → 2.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/Manifest.txt +74 -28
- data/README.txt +91 -14
- data/Rakefile +1 -1
- data/bin/ziyafy +2 -0
- data/charts/AC_RunActiveContent.js +292 -0
- data/charts/charts.swf +0 -0
- data/charts/charts_library/ar3d.swf +0 -0
- data/charts/charts_library/arno.swf +0 -0
- data/charts/charts_library/ars3.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/buno.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/full_screen.swf +0 -0
- data/charts/sliders/black.swf +0 -0
- data/charts/sliders/preview_handle_1.swf +0 -0
- data/charts/sliders/preview_handle_2.swf +0 -0
- data/fred.rb +36 -0
- data/gauges/designs/circle.yml +18 -0
- data/gauges/designs/signal.yml +14 -0
- data/gauges/designs/thermo.yml +119 -0
- data/gauges/designs/title.yml +11 -0
- data/gauges/gauge.swf +0 -0
- data/lib/ziya.rb +17 -5
- data/lib/ziya/charts/area.rb +6 -1
- data/lib/ziya/charts/area_threed.rb +16 -0
- data/lib/ziya/charts/bar.rb +8 -3
- data/lib/ziya/charts/base.rb +210 -153
- data/lib/ziya/charts/bubble.rb +18 -0
- data/lib/ziya/charts/candle_stick.rb +6 -1
- data/lib/ziya/charts/column.rb +7 -2
- data/lib/ziya/charts/column_threed.rb +6 -1
- data/lib/ziya/charts/floating_bar.rb +6 -1
- data/lib/ziya/charts/floating_column.rb +7 -2
- data/lib/ziya/charts/line.rb +7 -2
- data/lib/ziya/charts/mixed.rb +5 -0
- data/lib/ziya/charts/parallel_threed_column.rb +6 -1
- data/lib/ziya/charts/pie.rb +7 -2
- data/lib/ziya/charts/pie_threed.rb +7 -2
- data/lib/ziya/charts/polar.rb +6 -1
- data/lib/ziya/charts/scatter.rb +6 -1
- data/lib/ziya/charts/stacked_area.rb +5 -0
- data/lib/ziya/charts/stacked_bar.rb +5 -0
- data/lib/ziya/charts/stacked_column.rb +7 -2
- data/lib/ziya/charts/stacked_threed_area.rb +16 -0
- data/lib/ziya/charts/stacked_threed_column.rb +6 -1
- data/lib/ziya/components/area.rb +5 -2
- data/lib/ziya/components/axis_category.rb +8 -60
- data/lib/ziya/components/axis_ticks.rb +25 -27
- data/lib/ziya/components/axis_value.rb +5 -48
- data/lib/ziya/components/base.rb +59 -17
- data/lib/ziya/components/bevel.rb +15 -0
- data/lib/ziya/components/blur.rb +13 -0
- data/lib/ziya/components/chart_border.rb +4 -23
- data/lib/ziya/components/chart_grid_h.rb +17 -19
- data/lib/ziya/components/chart_grid_v.rb +18 -19
- data/lib/ziya/components/chart_guide.rb +16 -0
- data/lib/ziya/components/chart_label.rb +16 -0
- data/lib/ziya/components/chart_pref.rb +12 -12
- data/lib/ziya/components/chart_rect.rb +27 -26
- data/lib/ziya/components/chart_transition.rb +15 -16
- data/lib/ziya/components/circle.rb +5 -2
- data/lib/ziya/components/draw.rb +12 -11
- data/lib/ziya/components/draw_base.rb +10 -0
- data/lib/ziya/components/filter.rb +26 -0
- data/lib/ziya/components/glow.rb +14 -0
- data/lib/ziya/components/image.rb +5 -1
- data/lib/ziya/components/legend.rb +18 -0
- data/lib/ziya/components/line.rb +6 -2
- data/lib/ziya/components/link.rb +9 -9
- data/lib/ziya/components/link_data.rb +9 -10
- data/lib/ziya/components/rect.rb +7 -2
- data/lib/ziya/components/scroll.rb +26 -0
- data/lib/ziya/components/shadow.rb +14 -0
- data/lib/ziya/components/text.rb +5 -1
- data/lib/ziya/components/update.rb +19 -0
- data/lib/ziya/gauges/base.rb +172 -0
- data/lib/ziya/gauges/radial.rb +18 -0
- data/lib/ziya/gauges/signal.rb +138 -0
- data/lib/ziya/gauges/support/area.rb +13 -0
- data/lib/ziya/gauges/support/base.rb +33 -0
- data/lib/ziya/gauges/support/circle.rb +14 -0
- data/lib/ziya/gauges/support/design.rb +5 -0
- data/lib/ziya/gauges/support/image.rb +12 -0
- data/lib/ziya/gauges/support/line.rb +12 -0
- data/lib/ziya/gauges/support/link.rb +24 -0
- data/lib/ziya/gauges/support/move.rb +15 -0
- data/lib/ziya/gauges/support/point.rb +12 -0
- data/lib/ziya/gauges/support/polygon.rb +13 -0
- data/lib/ziya/gauges/support/radial_base.rb +21 -0
- data/lib/ziya/gauges/support/radial_numbers.rb +41 -0
- data/lib/ziya/gauges/support/radial_ticks.rb +29 -0
- data/lib/ziya/gauges/support/rect.rb +14 -0
- data/lib/ziya/gauges/support/rotate.rb +15 -0
- data/lib/ziya/gauges/support/scale.rb +15 -0
- data/lib/ziya/gauges/support/text.rb +21 -0
- data/lib/ziya/gauges/support/update.rb +12 -0
- data/lib/ziya/gauges/thermo.rb +121 -0
- data/lib/ziya/helpers/base_helper.rb +39 -6
- data/lib/ziya/utils/text.rb +6 -0
- data/lib/ziya/version.rb +1 -1
- data/lib/ziya/ziya_helper.rb +289 -62
- data/spec/charts/base_spec.rb +35 -21
- data/spec/charts/chart_type_spec.rb +24 -3
- data/spec/components/area_spec.rb +9 -2
- data/spec/components/draw_spec.rb +1 -2
- data/spec/components/filter_spec.rb +27 -0
- data/spec/components/link_spec.rb +1 -2
- data/spec/components/series_color_spec.rb +1 -2
- data/spec/components/series_explode_spec.rb +1 -2
- data/spec/components/series_switch_spec.rb +1 -2
- data/spec/designs/circle.yml +7 -0
- data/spec/designs/crapping_out.yml +8 -0
- data/spec/designs/gauge_1.yml +43 -0
- data/spec/designs/gauge_2.yml +11 -0
- data/spec/designs/gauge_no_name.yml +43 -0
- data/spec/designs/gauge_raw.yml +5 -0
- data/spec/designs/thermo.yml +13 -0
- data/spec/gauges/base_spec.rb +90 -0
- data/spec/gauges/signal_spec.rb +36 -0
- data/spec/gauges/support/area_spec.rb +40 -0
- data/spec/gauges/support/circle_spec.rb +78 -0
- data/spec/gauges/support/image_spec.rb +35 -0
- data/spec/gauges/support/line_spec.rb +34 -0
- data/spec/gauges/support/link_spec.rb +35 -0
- data/spec/gauges/support/move_spec.rb +45 -0
- data/spec/gauges/support/polygon_spec.rb +36 -0
- data/spec/gauges/support/radial_numbers_spec.rb +35 -0
- data/spec/gauges/support/radial_ticks_spec.rb +30 -0
- data/spec/gauges/support/rotate_spec.rb +45 -0
- data/spec/gauges/support/scale_spec.rb +46 -0
- data/spec/gauges/support/text_spec.rb +40 -0
- data/spec/gauges/thermo_spec.rb +49 -0
- data/spec/helpers/base_helper_spec.rb +20 -6
- data/spec/spec_helper.rb +4 -1
- data/spec/test_helpers/gauge_2_helper.rb +17 -0
- data/spec/utils/logger_spec.rb +1 -3
- data/spec/utils/text_spec.rb +1 -2
- data/spec/ziya_helper_spec.rb +88 -11
- data/spec/ziya_spec.rb +1 -1
- data/tasks/gem.rake +1 -1
- metadata +79 -32
- data/charts/themes/commando/bar_chart.yml +0 -9
- data/charts/themes/commando/base_chart.yml +0 -65
- data/charts/themes/commando/column_chart.yml +0 -13
- data/charts/themes/commando/column_threed_chart.yml +0 -25
- data/charts/themes/commando/parallel_threed_column_chart.yml +0 -17
- data/charts/themes/commando/pie_chart.yml +0 -22
- data/charts/themes/commando/pie_threed_chart.yml +0 -28
- data/charts/themes/commando/polar_chart.yml +0 -11
- data/charts/themes/commando/stacked_bar_chart.yml +0 -9
- data/charts/themes/commando/stacked_column_chart.yml +0 -14
- data/charts/themes/commando/stacked_threed_column_chart.yml +0 -17
- data/charts/themes/default/bar_chart.yml +0 -3
- data/charts/themes/default/base_chart.yml +0 -67
- data/charts/themes/default/column_chart.yml +0 -13
- data/charts/themes/default/column_threed_chart.yml +0 -25
- data/charts/themes/default/parallel_threed_column_chart.yml +0 -17
- data/charts/themes/default/pie_chart.yml +0 -29
- data/charts/themes/default/pie_threed_chart.yml +0 -28
- data/charts/themes/default/polar_chart.yml +0 -12
- data/charts/themes/default/stacked_bar_chart.yml +0 -3
- data/charts/themes/default/stacked_column_chart.yml +0 -14
- data/charts/themes/default/stacked_threed_column_chart.yml +0 -17
- data/charts/themes/default/test.yml +0 -4
- data/lib/ziya/components/chart_value.rb +0 -71
- data/lib/ziya/components/legend_label.rb +0 -18
- data/lib/ziya/components/legend_rect.rb +0 -19
- data/lib/ziya/components/legend_transition.rb +0 -18
- data/lib/ziya/components/live_update.rb +0 -21
|
@@ -1,25 +1,24 @@
|
|
|
1
1
|
# -----------------------------------------------------------------------------
|
|
2
2
|
# Sets up a transition when the chart first renders
|
|
3
3
|
#
|
|
4
|
-
# Sets the transition attributes for the chart elements.
|
|
5
|
-
#
|
|
6
|
-
# <tt>type</tt>: The type of the transition. Valid values are dissolve, drop, spin, scale, zoom,
|
|
7
|
-
# blink, slide_right, slide_left, slide_up, slide_down, and none.
|
|
8
|
-
# The default is none, which draws the chart immediately without a transition.
|
|
9
|
-
# <tt>delay</tt>: The delay in seconds before starting the transition.
|
|
10
|
-
# The default is zero.
|
|
11
|
-
# <tt>duration</tt>: The transition's duration in seconds.
|
|
12
|
-
# The default is 1.
|
|
13
|
-
# <tt>order</tt>: The order in which to transition the chart's parts. Valid values are series,
|
|
14
|
-
# category, and all.
|
|
15
|
-
# The default is all.
|
|
16
|
-
#
|
|
17
|
-
# See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=chart_trasition
|
|
18
|
-
# for additional documentation, examples and futher detail.
|
|
19
4
|
# Author:: Fernand Galiana
|
|
20
|
-
# Date:: Dec 15th, 2006
|
|
21
5
|
# -----------------------------------------------------------------------------
|
|
22
6
|
module Ziya::Components
|
|
7
|
+
# Sets the transition attributes for the chart elements.
|
|
8
|
+
#
|
|
9
|
+
# <tt>type</tt>: The type of the transition. Valid values are dissolve, drop, spin, scale, zoom,
|
|
10
|
+
# blink, slide_right, slide_left, slide_up, slide_down, and none.
|
|
11
|
+
# The default is none, which draws the chart immediately without a transition.
|
|
12
|
+
# <tt>delay</tt>: The delay in seconds before starting the transition.
|
|
13
|
+
# The default is zero.
|
|
14
|
+
# <tt>duration</tt>: The transition's duration in seconds.
|
|
15
|
+
# The default is 1.
|
|
16
|
+
# <tt>order</tt>: The order in which to transition the chart's parts. Valid values are series,
|
|
17
|
+
# category, and all.
|
|
18
|
+
# The default is all.
|
|
19
|
+
#
|
|
20
|
+
# See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=chart_transition
|
|
21
|
+
# for additional documentation, examples and futher detail.
|
|
23
22
|
class ChartTransition < Base
|
|
24
23
|
has_attribute :type, :delay, :duration, :order
|
|
25
24
|
end
|
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
# Draws a circle
|
|
3
3
|
#
|
|
4
4
|
# Author:: Fernand Galiana
|
|
5
|
-
# Date:: Dec 15th, 2006
|
|
6
5
|
# -----------------------------------------------------------------------------
|
|
7
6
|
module Ziya::Components
|
|
7
|
+
# Circle component to draw a circle on the chart. Must be set up within the draw
|
|
8
|
+
# component.
|
|
9
|
+
# See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=draw
|
|
10
|
+
# for additional documentation, examples and futher detail.
|
|
8
11
|
class Circle < Base
|
|
9
12
|
has_attribute :layer, :transition, :delay, :duration, :x, :y, :radius,
|
|
10
13
|
:fill_color, :fill_alpha, :line_color, :line_alpha,
|
|
11
|
-
:line_thickness
|
|
14
|
+
:line_thickness, :shadow, :bevel, :glow, :blur
|
|
12
15
|
end
|
|
13
16
|
end
|
data/lib/ziya/components/draw.rb
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
# -----------------------------------------------------------------------------
|
|
2
2
|
# Sets up a drawing area on the chart to draw text, rect, circles...
|
|
3
3
|
#
|
|
4
|
-
# Holds any number of elements to draw. A draw element can be a circle, image (JPEG or SWF),
|
|
5
|
-
# line, rectangle, or text. Use draw "image" to include SWF flash file with animation,
|
|
6
|
-
# roll-over buttons, sounds, scripts, etc.
|
|
7
|
-
#
|
|
8
|
-
# <tt></tt>:
|
|
9
|
-
#
|
|
10
|
-
# See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=draw
|
|
11
|
-
# for additional documentation, examples and futher detail.
|
|
12
|
-
#
|
|
13
4
|
# Author:: Fernand Galiana
|
|
14
|
-
# Date:: Dec 15th, 2006
|
|
15
5
|
# -----------------------------------------------------------------------------
|
|
16
6
|
require 'ziya/ziya_helper'
|
|
17
7
|
|
|
18
8
|
module Ziya::Components
|
|
9
|
+
# Sets up a drawing area on the chart to draw text, rect, circles...
|
|
10
|
+
#
|
|
11
|
+
# Holds any number of elements to draw. A draw element can be a circle, image (JPEG or SWF),
|
|
12
|
+
# line, rectangle, or text. Use draw "image" to include SWF flash file with animation,
|
|
13
|
+
# roll-over buttons, sounds, scripts, etc.
|
|
14
|
+
#
|
|
15
|
+
# <tt></tt>:
|
|
16
|
+
#
|
|
17
|
+
# See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=draw
|
|
18
|
+
# for additional documentation, examples and futher detail.
|
|
19
|
+
#
|
|
19
20
|
class Draw < Base
|
|
20
21
|
include Ziya::Helper
|
|
21
22
|
|
|
@@ -38,7 +39,7 @@ module Ziya::Components
|
|
|
38
39
|
def gen_composites( xml, composite_urls )
|
|
39
40
|
chart_path = "/charts"
|
|
40
41
|
for url in composite_urls do
|
|
41
|
-
xml.image( :url =>
|
|
42
|
+
xml.image( :url => composite_url % [ chart_path, chart_path, url] )
|
|
42
43
|
end
|
|
43
44
|
end
|
|
44
45
|
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
# Draw base class for all draw components
|
|
3
|
+
#
|
|
4
|
+
# Author:: Fernand Galiana
|
|
5
|
+
# -----------------------------------------------------------------------------
|
|
6
|
+
module Ziya::Components
|
|
7
|
+
class DrawBase < Base # :nodoc:
|
|
8
|
+
has_attribute :shadow, :bevel, :glow, :blur
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
# Sets various filters for enhancing charts look and feel
|
|
3
|
+
#
|
|
4
|
+
# Holds any number of filters. such as bevel, shadow etc. You must specify
|
|
5
|
+
# and id so that other drawable component can use the filters
|
|
6
|
+
#
|
|
7
|
+
# Author:: Fernand
|
|
8
|
+
# -----------------------------------------------------------------------------
|
|
9
|
+
module Ziya::Components
|
|
10
|
+
# Specifies the various filters that can be reused across components ie blur, bevel, glow, etc...
|
|
11
|
+
# See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=filter
|
|
12
|
+
# for additional documentation, examples and futher detail.
|
|
13
|
+
class Filter < Base
|
|
14
|
+
has_attribute :filters
|
|
15
|
+
|
|
16
|
+
# -------------------------------------------------------------------------
|
|
17
|
+
# Dump has_attribute into xml element
|
|
18
|
+
def flatten( xml )
|
|
19
|
+
if filters
|
|
20
|
+
xml.filter do
|
|
21
|
+
filters.each { |comp| comp.flatten( xml ) }
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
# Create a glow filter
|
|
3
|
+
#
|
|
4
|
+
# Author:: Fernand Galiana
|
|
5
|
+
# -----------------------------------------------------------------------------
|
|
6
|
+
module Ziya::Components
|
|
7
|
+
# Specifies the glow filter to be applied to some component ie chart_rect, axis_value, etc...
|
|
8
|
+
# See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=filter
|
|
9
|
+
# for additional documentation, examples and futher detail.
|
|
10
|
+
class Glow < Base
|
|
11
|
+
has_attribute :id, :color, :alpha, :blurX, :blurY, :strength, :quality,
|
|
12
|
+
:inner, :knockout
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -6,8 +6,12 @@
|
|
|
6
6
|
# Date:: Dec 15th, 2006
|
|
7
7
|
# -----------------------------------------------------------------------------
|
|
8
8
|
module Ziya::Components
|
|
9
|
+
# Renders the specified image (jpg/gif) on the chart. Must be set up within the draw
|
|
10
|
+
# component.
|
|
11
|
+
# See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=draw
|
|
12
|
+
# for additional documentation, examples and futher detail.
|
|
9
13
|
class Image < Base
|
|
10
14
|
has_attribute :layer, :transition, :delay, :duration, :url, :x, :y, :width,
|
|
11
|
-
:height, :rotation, :alpha
|
|
15
|
+
:height, :rotation, :alpha, :bevel, :glow, :blur, :timeout, :retry
|
|
12
16
|
end
|
|
13
17
|
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
# Sets up chart legend location
|
|
3
|
+
#
|
|
4
|
+
# Author:: Fernand Galiana
|
|
5
|
+
# -----------------------------------------------------------------------------
|
|
6
|
+
module Ziya::Components
|
|
7
|
+
# Renders a legend on the chart
|
|
8
|
+
# See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=legend
|
|
9
|
+
# for additional documentation, examples and futher detail.
|
|
10
|
+
|
|
11
|
+
class Legend < Base
|
|
12
|
+
has_attribute :transition, :delay, :duration,
|
|
13
|
+
:x, :y, :width, :height,
|
|
14
|
+
:toggle, :layout, :margin, :bullet, :font, :bold, :size, :color, :alpha,
|
|
15
|
+
:fill_color, :fill_alpha, :line_color, :line_alpha, :line_thickness,
|
|
16
|
+
:shadow, :bevel, :glow, :blur
|
|
17
|
+
end
|
|
18
|
+
end
|
data/lib/ziya/components/line.rb
CHANGED
|
@@ -2,11 +2,15 @@
|
|
|
2
2
|
# Draw a line on a chart
|
|
3
3
|
#
|
|
4
4
|
# Author:: Fernand Galiana
|
|
5
|
-
# Date:: Dec 15th, 2006
|
|
6
5
|
# -----------------------------------------------------------------------------
|
|
7
6
|
module Ziya::Components
|
|
7
|
+
# Line component to draw a line on the chart. Must be set up within the draw
|
|
8
|
+
# component.
|
|
9
|
+
# See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=draw
|
|
10
|
+
# for additional documentation, examples and futher detail.
|
|
8
11
|
class Line < Base
|
|
9
12
|
has_attribute :layer, :transition, :delay, :duration, :x1, :y1, :x2, :y2,
|
|
10
|
-
:line_color,:line_alpha, :line_thickness
|
|
13
|
+
:line_color,:line_alpha, :line_thickness,
|
|
14
|
+
:bevel, :glow, :blur, :shadow
|
|
11
15
|
end
|
|
12
16
|
end
|
data/lib/ziya/components/link.rb
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
# -----------------------------------------------------------------------------
|
|
2
2
|
# Sets up clickable areas on the chart.
|
|
3
3
|
#
|
|
4
|
-
# Holds any number of areas, each defining a rectangle and a URL to go to when the user
|
|
5
|
-
# clicks inside the rectangle. This can also be used to make refresh or print buttons.
|
|
6
|
-
#
|
|
7
|
-
# <tt></tt>:
|
|
8
|
-
#
|
|
9
|
-
# See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=link
|
|
10
|
-
# for additional documentation, examples and futher detail.
|
|
11
|
-
#
|
|
12
4
|
# Author:: Fernand Galiana
|
|
13
|
-
# Date:: Dec 15th, 2006
|
|
14
5
|
# -----------------------------------------------------------------------------
|
|
15
6
|
module Ziya::Components
|
|
7
|
+
# Sets up clickable areas on the chart.
|
|
8
|
+
#
|
|
9
|
+
# Holds any number of areas, each defining a rectangle and a URL to go to when the user
|
|
10
|
+
# clicks inside the rectangle. This can also be used to make refresh or print buttons.
|
|
11
|
+
#
|
|
12
|
+
# <tt></tt>:
|
|
13
|
+
#
|
|
14
|
+
# See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=link
|
|
15
|
+
# for additional documentation, examples and futher detail.
|
|
16
16
|
class Link < Base
|
|
17
17
|
has_attribute :areas
|
|
18
18
|
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
# -----------------------------------------------------------------------------
|
|
2
2
|
# Sets up a handler for clickable chart elements
|
|
3
3
|
#
|
|
4
|
-
# Sets the URL of a script responsible for processing clicks on chart elements.
|
|
5
|
-
# This enables drilling down into charts.
|
|
6
|
-
#
|
|
7
|
-
# <tt></tt>:
|
|
8
|
-
#
|
|
9
|
-
# See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=link_data
|
|
10
|
-
# for additional documentation, examples and futher detail.
|
|
11
|
-
#
|
|
12
4
|
# Author:: Fernand Galiana
|
|
13
|
-
# Date:: Dec 15th, 2006
|
|
14
5
|
# -----------------------------------------------------------------------------
|
|
15
6
|
module Ziya::Components
|
|
7
|
+
# Sets the URL of a script responsible for processing clicks on chart elements.
|
|
8
|
+
# This enables drilling down into charts.
|
|
9
|
+
#
|
|
10
|
+
# <tt></tt>:
|
|
11
|
+
#
|
|
12
|
+
# See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=link_data
|
|
13
|
+
# for additional documentation, examples and futher detail.
|
|
14
|
+
#
|
|
16
15
|
class LinkData < Base
|
|
17
|
-
has_attribute :url, :target
|
|
16
|
+
has_attribute :url, :target, :timeout, :retry, :spinning_wheel
|
|
18
17
|
end
|
|
19
18
|
end
|
data/lib/ziya/components/rect.rb
CHANGED
|
@@ -2,12 +2,17 @@
|
|
|
2
2
|
# Draw a rectangle on a chart
|
|
3
3
|
#
|
|
4
4
|
# Author:: Fernand Galiana
|
|
5
|
-
# Date:: Dec 15th, 2006
|
|
6
5
|
# -----------------------------------------------------------------------------
|
|
7
6
|
module Ziya::Components
|
|
7
|
+
# Rect component to draw a rectangle on the chart. Must be set up within the draw
|
|
8
|
+
# component.
|
|
9
|
+
# See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=draw
|
|
10
|
+
# for additional documentation, examples and futher detail.
|
|
8
11
|
class Rect < Base
|
|
9
12
|
has_attribute :layer, :transition, :delay, :duration, :x, :y, :width,
|
|
10
13
|
:height, :fill_color, :fill_alpha, :line_color, :line_alpha,
|
|
11
|
-
:line_thickness
|
|
14
|
+
:line_thickness,
|
|
15
|
+
:corner_tl, :corner_tr, :corner_bl, :corner_br,
|
|
16
|
+
:shadow, :bevel, :blur, :bevel
|
|
12
17
|
end
|
|
13
18
|
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
# Embeds a scroller in a given chart
|
|
3
|
+
#
|
|
4
|
+
# Author:: Fernand Galiana
|
|
5
|
+
# Date:: Dec 15th, 2006
|
|
6
|
+
# -----------------------------------------------------------------------------
|
|
7
|
+
require 'ziya/components/base'
|
|
8
|
+
|
|
9
|
+
module Ziya::Components
|
|
10
|
+
# Specifies the ability to scroll a chart by setting single or double sliders
|
|
11
|
+
# on the chart.
|
|
12
|
+
# See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=scroll
|
|
13
|
+
# for additional documentation, examples and futher detail.
|
|
14
|
+
#
|
|
15
|
+
class Scroll < Base
|
|
16
|
+
has_attribute :x, :y, :width, :height, :alpha,
|
|
17
|
+
:transition, :delay, :duration,
|
|
18
|
+
:url_button_1_idle, :url_button_1_over, :url_button_1_press,
|
|
19
|
+
:url_button_2_idle, :url_button_2_over, :url_button_2_press,
|
|
20
|
+
:url_slider_body, :url_slider_handle_1, :url_slider_handle_2,
|
|
21
|
+
:button_length, :slider_handle_length, :gap, :button_speed,
|
|
22
|
+
:buttons_together, :start, :span, :drag, :reverse_handle,
|
|
23
|
+
:scroll_detail, :stop_detail,
|
|
24
|
+
:timeout, :retry
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
# Create a shadow filter
|
|
3
|
+
#
|
|
4
|
+
# Author:: Fernand Galiana
|
|
5
|
+
# -----------------------------------------------------------------------------
|
|
6
|
+
module Ziya::Components
|
|
7
|
+
# Specifies the shadow filter to be applied to some component ie chart_rect, axis_value, etc...
|
|
8
|
+
# See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=filter
|
|
9
|
+
# for additional documentation, examples and futher detail.
|
|
10
|
+
class Shadow < Base
|
|
11
|
+
has_attribute :id, :distance, :angle, :color, :alpha,
|
|
12
|
+
:blurX, :blurY, :strength, :quality, :inner, :knockout, :hideObject
|
|
13
|
+
end
|
|
14
|
+
end
|
data/lib/ziya/components/text.rb
CHANGED
|
@@ -5,9 +5,13 @@
|
|
|
5
5
|
# Date:: Dec 15th, 2006
|
|
6
6
|
# -----------------------------------------------------------------------------
|
|
7
7
|
module Ziya::Components
|
|
8
|
+
# Text component to draw text on the chart. Must be set up within the draw
|
|
9
|
+
# component.
|
|
10
|
+
# See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=draw
|
|
11
|
+
# for additional documentation, examples and futher detail.
|
|
8
12
|
class Text < Base
|
|
9
13
|
has_attribute :layer, :transition, :delay, :duration, :x, :y, :width,
|
|
10
14
|
:height, :h_align, :v_align, :rotation, :font, :bold, :size,
|
|
11
|
-
:color, :alpha, :text
|
|
15
|
+
:color, :alpha, :shadow, :bevel, :glow, :blur, :text
|
|
12
16
|
end
|
|
13
17
|
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
# Sets up handler for refresh the chart content. The refresh xml can only refresh
|
|
3
|
+
# parts of the chart that have changed.
|
|
4
|
+
#
|
|
5
|
+
# Author:: Fernand Galiana
|
|
6
|
+
# -----------------------------------------------------------------------------
|
|
7
|
+
module Ziya::Components
|
|
8
|
+
# Updates the chart at intervals, without reloading the web page. This makes it possible
|
|
9
|
+
# to display charts with live data, change the chart's look over time for emphasis, or
|
|
10
|
+
# create a slideshow from different charts.
|
|
11
|
+
#
|
|
12
|
+
# <tt></tt>:
|
|
13
|
+
#
|
|
14
|
+
# See http://www.maani.us/xml_charts/index.php?menu=Reference&submenu=live_update
|
|
15
|
+
# for additional documentation, examples and futher detail.
|
|
16
|
+
class Update < Base
|
|
17
|
+
has_attribute :url, :delay, :timeout, :retry, :mode, :span
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
module Ziya::Gauges
|
|
2
|
+
class Base
|
|
3
|
+
include Ziya::Helpers::BaseHelper
|
|
4
|
+
|
|
5
|
+
attr_accessor :license, :design_id
|
|
6
|
+
attr_reader :type, :components
|
|
7
|
+
attr_reader :options
|
|
8
|
+
|
|
9
|
+
def initialize( license, design_id )
|
|
10
|
+
@license = license
|
|
11
|
+
@design_id = design_id
|
|
12
|
+
|
|
13
|
+
# load up associated helper
|
|
14
|
+
loaded = load_helper( Ziya.helpers_dir ) if Ziya.helpers_dir
|
|
15
|
+
Ziya.logger.warn( ">>> ZiYa -- no helper for gauge `#{design_id}" ) unless loaded
|
|
16
|
+
|
|
17
|
+
# init defaults
|
|
18
|
+
@options = default_options
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# -------------------------------------------------------------------------
|
|
22
|
+
# provides for overiding basic functionality
|
|
23
|
+
#
|
|
24
|
+
# <tt>gauge_color</tt>:: Legend color
|
|
25
|
+
# <tt>legend_color</tt>:: Gauge color
|
|
26
|
+
def set_preferences( opts={} )
|
|
27
|
+
options.merge!( opts )
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# -------------------------------------------------------------------------
|
|
31
|
+
# render gauge to xml
|
|
32
|
+
def to_xml
|
|
33
|
+
render_xml
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# =========================================================================
|
|
37
|
+
protected
|
|
38
|
+
|
|
39
|
+
# inject update behavior
|
|
40
|
+
def render_extra_components
|
|
41
|
+
if options[:url]
|
|
42
|
+
Ziya::Gauges::Support::Update.new(
|
|
43
|
+
:url => options[:url],
|
|
44
|
+
:retry => options[:retry] || 0,
|
|
45
|
+
:timeout => options[:timeout] || 30,
|
|
46
|
+
:delay_type => options[:delay_type] || 1,
|
|
47
|
+
:delay => options[:delay] || 30 ).flatten( @xml )
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# -------------------------------------------------------------------------
|
|
52
|
+
# setup thermometer default options
|
|
53
|
+
def default_options
|
|
54
|
+
{
|
|
55
|
+
:x => 20,
|
|
56
|
+
:y => 20,
|
|
57
|
+
:gauge_color => "ff0000",
|
|
58
|
+
:legend_color => "cc0000",
|
|
59
|
+
}
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# =========================================================================
|
|
63
|
+
private
|
|
64
|
+
|
|
65
|
+
# retrieve bundled design directory
|
|
66
|
+
def bundled_designs_dir
|
|
67
|
+
Ziya.path( %w[gauges designs] )
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# -----------------------------------------------------------------------
|
|
71
|
+
# Load up ERB style helpers
|
|
72
|
+
def load_helper( helper_dir )
|
|
73
|
+
Dir.foreach(helper_dir) do |helper_file|
|
|
74
|
+
unless helper_file =~ /^(#{design_id}_helper).rb$/ or helper_file =~ /^(base_helper).rb$/
|
|
75
|
+
next
|
|
76
|
+
end
|
|
77
|
+
Ziya.logger.info( ">>> ZiYa loading custom helper `#{$1}" )
|
|
78
|
+
# BOZO !! This will only work in rails ??
|
|
79
|
+
if defined? RAILS_ROOT
|
|
80
|
+
require_dependency File.join(helper_dir, $1)
|
|
81
|
+
else
|
|
82
|
+
require File.join(helper_dir, $1)
|
|
83
|
+
end
|
|
84
|
+
helper_module_name = "Ziya::" + $1.gsub(/(^|_)(.)/) { $2.upcase }
|
|
85
|
+
# helper_module_name = $1.to_s.gsub(/\/(.?)/) { "::" + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase }
|
|
86
|
+
Ziya.logger.debug( "Include module #{helper_module_name}")
|
|
87
|
+
Ziya::Gauges::Base.class_eval("include #{helper_module_name}")
|
|
88
|
+
true
|
|
89
|
+
end
|
|
90
|
+
false
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# -----------------------------------------------------------------------
|
|
94
|
+
# merge components with user overrides
|
|
95
|
+
def merge_comps( original, override )
|
|
96
|
+
override.each do |k,v|
|
|
97
|
+
if original.has_key? k
|
|
98
|
+
original[k] = v
|
|
99
|
+
else
|
|
100
|
+
original << [k,v]
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# -----------------------------------------------------------------------
|
|
106
|
+
# renders design components
|
|
107
|
+
def render_components
|
|
108
|
+
# First check bundled design dir for std design
|
|
109
|
+
std_design = inflate( self, bundled_designs_dir, design_id )
|
|
110
|
+
# Now check for user overrides
|
|
111
|
+
usr_design = inflate( self, Ziya.designs_dir, design_id )
|
|
112
|
+
|
|
113
|
+
design = usr_design
|
|
114
|
+
if std_design and usr_design
|
|
115
|
+
design = std_design
|
|
116
|
+
merge_comps( design.components, usr_design.components )
|
|
117
|
+
# design.components.merge!( usr_design.components )
|
|
118
|
+
elsif std_design
|
|
119
|
+
design = std_design
|
|
120
|
+
end
|
|
121
|
+
# Ziya.logger.debug "!!!! Design\n#{design.to_yaml}"
|
|
122
|
+
# flatten components to xml
|
|
123
|
+
design.components.each do |name, value|
|
|
124
|
+
# Ziya.logger.debug "Processing #{name}"
|
|
125
|
+
value.flatten( @xml )
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# -----------------------------------------------------------------------
|
|
130
|
+
# renders chart to xml
|
|
131
|
+
def render_xml
|
|
132
|
+
@xml = Builder::XmlMarkup.new
|
|
133
|
+
@xml.gauge do
|
|
134
|
+
@xml.license( @license ) unless @license.nil?
|
|
135
|
+
render_extra_components
|
|
136
|
+
render_components
|
|
137
|
+
end
|
|
138
|
+
@xml.to_s.gsub( /<to_s\/>/, '' )
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
# -----------------------------------------------------------------------
|
|
142
|
+
# Parse erb template if any
|
|
143
|
+
def erb_render( yml )
|
|
144
|
+
# b = binding
|
|
145
|
+
ERB.new( yml ).result binding
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
# -----------------------------------------------------------------------
|
|
149
|
+
# Load yaml file associated with class if any
|
|
150
|
+
def inflate( clazz, designs_dir, design )
|
|
151
|
+
class_name = underscore( demodulize( clazz.to_s ) )
|
|
152
|
+
begin
|
|
153
|
+
file_name = "#{designs_dir}/#{design}.yml"
|
|
154
|
+
Ziya.logger.debug ">>> ZiYa attempt to load design file '#{file_name}"
|
|
155
|
+
return nil unless File.exists?( file_name )
|
|
156
|
+
yml = IO.read( file_name )
|
|
157
|
+
# Ziya.logger.debug ">>> Unprocessed yaml...\n#{yml}\n"
|
|
158
|
+
processed = erb_render( yml )
|
|
159
|
+
# Ziya.logger.debug ">>> Processed yaml...\n#{processed}"
|
|
160
|
+
load = YAML::load( processed )
|
|
161
|
+
Ziya.logger.info ">>> ZiYa successfully loaded design file `#{file_name}"
|
|
162
|
+
return load
|
|
163
|
+
rescue SystemCallError => boom
|
|
164
|
+
Ziya.logger.error boom
|
|
165
|
+
rescue => bang
|
|
166
|
+
Ziya.logger.error ">>> ZiYa -- Error encountered loading design file `#{file_name} -- #{bang}"
|
|
167
|
+
bang.backtrace.each { |l| Ziya.logger.error( l ) }
|
|
168
|
+
end
|
|
169
|
+
nil
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
end
|