ambling 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,120 @@
1
+ # Utility methods
2
+ require 'active_support'
3
+
4
+ module Ambling #:nodoc
5
+ # Utility methods when generating the settings classes from the XML
6
+ module Utils
7
+ # Stores information about the settings as derived from the XML
8
+ class SettingsSection
9
+ attr_accessor :key, :comment, :values, :attributes
10
+
11
+ def initialize(key, attributes=[])
12
+ @key = key
13
+ @comment = ""
14
+ @values = ActiveSupport::OrderedHash.new
15
+ @attributes = attributes
16
+ end
17
+
18
+ def inspect
19
+ "<SettingsSection [:key => #{@key}, :comment => #{@comment.inspect}, :values => #{@values.inspect}, :attributes => #{@attributes.inspect}]"
20
+ end
21
+
22
+ # Generate the class code
23
+ def to_class_s(indent = 0)
24
+ cdef = "\n#\n"
25
+ cdef << @comment.split(/\n/).map {|l| "# #{l.strip}"}.join("\n") << "\n"
26
+ cdef << "#\nclass #{key.camelize}\n"
27
+ cbody = "\ninclude Base\n\n"
28
+ cbody << "VALUES = [#{@values.keys.collect {|k| ':' + k}.join(',')}]\n"
29
+ cbody << "ATTRIBUTES = [#{@attributes.collect {|k| ':' + k}.join(',')}]\n" if !@attributes.empty?
30
+ subclasses = []
31
+ @values.each do |k,v|
32
+ cbody << "#\n"
33
+ cbody << v.comment.split(/\n/).map {|l| "# #{l}"}.join("\n") << "\n"
34
+ cbody << "#\nattr_accessor :#{k}\n\n"
35
+ subclasses << v if not v.values.empty?
36
+ end
37
+ @attributes.each do |a|
38
+ cbody << "#\n# xml attribute\n#\nattr_accessor :#{a}\n\n"
39
+ end
40
+ subclasses.each do |sc|
41
+ cbody << sc.to_class_s
42
+ end
43
+ indent(cdef, indent) + indent(cbody, indent + 2) + indent("\nend\n", indent)
44
+ end
45
+
46
+ # Indent the str n spaces
47
+ def indent(str, n)
48
+ str.split(/\n/).collect {|s| spaces(n) + s}.join("\n")
49
+ end
50
+
51
+ # Generate n spaces
52
+ def spaces(n)
53
+ " " * n
54
+ end
55
+ end
56
+ #
57
+ # generate a ruby class from the amchart settings XML
58
+ class SettingsGenerator
59
+ # Turn the provided xml into a class for chart_type
60
+ def generate(chart_type, xml)
61
+ require 'xmlparser'
62
+ @parser=XML::Parser.new
63
+ class <<@parser
64
+ # enable additional events
65
+ attr_accessor :comment, :xmlDecl
66
+ end
67
+
68
+ current_section_data = section_data = SettingsSection.new("xml")
69
+ section_data_stack = []
70
+ current_element = nil
71
+ last_element = nil
72
+ # Sam Ruby has code that does something very much like this
73
+ @parser.parse(xml) do |type, name, data|
74
+ case type
75
+ when XML::Parser::START_ELEM
76
+ # name = element name ; data = hash of attributes
77
+ if not current_section_data.values[name]
78
+ current_section_data.values[name] = SettingsSection.new(name, data ? data.keys : [])
79
+ end
80
+ section_data_stack << current_section_data
81
+ current_section_data = current_section_data.values[name]
82
+ current_element = name
83
+ last_element = nil
84
+ when XML::Parser::END_ELEM
85
+ # name = element name ; data = nil
86
+ end_section_data = current_section_data
87
+ current_section_data = section_data_stack.pop
88
+ last_element = current_element
89
+ current_element = nil
90
+ when XML::Parser::COMMENT
91
+ # name = nil ; data = string
92
+ if current_section_data.values.empty?
93
+ current_section_data.comment = data
94
+ else
95
+ if current_section_data.values[last_element]
96
+ current_section_data.values[last_element].comment = data
97
+ end
98
+ end
99
+ end
100
+ end
101
+
102
+ top_level = section_data.values.first.last
103
+ top_level.comment = section_data.comment if top_level.comment.blank?
104
+
105
+ cdef = "# Auto generated from XML file\n"
106
+ cdef << "require 'ambling/base'\nmodule Ambling\n class #{chart_type.to_s.camelize}\n"
107
+ cdef << top_level.to_class_s(4)
108
+ cdef << "\n end\nend\n"
109
+ end
110
+ end
111
+ end
112
+ end
113
+
114
+ if __FILE__ == $0
115
+ if 2 != ARGV.size
116
+ STDERR.puts "Usage: #{$0} chart_type settings.xml"
117
+ exit(2)
118
+ end
119
+ puts Ambling::Utils::SettingsGenerator.new.generate(ARGV.first, File.read(ARGV.last))
120
+ end
@@ -0,0 +1,3 @@
1
+ module Ambling
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,1511 @@
1
+ # Auto generated from XML file
2
+ require 'ambling/base'
3
+ module Ambling
4
+ class Xy
5
+
6
+ #
7
+ # "!" before x or y position (for example: <x>!20</x>) means that the coordinate will be calculated from the right side or the bottom
8
+ #
9
+ class Settings
10
+ include Base
11
+
12
+ VALUES = [:data_type,:csv_separator,:skip_rows,:font,:text_size,:text_color,:decimals_separator,:thousands_separator,:digits_after_decimal,:redraw,:reload_data_interval,:preloader_on_reload,:add_time_stamp,:depth,:angle,:link_target,:mask,:colors,:background,:plot_area,:grid,:values,:axes,:date_formats,:balloon,:bullets,:scroller,:zoom,:help,:legend,:export_as_image,:error_messages,:strings,:context_menu,:labels,:graphs]
13
+ #
14
+ # [xml] (xml / csv)
15
+ #
16
+ attr_accessor :data_type
17
+
18
+ #
19
+ # [;] (string) csv file data separator (you need it only if you are using csv file for your data)
20
+ #
21
+ attr_accessor :csv_separator
22
+
23
+ #
24
+ # [0] (Number) if you are using csv data type, you can set the number of rows which should be skipped here
25
+ #
26
+ attr_accessor :skip_rows
27
+
28
+ #
29
+ # [Arial] (font name) use device fonts, such as Arial, Times New Roman, Tahoma, Verdana...
30
+ #
31
+ attr_accessor :font
32
+
33
+ #
34
+ # [11] (Number) text size of all texts. Every text size can be set individually in the settings below
35
+ #
36
+ attr_accessor :text_size
37
+
38
+ #
39
+ # [#000000] (hex color code) main text color. Every text color can be set individually in the settings below
40
+ #
41
+ attr_accessor :text_color
42
+
43
+ #
44
+ # [,] (string) decimal separator. Note, that this is for displaying data only. Decimals in data xml file must be separated with a dot
45
+ #
46
+ attr_accessor :decimals_separator
47
+
48
+ #
49
+ # [ ] (string) thousand separator. use "none" if you don't want to separate
50
+ #
51
+ attr_accessor :thousands_separator
52
+
53
+ #
54
+ # [] (Number) if your value has less digits after decimal then is set here, zeroes will be added
55
+ #
56
+ attr_accessor :digits_after_decimal
57
+
58
+ #
59
+ # [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
60
+ #
61
+ attr_accessor :redraw
62
+
63
+ #
64
+ # [0] (Number) how often data should be reloaded (time in seconds)
65
+ #
66
+ attr_accessor :reload_data_interval
67
+
68
+ #
69
+ # [false] (true / false) Whether to show preloaded when data or settings are reloaded
70
+ #
71
+ attr_accessor :preloader_on_reload
72
+
73
+ #
74
+ # [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
75
+ #
76
+ attr_accessor :add_time_stamp
77
+
78
+ #
79
+ # [0] (Number) the depth of chart and columns (for 3D effect)
80
+ #
81
+ attr_accessor :depth
82
+
83
+ #
84
+ # [30] (0 - 90) angle of chart area and columns (for 3D effect)
85
+ #
86
+ attr_accessor :angle
87
+
88
+ #
89
+ # [] (_blank, _top ...)
90
+ #
91
+ attr_accessor :link_target
92
+
93
+ #
94
+ # [true] if true, bubbles, data labels will be masked within plot area. If the <zoom> is enabled, this setting is always "true"
95
+ #
96
+ attr_accessor :mask
97
+
98
+ #
99
+ # [#FF6600,#FCD202,#B0DE09,#0D8ECF,#2A0CD0,#CD0D74,#CC0000,#00CC00,#0000CC,#DDDDDD,#999999,#333333,#990000] Colors of graphs. if the graph color is not set, color from this array will be used
100
+ #
101
+ attr_accessor :colors
102
+
103
+ #
104
+ # BACKGROUND
105
+ #
106
+ attr_accessor :background
107
+
108
+ #
109
+ # PLOT AREA (the area between axes)
110
+ #
111
+ attr_accessor :plot_area
112
+
113
+ #
114
+ # GRID
115
+ #
116
+ attr_accessor :grid
117
+
118
+ #
119
+ # VALUES
120
+ #
121
+ attr_accessor :values
122
+
123
+ #
124
+ # axes
125
+ #
126
+ attr_accessor :axes
127
+
128
+ #
129
+ # these settings are important only if your axis type is date or duration
130
+ #
131
+ attr_accessor :date_formats
132
+
133
+ #
134
+ # BALLOON
135
+ #
136
+ attr_accessor :balloon
137
+
138
+ #
139
+ #
140
+ #
141
+ attr_accessor :bullets
142
+
143
+ #
144
+ #
145
+ #
146
+ attr_accessor :scroller
147
+
148
+ #
149
+ #
150
+ #
151
+ attr_accessor :zoom
152
+
153
+ #
154
+ # HELP button and balloon
155
+ #
156
+ attr_accessor :help
157
+
158
+ #
159
+ # LEGEND
160
+ #
161
+ attr_accessor :legend
162
+
163
+ #
164
+ # export_as_image feature works only on a web server
165
+ #
166
+ attr_accessor :export_as_image
167
+
168
+ #
169
+ # "error_messages" settings will be applied for all error messages except the one which is showed if settings file wasn't found
170
+ #
171
+ attr_accessor :error_messages
172
+
173
+ #
174
+ #
175
+ #
176
+ attr_accessor :strings
177
+
178
+ #
179
+ # <menu function_name="printChart" title="Print chart"></menu>
180
+ #
181
+ attr_accessor :context_menu
182
+
183
+ #
184
+ # labels can also be added in data xml file, using exactly the same structure like it is here
185
+ #
186
+ attr_accessor :labels
187
+
188
+ #
189
+ # if graph settings are defined both here and in data file, the ones from data file are used
190
+ #
191
+ attr_accessor :graphs
192
+
193
+
194
+ #
195
+ # BACKGROUND
196
+ #
197
+ class Background
198
+ include Base
199
+
200
+ VALUES = [:color,:alpha,:border_color,:border_alpha,:file]
201
+ #
202
+ # [#FFFFFF] (hex color code) Separate color codes with comas for gradient
203
+ #
204
+ attr_accessor :color
205
+
206
+ #
207
+ # [0] (0 - 100) use 0 if you are using custom swf or jpg for background
208
+ #
209
+ attr_accessor :alpha
210
+
211
+ #
212
+ # [#000000] (hex color code)
213
+ #
214
+ attr_accessor :border_color
215
+
216
+ #
217
+ # [0] (0 - 100)
218
+ #
219
+ attr_accessor :border_alpha
220
+
221
+ #
222
+ # The chart will look for this file in "path" folder ("path" is set in HTML)
223
+ #
224
+ attr_accessor :file
225
+ end
226
+ #
227
+ # PLOT AREA (the area between axes)
228
+ #
229
+ class PlotArea
230
+ include Base
231
+
232
+ VALUES = [:color,:alpha,:border_color,:border_alpha,:margins]
233
+ #
234
+ # [#FFFFFF](hex color code) Separate color codes with comas for gradient
235
+ #
236
+ attr_accessor :color
237
+
238
+ #
239
+ # [0] (0 - 100) if you want it to be different than background color, use bigger than 0 value
240
+ #
241
+ attr_accessor :alpha
242
+
243
+ #
244
+ # [#000000] (hex color code)
245
+ #
246
+ attr_accessor :border_color
247
+
248
+ #
249
+ # [0] (0 - 100)
250
+ #
251
+ attr_accessor :border_alpha
252
+
253
+ #
254
+ # plot area margins
255
+ #
256
+ attr_accessor :margins
257
+
258
+
259
+ #
260
+ # plot area margins
261
+ #
262
+ class Margins
263
+ include Base
264
+
265
+ VALUES = [:left,:top,:right,:bottom]
266
+ #
267
+ # [60](Number)
268
+ #
269
+ attr_accessor :left
270
+
271
+ #
272
+ # [60](Number)
273
+ #
274
+ attr_accessor :top
275
+
276
+ #
277
+ # [60](Number)
278
+ #
279
+ attr_accessor :right
280
+
281
+ #
282
+ # [80](Number)
283
+ #
284
+ attr_accessor :bottom
285
+ end
286
+ end
287
+ #
288
+ # GRID
289
+ #
290
+ class Grid
291
+ include Base
292
+
293
+ VALUES = [:x,:y]
294
+ #
295
+ # x axis grid
296
+ #
297
+ attr_accessor :x
298
+
299
+ #
300
+ # y axis grid
301
+ #
302
+ attr_accessor :y
303
+
304
+
305
+ #
306
+ # x axis grid
307
+ #
308
+ class X
309
+ include Base
310
+
311
+ VALUES = [:color,:alpha,:dashed,:dash_length,:approx_count,:fill_color,:fill_alpha]
312
+ #
313
+ # [#000000] (hex color code)
314
+ #
315
+ attr_accessor :color
316
+
317
+ #
318
+ # [15] (0 - 100)
319
+ #
320
+ attr_accessor :alpha
321
+
322
+ #
323
+ # [false] (true / false)
324
+ #
325
+ attr_accessor :dashed
326
+
327
+ #
328
+ # [5] (Number)
329
+ #
330
+ attr_accessor :dash_length
331
+
332
+ #
333
+ # [10] (Number) approximate number of gridlines
334
+ #
335
+ attr_accessor :approx_count
336
+
337
+ #
338
+ # [#FFFFFF] (hex color code) every second area between gridlines will be filled with this color (you will need to set fill_alpha > 0)
339
+ #
340
+ attr_accessor :fill_color
341
+
342
+ #
343
+ # [0] (0 - 100) opacity of fill
344
+ #
345
+ attr_accessor :fill_alpha
346
+ end
347
+ #
348
+ # y axis grid
349
+ #
350
+ class Y
351
+ include Base
352
+
353
+ VALUES = [:color,:enabled,:alpha,:dashed,:dash_length,:approx_count,:fill_color,:fill_alpha]
354
+ #
355
+ # [#000000] (hex color code)
356
+ #
357
+ attr_accessor :color
358
+
359
+ #
360
+ # [true] (true / false)
361
+ #
362
+ attr_accessor :enabled
363
+
364
+ #
365
+ # [15] (0 - 100)
366
+ #
367
+ attr_accessor :alpha
368
+
369
+ #
370
+ # [false] (true / false)
371
+ #
372
+ attr_accessor :dashed
373
+
374
+ #
375
+ # [5] (Number)
376
+ #
377
+ attr_accessor :dash_length
378
+
379
+ #
380
+ # [10] (Number) approximate number of gridlines
381
+ #
382
+ attr_accessor :approx_count
383
+
384
+ #
385
+ # [#FFFFFF] (hex color code) every second area between gridlines will be filled with this color (you will need to set fill_alpha > 0)
386
+ #
387
+ attr_accessor :fill_color
388
+
389
+ #
390
+ # [0] (0 - 100) opacity of fill
391
+ #
392
+ attr_accessor :fill_alpha
393
+ end
394
+ end
395
+ #
396
+ # VALUES
397
+ #
398
+ class Values
399
+ include Base
400
+
401
+ VALUES = [:x,:y]
402
+ #
403
+ # x axis
404
+ #
405
+ attr_accessor :x
406
+
407
+ #
408
+ # y axis
409
+ #
410
+ attr_accessor :y
411
+
412
+
413
+ #
414
+ # x axis
415
+ #
416
+ class X
417
+ include Base
418
+
419
+ VALUES = [:enabled,:type,:reverse,:min,:max,:strict_min_max,:frequency,:rotate,:skip_first,:skip_last,:color,:text_size,:unit,:unit_position,:integers_only,:inside]
420
+ #
421
+ # [true] (true / false)
422
+ #
423
+ attr_accessor :enabled
424
+
425
+ #
426
+ # "date" means that your axis will display dates (you must specify date formats in <date_formats>)
427
+ #
428
+ attr_accessor :type
429
+
430
+ #
431
+ # [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
432
+ #
433
+ attr_accessor :reverse
434
+
435
+ #
436
+ # [] (Number) minimum value of this axis. If empty, this value will be calculated automatically.
437
+ #
438
+ attr_accessor :min
439
+
440
+ #
441
+ # [] (Number) maximum value of this axis. If empty, this value will be calculated automatically
442
+ #
443
+ attr_accessor :max
444
+
445
+ #
446
+ # [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.
447
+ #
448
+ attr_accessor :strict_min_max
449
+
450
+ #
451
+ # [1] (Number) how often values should be placed, 1 - near every gridline, 2 - near every second gridline...
452
+ #
453
+ attr_accessor :frequency
454
+
455
+ #
456
+ # [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
457
+ #
458
+ attr_accessor :rotate
459
+
460
+ #
461
+ # [true] (true / false) to skip or not first value
462
+ #
463
+ attr_accessor :skip_first
464
+
465
+ #
466
+ # [false] (true / false) to skip or not last value
467
+ #
468
+ attr_accessor :skip_last
469
+
470
+ #
471
+ # [text_color] (hex color code)
472
+ #
473
+ attr_accessor :color
474
+
475
+ #
476
+ # [text_size] (Number)
477
+ #
478
+ attr_accessor :text_size
479
+
480
+ #
481
+ # [] (text)
482
+ #
483
+ attr_accessor :unit
484
+
485
+ #
486
+ # [right] (right / left)
487
+ #
488
+ attr_accessor :unit_position
489
+
490
+ #
491
+ # [false] (true / false) if set to true, values with decimals will be omitted
492
+ #
493
+ attr_accessor :integers_only
494
+
495
+ #
496
+ # [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)
497
+ #
498
+ attr_accessor :inside
499
+ end
500
+ #
501
+ # y axis
502
+ #
503
+ class Y
504
+ include Base
505
+
506
+ VALUES = [:enabled,:type,:reverse,:min,:max,:strict_min_max,:frequency,:rotate,:skip_first,:skip_last,:color,:text_size,:unit,:unit_position,:integers_only,:inside]
507
+ #
508
+ # [true] (true / false)
509
+ #
510
+ attr_accessor :enabled
511
+
512
+ #
513
+ # "date" means that your axis will display dates (you must specify date formats in <date_formats>)
514
+ #
515
+ attr_accessor :type
516
+
517
+ #
518
+ # [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
519
+ #
520
+ attr_accessor :reverse
521
+
522
+ #
523
+ # [] (Number) minimum value of this axis. If empty, this value will be calculated automatically.
524
+ #
525
+ attr_accessor :min
526
+
527
+ #
528
+ # [] (Number) maximum value of this axis. If empty, this value will be calculated automatically
529
+ #
530
+ attr_accessor :max
531
+
532
+ #
533
+ # [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.
534
+ #
535
+ attr_accessor :strict_min_max
536
+
537
+ #
538
+ # [1] (Number) how often values should be placed, 1 - near every gridline, 2 - near every second gridline...
539
+ #
540
+ attr_accessor :frequency
541
+
542
+ #
543
+ # [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
544
+ #
545
+ attr_accessor :rotate
546
+
547
+ #
548
+ # [true] (true / false) to skip or not first value
549
+ #
550
+ attr_accessor :skip_first
551
+
552
+ #
553
+ # [false] (true / false) to skip or not last value
554
+ #
555
+ attr_accessor :skip_last
556
+
557
+ #
558
+ # [text_color] (hex color code)
559
+ #
560
+ attr_accessor :color
561
+
562
+ #
563
+ # [text_size] (Number)
564
+ #
565
+ attr_accessor :text_size
566
+
567
+ #
568
+ # [] (text)
569
+ #
570
+ attr_accessor :unit
571
+
572
+ #
573
+ # [right] (right / left)
574
+ #
575
+ attr_accessor :unit_position
576
+
577
+ #
578
+ # [false] (true / false) if set to true, values with decimals will be omitted
579
+ #
580
+ attr_accessor :integers_only
581
+
582
+ #
583
+ # [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)
584
+ #
585
+ attr_accessor :inside
586
+ end
587
+ end
588
+ #
589
+ # axes
590
+ #
591
+ class Axes
592
+ include Base
593
+
594
+ VALUES = [:x,:y]
595
+ #
596
+ # x axis
597
+ #
598
+ attr_accessor :x
599
+
600
+ #
601
+ # y axis
602
+ #
603
+ attr_accessor :y
604
+
605
+
606
+ #
607
+ # x axis
608
+ #
609
+ class X
610
+ include Base
611
+
612
+ VALUES = [:color,:alpha,:width,:tick_length,:logarithmic]
613
+ #
614
+ # [#000000] (hex color code)
615
+ #
616
+ attr_accessor :color
617
+
618
+ #
619
+ # [100] (0 - 100)
620
+ #
621
+ attr_accessor :alpha
622
+
623
+ #
624
+ # [2] (Number) line width, 0 for hairline
625
+ #
626
+ attr_accessor :width
627
+
628
+ #
629
+ # [7] (Number)
630
+ #
631
+ attr_accessor :tick_length
632
+
633
+ #
634
+ # [false] (true / false) If set to true, this axis will use logarithmic scale instead of linear
635
+ #
636
+ attr_accessor :logarithmic
637
+ end
638
+ #
639
+ # y axis
640
+ #
641
+ class Y
642
+ include Base
643
+
644
+ VALUES = [:color,:alpha,:width,:tick_length,:logarithmic]
645
+ #
646
+ # [#000000] (hex color code)
647
+ #
648
+ attr_accessor :color
649
+
650
+ #
651
+ # [100] (0 - 100)
652
+ #
653
+ attr_accessor :alpha
654
+
655
+ #
656
+ # [2] (Number) line width, 0 for hairline
657
+ #
658
+ attr_accessor :width
659
+
660
+ #
661
+ # [7] (Number)
662
+ #
663
+ attr_accessor :tick_length
664
+
665
+ #
666
+ # [false] (true / false) If set to true, this axis will use logarithmic scale instead of linear
667
+ #
668
+ attr_accessor :logarithmic
669
+ end
670
+ end
671
+ #
672
+ # these settings are important only if your axis type is date or duration
673
+ #
674
+ class DateFormats
675
+ include Base
676
+
677
+ VALUES = [:date_input,:duration_input,:axis_values,:balloon,:data_labels]
678
+ #
679
+ # [YYYY-MM-DD hh:mm:ss] (YYYY, MM, DD, hh, mm, ss) date format of your data
680
+ #
681
+ attr_accessor :date_input
682
+
683
+ #
684
+ # [ss] (DD, mm, hh, ss) duration unit of your data (this is important only if your axis type is "duration")
685
+ #
686
+ attr_accessor :duration_input
687
+
688
+ #
689
+ # when axis type is "date", you must specify date formats for different intervals. "first" describes date format of the first grid line, "regular" - of all other grid lines
690
+ #
691
+ attr_accessor :axis_values
692
+
693
+ #
694
+ # [month DD, YYYY] balloon date format
695
+ #
696
+ attr_accessor :balloon
697
+
698
+ #
699
+ # [month DD, YYYY] data labels date format
700
+ #
701
+ attr_accessor :data_labels
702
+
703
+
704
+ #
705
+ # when axis type is "date", you must specify date formats for different intervals. "first" describes date format of the first grid line, "regular" - of all other grid lines
706
+ #
707
+ class AxisValues
708
+ include Base
709
+
710
+ VALUES = [:ss,:mm,:hh,:DD,:MM,:YYYY]
711
+ #
712
+ # [first="month DD, YYYY" regular="hh:mm:ss"] date formats when interval is second
713
+ #
714
+ attr_accessor :ss
715
+
716
+ #
717
+ # [first="month DD, YYYY" regular="hh:mm"] date formats when interval is minute
718
+ #
719
+ attr_accessor :mm
720
+
721
+ #
722
+ # [first="month DD, YYYY" regular="hh:mm"] date formats when interval is hour
723
+ #
724
+ attr_accessor :hh
725
+
726
+ #
727
+ # [first="month DD, YYYY" regular="month DD"] date formats when interval is day
728
+ #
729
+ attr_accessor :DD
730
+
731
+ #
732
+ # [first="month, YYYY" regular="month"] date formats when interval is month
733
+ #
734
+ attr_accessor :MM
735
+
736
+ #
737
+ # [first="YYYY" regular="YYYY"] date formats when interval is year
738
+ #
739
+ attr_accessor :YYYY
740
+ end
741
+ end
742
+ #
743
+ # BALLOON
744
+ #
745
+ class Balloon
746
+ include Base
747
+
748
+ VALUES = [:enabled,:color,:alpha,:text_color,:text_size,:max_width,:corner_radius,:border_width,:border_alpha,:border_color]
749
+ #
750
+ # [true] (true / false)
751
+ #
752
+ attr_accessor :enabled
753
+
754
+ #
755
+ # [] (hex color code) balloon background color. If empty, slightly darker then current column color will be used
756
+ #
757
+ attr_accessor :color
758
+
759
+ #
760
+ # [100] (0 - 100)
761
+ #
762
+ attr_accessor :alpha
763
+
764
+ #
765
+ # [#FFFFFF] (hex color code)
766
+ #
767
+ attr_accessor :text_color
768
+
769
+ #
770
+ # [text_size] (Number)
771
+ #
772
+ attr_accessor :text_size
773
+
774
+ #
775
+ # [220] (Number)
776
+ #
777
+ attr_accessor :max_width
778
+
779
+ #
780
+ # [0] (Number) Corner radius of a balloon. If you set it > 0, the balloon will not display arrow
781
+ #
782
+ attr_accessor :corner_radius
783
+
784
+ #
785
+ # [0] (Number)
786
+ #
787
+ attr_accessor :border_width
788
+
789
+ #
790
+ # [balloon.alpha] (Number)
791
+ #
792
+ attr_accessor :border_alpha
793
+
794
+ #
795
+ # [balloon.color] (hex color code)
796
+ #
797
+ attr_accessor :border_color
798
+ end
799
+ #
800
+ #
801
+ #
802
+ class Bullets
803
+ include Base
804
+
805
+ VALUES = [:hover_brightness,:grow_time,:sequenced_grow,:grow_effect]
806
+ #
807
+ # [0] (from -255 to 255) the bullet may darken/lighten when the use rolls over it. The intensity may be set here
808
+ #
809
+ attr_accessor :hover_brightness
810
+
811
+ #
812
+ # [0] (Number) the time of animation of the bullets, in seconds. Leave 0 to appear instantly
813
+ #
814
+ attr_accessor :grow_time
815
+
816
+ #
817
+ # [false] (true / false) whether to animate all bullets at the same time or one after another
818
+ #
819
+ attr_accessor :sequenced_grow
820
+
821
+ #
822
+ # [elastic] (elastic, regular, strong)
823
+ #
824
+ attr_accessor :grow_effect
825
+ end
826
+ #
827
+ #
828
+ #
829
+ class Scroller
830
+ include Base
831
+
832
+ VALUES = [:enabled,:color,:alpha,:bg_color,:bg_alpha,:height]
833
+ #
834
+ # [true] (true / false) whether to show scroller when chart is zoomed or not
835
+ #
836
+ attr_accessor :enabled
837
+
838
+ #
839
+ # [#DADADA] (hex color code) scrollbar color. Separate color codes with comas for gradient
840
+ #
841
+ attr_accessor :color
842
+
843
+ #
844
+ # [100] (Number) scrollbar alpha
845
+ #
846
+ attr_accessor :alpha
847
+
848
+ #
849
+ # [#F0F0F0] (hex color code) scroller background color. Separate color codes with comas for gradient
850
+ #
851
+ attr_accessor :bg_color
852
+
853
+ #
854
+ # [100] (Number) scroller background alpha
855
+ #
856
+ attr_accessor :bg_alpha
857
+
858
+ #
859
+ # [10] (Number) scroller height
860
+ #
861
+ attr_accessor :height
862
+ end
863
+ #
864
+ #
865
+ #
866
+ class Zoom
867
+ include Base
868
+
869
+ VALUES = [:enabled,:max_factor,:border_color,:border_alpha,:bg_color,:bg_alpha,:target]
870
+ #
871
+ # [true] (true / false) whether the user can select the area to zoom-in
872
+ #
873
+ attr_accessor :enabled
874
+
875
+ #
876
+ # [20] (Number) The maximum zoom level
877
+ #
878
+ attr_accessor :max_factor
879
+
880
+ #
881
+ # [#BBBB00] color of a zoom box border
882
+ #
883
+ attr_accessor :border_color
884
+
885
+ #
886
+ # [100] (Number) zoom box border opacity
887
+ #
888
+ attr_accessor :border_alpha
889
+
890
+ #
891
+ # [#BBBB00] zoom box background color
892
+ #
893
+ attr_accessor :bg_color
894
+
895
+ #
896
+ # [25] zoom box background opacity
897
+ #
898
+ attr_accessor :bg_alpha
899
+
900
+ #
901
+ # [true] whether to show target when the mouse is over plot area or not
902
+ #
903
+ attr_accessor :target
904
+ end
905
+ #
906
+ # HELP button and balloon
907
+ #
908
+ class Help
909
+ include Base
910
+
911
+ VALUES = [:button,:balloon]
912
+ #
913
+ # help button is only visible if balloon text is defined
914
+ #
915
+ attr_accessor :button
916
+
917
+ #
918
+ # help balloon
919
+ #
920
+ attr_accessor :balloon
921
+
922
+
923
+ #
924
+ # help button is only visible if balloon text is defined
925
+ #
926
+ class Button
927
+ include Base
928
+
929
+ VALUES = [:x,:y,:color,:alpha,:text_color,:text_color_hover,:text_size,:text]
930
+ #
931
+ # [] (Number / Number% / !Number) x position of help button, if not defined, will be aligned to right of chart area
932
+ #
933
+ attr_accessor :x
934
+
935
+ #
936
+ # [] (Number / Number% / !Number) y position of help button, if not defined, will be aligned to top of chart area
937
+ #
938
+ attr_accessor :y
939
+
940
+ #
941
+ # [#000000] (hex color code) background color
942
+ #
943
+ attr_accessor :color
944
+
945
+ #
946
+ # [100] (0 - 100) background alpha
947
+ #
948
+ attr_accessor :alpha
949
+
950
+ #
951
+ # [#FFFFFF] (hex color code) button text color
952
+ #
953
+ attr_accessor :text_color
954
+
955
+ #
956
+ # [#BBBB00](hex color code) button text roll over color
957
+ #
958
+ attr_accessor :text_color_hover
959
+
960
+ #
961
+ # [] (Number) button text size
962
+ #
963
+ attr_accessor :text_size
964
+
965
+ #
966
+ # [?] (text)
967
+ #
968
+ attr_accessor :text
969
+ end
970
+ #
971
+ # help balloon
972
+ #
973
+ class Balloon
974
+ include Base
975
+
976
+ VALUES = [:color,:alpha,:width,:text_color,:text_size,:text]
977
+ #
978
+ # [#000000] (hex color code) background color
979
+ #
980
+ attr_accessor :color
981
+
982
+ #
983
+ # [100] (0 - 100) background alpha
984
+ #
985
+ attr_accessor :alpha
986
+
987
+ #
988
+ # [300] (Number)
989
+ #
990
+ attr_accessor :width
991
+
992
+ #
993
+ # [#FFFFFF] (hex color code) button text color
994
+ #
995
+ attr_accessor :text_color
996
+
997
+ #
998
+ # [] (Number) button text size
999
+ #
1000
+ attr_accessor :text_size
1001
+
1002
+ #
1003
+ # [] (text) some html tags may be used (supports <b>, <i>, <u>, <font>, <br/>. Enter text between []: <![CDATA[your <b>bold</b> and <i>italic</i> text]]>
1004
+ #
1005
+ attr_accessor :text
1006
+ end
1007
+ end
1008
+ #
1009
+ # LEGEND
1010
+ #
1011
+ class Legend
1012
+ include Base
1013
+
1014
+ VALUES = [:enabled,:x,:y,:width,:max_columns,:color,:alpha,:border_color,:border_alpha,:text_color,:text_size,:spacing,:margins,:reverse_order,:align,:key]
1015
+ #
1016
+ # [true] (true / false)
1017
+ #
1018
+ attr_accessor :enabled
1019
+
1020
+ #
1021
+ # [] (Number / Number% / !Number) if empty, will be equal to left margin
1022
+ #
1023
+ attr_accessor :x
1024
+
1025
+ #
1026
+ # [] (Number / Number% / !Number) if empty, will be below plot area
1027
+ #
1028
+ attr_accessor :y
1029
+
1030
+ #
1031
+ # [] (Number / Number%) if empty, will be equal to plot area width
1032
+ #
1033
+ attr_accessor :width
1034
+
1035
+ #
1036
+ # [] (Number) the maximum number of columns in the legend
1037
+ #
1038
+ attr_accessor :max_columns
1039
+
1040
+ #
1041
+ # [#FFFFFF] (hex color code) background color. Separate color codes with comas for gradient
1042
+ #
1043
+ attr_accessor :color
1044
+
1045
+ #
1046
+ # [0] (0 - 100) background alpha
1047
+ #
1048
+ attr_accessor :alpha
1049
+
1050
+ #
1051
+ # [#000000] (hex color code) border color
1052
+ #
1053
+ attr_accessor :border_color
1054
+
1055
+ #
1056
+ # [0] (0 - 100) border alpha
1057
+ #
1058
+ attr_accessor :border_alpha
1059
+
1060
+ #
1061
+ # [text_color] (hex color code)
1062
+ #
1063
+ attr_accessor :text_color
1064
+
1065
+ #
1066
+ # [text_size] (Number)
1067
+ #
1068
+ attr_accessor :text_size
1069
+
1070
+ #
1071
+ # [10] (Number) vertical and horizontal gap between legend entries
1072
+ #
1073
+ attr_accessor :spacing
1074
+
1075
+ #
1076
+ # [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)
1077
+ #
1078
+ attr_accessor :margins
1079
+
1080
+ #
1081
+ # [false] (true / false) whether to sort legend entries in a reverse order
1082
+ #
1083
+ attr_accessor :reverse_order
1084
+
1085
+ #
1086
+ # [left] (left / center / right) alignment of legend entries
1087
+ #
1088
+ attr_accessor :align
1089
+
1090
+ #
1091
+ # KEY (the color box near every legend entry)
1092
+ #
1093
+ attr_accessor :key
1094
+
1095
+
1096
+ #
1097
+ # KEY (the color box near every legend entry)
1098
+ #
1099
+ class Key
1100
+ include Base
1101
+
1102
+ VALUES = [:size,:border_color]
1103
+ #
1104
+ # [16] (Number) key size
1105
+ #
1106
+ attr_accessor :size
1107
+
1108
+ #
1109
+ # [] (hex color code) leave empty if you don't want to have border
1110
+ #
1111
+ attr_accessor :border_color
1112
+ end
1113
+ end
1114
+ #
1115
+ # export_as_image feature works only on a web server
1116
+ #
1117
+ class ExportAsImage
1118
+ include Base
1119
+
1120
+ VALUES = [:file,:target,:x,:y,:color,:alpha,:text_color,:text_size]
1121
+ #
1122
+ # [] (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 amxy/export.php or amxy/export.aspx)
1123
+ #
1124
+ attr_accessor :file
1125
+
1126
+ #
1127
+ # [] (_blank, _top ...) target of a window in which export file must be called
1128
+ #
1129
+ attr_accessor :target
1130
+
1131
+ #
1132
+ # [0] (Number / Number% / !Number) x position of "Collecting data" text
1133
+ #
1134
+ attr_accessor :x
1135
+
1136
+ #
1137
+ # [] (Number / Number% / !Number) y position of "Collecting data" text. If not set, will be aligned to the bottom of flash movie
1138
+ #
1139
+ attr_accessor :y
1140
+
1141
+ #
1142
+ # [#BBBB00] (hex color code) background color of "Collecting data" text
1143
+ #
1144
+ attr_accessor :color
1145
+
1146
+ #
1147
+ # [0] (0 - 100) background alpha
1148
+ #
1149
+ attr_accessor :alpha
1150
+
1151
+ #
1152
+ # [text_color] (hex color code)
1153
+ #
1154
+ attr_accessor :text_color
1155
+
1156
+ #
1157
+ # [text_size] (Number)
1158
+ #
1159
+ attr_accessor :text_size
1160
+ end
1161
+ #
1162
+ # "error_messages" settings will be applied for all error messages except the one which is showed if settings file wasn't found
1163
+ #
1164
+ class ErrorMessages
1165
+ include Base
1166
+
1167
+ VALUES = [:enabled,:x,:y,:color,:alpha,:text_color,:text_size]
1168
+ #
1169
+ # [true] (true / false)
1170
+ #
1171
+ attr_accessor :enabled
1172
+
1173
+ #
1174
+ # [] (Number / Number% / !Number) x position of error message. If not set, will be aligned to the center
1175
+ #
1176
+ attr_accessor :x
1177
+
1178
+ #
1179
+ # [] (Number / Number% / !Number) y position of error message. If not set, will be aligned to the center
1180
+ #
1181
+ attr_accessor :y
1182
+
1183
+ #
1184
+ # [#BBBB00] (hex color code) background color of error message. Separate color codes with comas for gradient
1185
+ #
1186
+ attr_accessor :color
1187
+
1188
+ #
1189
+ # [100] (0 - 100) background alpha
1190
+ #
1191
+ attr_accessor :alpha
1192
+
1193
+ #
1194
+ # [#FFFFFF] (hex color code)
1195
+ #
1196
+ attr_accessor :text_color
1197
+
1198
+ #
1199
+ # [text_size] (Number)
1200
+ #
1201
+ attr_accessor :text_size
1202
+ end
1203
+ #
1204
+ #
1205
+ #
1206
+ class Strings
1207
+ include Base
1208
+
1209
+ VALUES = [:no_data,:export_as_image,:collecting_data,:ss,:mm,:hh,:DD,:months]
1210
+ #
1211
+ # [No data for selected period] (text) if data is missing, this message will be displayed
1212
+ #
1213
+ attr_accessor :no_data
1214
+
1215
+ #
1216
+ # [Export as image] (text) text for right click menu
1217
+ #
1218
+ attr_accessor :export_as_image
1219
+
1220
+ #
1221
+ # [Collecting data] (text) this text is displayed while exporting chart to an image
1222
+ #
1223
+ attr_accessor :collecting_data
1224
+
1225
+ #
1226
+ # [] unit of seconds
1227
+ #
1228
+ attr_accessor :ss
1229
+
1230
+ #
1231
+ # [:] unit of minutes
1232
+ #
1233
+ attr_accessor :mm
1234
+
1235
+ #
1236
+ # [:] unit of hours
1237
+ #
1238
+ attr_accessor :hh
1239
+
1240
+ #
1241
+ # [d ] unit of days
1242
+ #
1243
+ attr_accessor :DD
1244
+
1245
+ #
1246
+ #
1247
+ #
1248
+ attr_accessor :months
1249
+
1250
+
1251
+ #
1252
+ #
1253
+ #
1254
+ class Months
1255
+ include Base
1256
+
1257
+ VALUES = [:month1,:month2,:month3,:month4,:month5,:month6,:month7,:month8,:month9,:month10,:month11,:month12]
1258
+ #
1259
+ #
1260
+ #
1261
+ attr_accessor :month1
1262
+
1263
+ #
1264
+ #
1265
+ #
1266
+ attr_accessor :month2
1267
+
1268
+ #
1269
+ #
1270
+ #
1271
+ attr_accessor :month3
1272
+
1273
+ #
1274
+ #
1275
+ #
1276
+ attr_accessor :month4
1277
+
1278
+ #
1279
+ #
1280
+ #
1281
+ attr_accessor :month5
1282
+
1283
+ #
1284
+ #
1285
+ #
1286
+ attr_accessor :month6
1287
+
1288
+ #
1289
+ #
1290
+ #
1291
+ attr_accessor :month7
1292
+
1293
+ #
1294
+ #
1295
+ #
1296
+ attr_accessor :month8
1297
+
1298
+ #
1299
+ #
1300
+ #
1301
+ attr_accessor :month9
1302
+
1303
+ #
1304
+ #
1305
+ #
1306
+ attr_accessor :month10
1307
+
1308
+ #
1309
+ #
1310
+ #
1311
+ attr_accessor :month11
1312
+
1313
+ #
1314
+ #
1315
+ #
1316
+ attr_accessor :month12
1317
+ end
1318
+ end
1319
+ #
1320
+ # <menu function_name="printChart" title="Print chart"></menu>
1321
+ #
1322
+ class ContextMenu
1323
+ include Base
1324
+
1325
+ VALUES = [:default_items]
1326
+ #
1327
+ #
1328
+ #
1329
+ attr_accessor :default_items
1330
+
1331
+
1332
+ #
1333
+ #
1334
+ #
1335
+ class DefaultItems
1336
+ include Base
1337
+
1338
+ VALUES = [:zoom,:print]
1339
+ #
1340
+ # [true] (true / false) to show or not flash players zoom menu
1341
+ #
1342
+ attr_accessor :zoom
1343
+
1344
+ #
1345
+ # [true] (true / false) to show or not flash players print menu
1346
+ #
1347
+ attr_accessor :print
1348
+ end
1349
+ end
1350
+ #
1351
+ # labels can also be added in data xml file, using exactly the same structure like it is here
1352
+ #
1353
+ class Labels
1354
+ include Base
1355
+
1356
+ VALUES = [:label]
1357
+ #
1358
+ #
1359
+ #
1360
+ attr_accessor :label
1361
+
1362
+
1363
+ #
1364
+ #
1365
+ #
1366
+ class Label
1367
+ include Base
1368
+
1369
+ VALUES = [:x,:y,:rotate,:width,:align,:text_color,:text_size,:text]
1370
+ ATTRIBUTES = [:lid]
1371
+ #
1372
+ # [0] (Number / Number% / !Number)
1373
+ #
1374
+ attr_accessor :x
1375
+
1376
+ #
1377
+ # [0] (Number / Number% / !Number)
1378
+ #
1379
+ attr_accessor :y
1380
+
1381
+ #
1382
+ # [false] (true, false)
1383
+ #
1384
+ attr_accessor :rotate
1385
+
1386
+ #
1387
+ # [] (Number / Number%) if empty, will stretch from left to right untill label fits
1388
+ #
1389
+ attr_accessor :width
1390
+
1391
+ #
1392
+ # [left] (left / center / right)
1393
+ #
1394
+ attr_accessor :align
1395
+
1396
+ #
1397
+ # [text_color] (hex color code) button text color
1398
+ #
1399
+ attr_accessor :text_color
1400
+
1401
+ #
1402
+ # [text_size](Number) button text size
1403
+ #
1404
+ attr_accessor :text_size
1405
+
1406
+ #
1407
+ # [] (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]]>
1408
+ #
1409
+ attr_accessor :text
1410
+
1411
+ #
1412
+ # xml attribute
1413
+ #
1414
+ attr_accessor :lid
1415
+ end
1416
+ end
1417
+ #
1418
+ # if graph settings are defined both here and in data file, the ones from data file are used
1419
+ #
1420
+ class Graphs
1421
+ include Base
1422
+
1423
+ VALUES = [:graph]
1424
+ #
1425
+ # if you are using XML data file, graph "gid" must match graph "gid" in data file
1426
+ #
1427
+ attr_accessor :graph
1428
+
1429
+
1430
+ #
1431
+ # if you are using XML data file, graph "gid" must match graph "gid" in data file
1432
+ #
1433
+ class Graph
1434
+ include Base
1435
+
1436
+ VALUES = [:title,:color,:alpha,:width,:data_labels,:balloon_text,:bullet_max_size,:bullet_min_size,:bullet,:bullet_size,:bullet_color,:bullet_alpha,:visible_in_legend]
1437
+ ATTRIBUTES = [:gid]
1438
+ #
1439
+ # [] (graph title)
1440
+ #
1441
+ attr_accessor :title
1442
+
1443
+ #
1444
+ # [] (hex color code)
1445
+ #
1446
+ attr_accessor :color
1447
+
1448
+ #
1449
+ # [100] (0 - 100) line alpha. WIll not affect bullets. Set to 0 if you want the line to be invisible
1450
+ #
1451
+ attr_accessor :alpha
1452
+
1453
+ #
1454
+ # [0] (Number) line width
1455
+ #
1456
+ attr_accessor :width
1457
+
1458
+ #
1459
+ # [] ({title} {value} {description} {x} {y} {percents}) 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.
1460
+ #
1461
+ attr_accessor :data_labels
1462
+
1463
+ #
1464
+ # [] ({title} {value} {description} {x} {y} {percents}) 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. You can also use {title}, {value} and other tags in description.
1465
+ #
1466
+ attr_accessor :balloon_text
1467
+
1468
+ #
1469
+ # [50] maximum size of a bullet (balloon) The bullet with the highest value will be equal to this size
1470
+ #
1471
+ attr_accessor :bullet_max_size
1472
+
1473
+ #
1474
+ # [0] minimum size of a bullet (balloon)
1475
+ #
1476
+ attr_accessor :bullet_min_size
1477
+
1478
+ #
1479
+ # [] (square, round, square_outlined, round_outlined, bubble, square_outline, round_outline, x. triangle_up, triangle_down, romb 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
1480
+ #
1481
+ attr_accessor :bullet
1482
+
1483
+ #
1484
+ # [] (Number) bullet size. This param is only used if your values are not set in data file
1485
+ #
1486
+ attr_accessor :bullet_size
1487
+
1488
+ #
1489
+ # [] (hex color code) bullet color. If not defined, graph color is used
1490
+ #
1491
+ attr_accessor :bullet_color
1492
+
1493
+ #
1494
+ # [100] (Number)
1495
+ #
1496
+ attr_accessor :bullet_alpha
1497
+
1498
+ #
1499
+ # [true] (true / false) whether to show legend entry for this graph or not
1500
+ #
1501
+ attr_accessor :visible_in_legend
1502
+
1503
+ #
1504
+ # xml attribute
1505
+ #
1506
+ attr_accessor :gid
1507
+ end
1508
+ end
1509
+ end
1510
+ end
1511
+ end