dyi 1.1.1 → 1.1.2

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.
Files changed (48) hide show
  1. data/CHANGES +7 -1
  2. data/lib/dyi.rb +3 -1
  3. data/lib/dyi/animation.rb +5 -4
  4. data/lib/dyi/canvas.rb +5 -8
  5. data/lib/dyi/chart.rb +1 -1
  6. data/lib/dyi/chart/array_reader.rb +104 -10
  7. data/lib/dyi/chart/axis_util.rb +31 -17
  8. data/lib/dyi/chart/base.rb +104 -7
  9. data/lib/dyi/chart/csv_reader.rb +56 -8
  10. data/lib/dyi/chart/excel_reader.rb +27 -4
  11. data/lib/dyi/chart/legend.rb +10 -8
  12. data/lib/dyi/chart/line_chart.rb +29 -25
  13. data/lib/dyi/chart/pie_chart.rb +192 -29
  14. data/lib/dyi/chart/table.rb +12 -10
  15. data/lib/dyi/color.rb +9 -7
  16. data/lib/dyi/coordinate.rb +177 -61
  17. data/lib/dyi/drawing.rb +1 -1
  18. data/lib/dyi/drawing/clipping.rb +9 -3
  19. data/lib/dyi/drawing/color_effect.rb +7 -4
  20. data/lib/dyi/drawing/filter.rb +10 -7
  21. data/lib/dyi/drawing/pen.rb +421 -11
  22. data/lib/dyi/drawing/pen_3d.rb +12 -7
  23. data/lib/dyi/element.rb +5 -4
  24. data/lib/dyi/event.rb +3 -3
  25. data/lib/dyi/font.rb +6 -4
  26. data/lib/dyi/formatter.rb +1 -1
  27. data/lib/dyi/formatter/base.rb +24 -15
  28. data/lib/dyi/formatter/emf_formatter.rb +6 -5
  29. data/lib/dyi/formatter/eps_formatter.rb +15 -14
  30. data/lib/dyi/formatter/svg_formatter.rb +16 -14
  31. data/lib/dyi/formatter/svg_reader.rb +4 -3
  32. data/lib/dyi/formatter/xaml_formatter.rb +9 -7
  33. data/lib/dyi/length.rb +213 -114
  34. data/lib/dyi/matrix.rb +4 -2
  35. data/lib/dyi/painting.rb +161 -87
  36. data/lib/dyi/script.rb +1 -1
  37. data/lib/dyi/script/ecmascript.rb +18 -29
  38. data/lib/dyi/script/simple_script.rb +4 -8
  39. data/lib/dyi/shape.rb +1 -1
  40. data/lib/dyi/shape/base.rb +8 -17
  41. data/lib/dyi/shape/path.rb +102 -19
  42. data/lib/dyi/stylesheet.rb +4 -3
  43. data/lib/dyi/svg_element.rb +9 -7
  44. data/lib/dyi/type.rb +5 -2
  45. data/lib/dyi/util.rb +36 -1
  46. data/lib/ironruby.rb +1 -1
  47. data/lib/util.rb +53 -5
  48. metadata +4 -19
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: UTF-8 -*-
2
2
 
3
- # Copyright (c) 2009-2011 Sound-F Co., Ltd. All rights reserved.
3
+ # Copyright (c) 2009-2012 Sound-F Co., Ltd. All rights reserved.
4
4
  #
5
5
  # Author:: Mamoru Yuo
6
6
  #
@@ -19,8 +19,10 @@
19
19
  # You should have received a copy of the GNU General Public License
20
20
  # along with DYI. If not, see <http://www.gnu.org/licenses/>.
21
21
 
22
- module DYI #:nodoc:
22
+ #
23
+ module DYI
23
24
 
25
+ # @since 0.0.0
24
26
  module AttributeCreator
25
27
 
26
28
  private
@@ -70,6 +72,7 @@ module DYI #:nodoc:
70
72
  end
71
73
  end
72
74
 
75
+ # @since 0.0.0
73
76
  module StringFormat
74
77
 
75
78
  class << self
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: UTF-8 -*-
2
2
 
3
- # Copyright (c) 2009-2011 Sound-F Co., Ltd. All rights reserved.
3
+ # Copyright (c) 2009-2012 Sound-F Co., Ltd. All rights reserved.
4
4
  #
5
5
  # Author:: Mamoru Yuo
6
6
  #
@@ -19,37 +19,72 @@
19
19
  # You should have received a copy of the GNU General Public License
20
20
  # along with DYI. If not, see <http://www.gnu.org/licenses/>.
21
21
 
22
+ #
22
23
  module DYI
23
24
 
25
+ # Defines the utility functions in this module.
26
+ #
27
+ # All the methods defined by the module are 'module functions', which are
28
+ # called as private instance methods and are also called as public class
29
+ # methods (they are methods of Math Module like).
30
+ # See also {DYI::Script::EcmaScript::DomLevel2}.
24
31
  # @since 1.1.0
25
32
  module Util
26
33
 
27
34
  private
28
35
 
36
+ # Converts the value of +degree+ from degrees to radians.
37
+ # @param [Number] degree the value in degrees
38
+ # @return [Float] the value in radians
39
+ # @function
29
40
  def to_radian(degree)
30
41
  Math::PI * degree / 180
31
42
  end
32
43
 
44
+ # Computes the sine of +degree+ (expressed in degrees).
45
+ # @param [Number] degree the value in degrees
46
+ # @return [Float] the sine of the parameter
47
+ # @function
33
48
  def sin(degree)
34
49
  Math.sin(to_radian(degree))
35
50
  end
36
51
 
52
+ # Computes the cosine of +degree+ (expressed in degrees).
53
+ # @param [Number] degree the value in degrees
54
+ # @return [Float] the cosine of the parameter
55
+ # @function
37
56
  def cos(degree)
38
57
  Math.cos(to_radian(degree))
39
58
  end
40
59
 
60
+ # Computes the tangent of +degree+ (expressed in degrees).
61
+ # @param [Number] degree the value in degrees
62
+ # @return [Float] the tangent of the parameter
63
+ # @function
41
64
  def tan(degree)
42
65
  Math.tan(to_radian(degree))
43
66
  end
44
67
 
68
+ # Computes the arc sine of +x+ in degrees. Returns -90 .. 90.
69
+ # @param [Number] x
70
+ # @return [Float] the arc sine value in degrees
71
+ # @function
45
72
  def asin(x)
46
73
  Math.asin(x) * 180 / Math::PI
47
74
  end
48
75
 
76
+ # Computes the arc cosine of +x+ in degrees. Returns 0 .. 180.
77
+ # @param [Number] x
78
+ # @return [Float] the arc cosine value in degrees
79
+ # @function
49
80
  def acos(x)
50
81
  Math.acos(x) * 180 / Math::PI
51
82
  end
52
83
 
84
+ # Computes the arc tangent of +x+ in degrees. Returns -90 .. 90.
85
+ # @param [Number] x
86
+ # @return [Float] the arc tanget value in degrees
87
+ # @function
53
88
  def atan(x)
54
89
  Math.atan(x) * 180 / Math::PI
55
90
  end
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: UTF-8 -*-
2
2
 
3
- # Copyright (c) 2009-2011 Sound-F Co., Ltd. All rights reserved.
3
+ # Copyright (c) 2009-2012 Sound-F Co., Ltd. All rights reserved.
4
4
  #
5
5
  # Author:: Mamoru Yuo
6
6
  #
@@ -1,6 +1,6 @@
1
1
  # -*- encoding: UTF-8 -*-
2
2
 
3
- # Copyright (c) 2009-2011 Sound-F Co., Ltd. All rights reserved.
3
+ # Copyright (c) 2009-2012 Sound-F Co., Ltd. All rights reserved.
4
4
  #
5
5
  # Author:: Mamoru Yuo
6
6
  #
@@ -23,13 +23,41 @@
23
23
  class Numeric
24
24
 
25
25
  # Converts the numeric value of this instance to the string representation,
26
- # using the numeric format string.
27
- # @param [String] format the numeric format string
28
- # @return [String] formated string that is equivalent to this instance
29
- # @example
26
+ # using the numeric format strings.
27
+ #
28
+ #== Numeric Format Strings
29
+ # Uses the following characters as numeric format strings.
30
+ # [<tt>"0"</tt> (Zero Placeholder)] Replaces <tt>"0"</tt> with the
31
+ # corresponding digit if one is present;
32
+ # otherwize, zero appears.
33
+ # [<tt>"#"</tt> (Digit Placeholder)] Replaces <tt>"#"</tt> with the
34
+ # corresponding digit if one is present;
35
+ # otherwise, no digit appears.
36
+ # [<tt>"."</tt> (Decimal Point)] Determines the location of the decimal
37
+ # separator.
38
+ # [<tt>","</tt> (Group Separator)] Serves as both a group separator if _zero_
39
+ # or _sharp_ appears between _comma_ and
40
+ # _dot_ or format strings does not include
41
+ # _dot_; otherwise, serves as number scaling
42
+ # specifier. If format strings includes a
43
+ # group separator, it inserts a group
44
+ # separater character between each group.
45
+ # Including a number scaling specifier, it
46
+ # divides a number by 1000 (it depends on
47
+ # group size) for each _comma_ specified.
48
+ # [<tt>"%"</tt> (Percentage Placeholder)] Multiplies a number by 100 and
49
+ # inserts a percentage symbol.
50
+ # [<tt>"\"</tt> (Escape Character)] Causes the next character to be
51
+ # interpreted as a literal.
52
+ # [<tt>";"</tt> (Section Separater)] Defines sections with separate format
53
+ # strings for positive, negative, and zero
54
+ # numbers.
55
+ # [Other Characters] The character is copied to the result string unchanged.
56
+ #
30
57
  # 3.141592.strfnum('0.00') # => "3.14"
31
58
  # 3.141592.strfnum('0.###') # => "3.142"
32
59
  # 3.140159.strfnum('0.###') # => "3.14"
60
+ # 3.140159.strfnum('000.00') # => "003.14"
33
61
  # 1234567.strfnum('#,##0') # => "1,234,567"
34
62
  # 1234567.strfnum('#,##0,.0') # => "1,234.6"
35
63
  # 0.56789.strfnum('0.0%') # => "56.8%"
@@ -37,6 +65,26 @@ class Numeric
37
65
  # -12345.strfnum('#,##0;*#,##0') # => "*12,345"
38
66
  # 0.001.strfnum('#,##0;-#,##0;zero') # => "zero"
39
67
  # 12345.strfnum('\##,##0') # => "#12,345"
68
+ #
69
+ #== Customizes Separater Character
70
+ # Defining following constants, customizes the separator, scaling group size
71
+ # or the percent symbol.
72
+ # [+Numeric::DECIMAL_SEPARATOR+] (+String+) A decimal separator. If undefined,
73
+ # uses <tt>"."</tt>.
74
+ # [+Numeric::GROUP_SEPARATOR+] (+String+) A number scaling separator. If
75
+ # undefined, uses <tt>","</tt>.
76
+ # [+Numeric::GROUP_SIZES+] (+Integer+) Numeric scaling group size. If
77
+ # undefined, uses 3.
78
+ # [+Numeric::PERCENT_SYMBOL+] (+String+) A percentage symbol. If undefined,
79
+ # uses <tt>"%"</tt>.
80
+ #
81
+ # Numeric::DECIMAL_SEPARATOR = ','
82
+ # Numeric::GROUP_SEPARATOR = ' '
83
+ #
84
+ # 1234567.89.strfnum('#,##0.0') # => "1 234 567,9"
85
+ #
86
+ # @param [String] format the numeric format string
87
+ # @return [String] formated string that is equivalent to this instance
40
88
  def strfnum(format)
41
89
  decimal_separator = (defined? ::Numeric::DECIMAL_SEPARATOR) ? ::Numeric::DECIMAL_SEPARATOR : '.'
42
90
  group_separator = (defined? ::Numeric::GROUP_SEPARATOR) ? ::Numeric::GROUP_SEPARATOR : ','
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dyi
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
5
- prerelease: false
6
- segments:
7
- - 1
8
- - 1
9
- - 1
10
- version: 1.1.1
4
+ prerelease:
5
+ version: 1.1.2
11
6
  platform: ruby
12
7
  authors:
13
8
  - Mamoru Yuo
@@ -15,8 +10,7 @@ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2012-02-02 00:00:00 +09:00
19
- default_executable:
13
+ date: 2012-03-01 00:00:00 Z
20
14
  dependencies: []
21
15
 
22
16
  description: " DYI is a 2D graphics library, very rich and expressive.\n DYI have been optimized for SVG format, but it is also possible\n to output other format; for example, EPS.\n"
@@ -90,7 +84,6 @@ files:
90
84
  - README
91
85
  - test/path_command_test.rb
92
86
  - test/test_length.rb
93
- has_rdoc: true
94
87
  homepage: https://sourceforge.net/projects/dyi/
95
88
  licenses:
96
89
  - GPL-3
@@ -104,25 +97,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
104
97
  requirements:
105
98
  - - ">="
106
99
  - !ruby/object:Gem::Version
107
- hash: 57
108
- segments:
109
- - 1
110
- - 8
111
- - 7
112
100
  version: 1.8.7
113
101
  required_rubygems_version: !ruby/object:Gem::Requirement
114
102
  none: false
115
103
  requirements:
116
104
  - - ">="
117
105
  - !ruby/object:Gem::Version
118
- hash: 3
119
- segments:
120
- - 0
121
106
  version: "0"
122
107
  requirements: []
123
108
 
124
109
  rubyforge_project:
125
- rubygems_version: 1.3.7
110
+ rubygems_version: 1.8.10
126
111
  signing_key:
127
112
  specification_version: 3
128
113
  summary: 2D graphics library