prawn-graph 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +51 -2
- data/Rakefile +16 -2
- data/lib/prawn/graph.rb +1 -4
- data/lib/prawn/graph/bar.rb +39 -143
- data/lib/prawn/graph/base.rb +207 -0
- data/lib/prawn/graph/errors.rb +2 -1
- data/lib/prawn/graph/grid.rb +5 -0
- data/lib/prawn/graph/line.rb +40 -1
- data/lib/prawn/graph/theme.rb +24 -0
- metadata +19 -312
- data/vendor/prawn-core/COPYING +0 -340
- data/vendor/prawn-core/HACKING +0 -46
- data/vendor/prawn-core/LICENSE +0 -56
- data/vendor/prawn-core/README +0 -138
- data/vendor/prawn-core/Rakefile +0 -75
- data/vendor/prawn-core/bench/afm_text_bench.rb +0 -18
- data/vendor/prawn-core/bench/png_type_6.rb +0 -15
- data/vendor/prawn-core/bench/ttf_text_bench.rb +0 -19
- data/vendor/prawn-core/bugs/indentation_across_pagebreaks.rb +0 -15
- data/vendor/prawn-core/bugs/resolved/canvas_sets_y_to_0.rb +0 -15
- data/vendor/prawn-core/bugs/resolved/png_barcode_issue.rb +0 -11
- data/vendor/prawn-core/bugs/resolved/transaction_page_number_issue_79.rb +0 -21
- data/vendor/prawn-core/bugs/resolved/ttf_fails_in_transactions.rb +0 -24
- data/vendor/prawn-core/data/encodings/win_ansi.txt +0 -29
- data/vendor/prawn-core/data/fonts/Action Man.dfont +0 -0
- data/vendor/prawn-core/data/fonts/Activa.ttf +0 -0
- data/vendor/prawn-core/data/fonts/Chalkboard.ttf +0 -0
- data/vendor/prawn-core/data/fonts/Courier-Bold.afm +0 -342
- data/vendor/prawn-core/data/fonts/Courier-BoldOblique.afm +0 -342
- data/vendor/prawn-core/data/fonts/Courier-Oblique.afm +0 -342
- data/vendor/prawn-core/data/fonts/Courier.afm +0 -342
- data/vendor/prawn-core/data/fonts/DejaVuSans.ttf +0 -0
- data/vendor/prawn-core/data/fonts/Dustismo_Roman.ttf +0 -0
- data/vendor/prawn-core/data/fonts/Helvetica-Bold.afm +0 -2827
- data/vendor/prawn-core/data/fonts/Helvetica-BoldOblique.afm +0 -2827
- data/vendor/prawn-core/data/fonts/Helvetica-Oblique.afm +0 -3051
- data/vendor/prawn-core/data/fonts/Helvetica.afm +0 -3051
- data/vendor/prawn-core/data/fonts/MustRead.html +0 -19
- data/vendor/prawn-core/data/fonts/Symbol.afm +0 -213
- data/vendor/prawn-core/data/fonts/Times-Bold.afm +0 -2588
- data/vendor/prawn-core/data/fonts/Times-BoldItalic.afm +0 -2384
- data/vendor/prawn-core/data/fonts/Times-Italic.afm +0 -2667
- data/vendor/prawn-core/data/fonts/Times-Roman.afm +0 -2419
- data/vendor/prawn-core/data/fonts/ZapfDingbats.afm +0 -225
- data/vendor/prawn-core/data/fonts/comicsans.ttf +0 -0
- data/vendor/prawn-core/data/fonts/gkai00mp.ttf +0 -0
- data/vendor/prawn-core/data/images/16bit.alpha +0 -0
- data/vendor/prawn-core/data/images/16bit.dat +0 -0
- data/vendor/prawn-core/data/images/16bit.png +0 -0
- data/vendor/prawn-core/data/images/arrow.png +0 -0
- data/vendor/prawn-core/data/images/arrow2.png +0 -0
- data/vendor/prawn-core/data/images/barcode_issue.png +0 -0
- data/vendor/prawn-core/data/images/dice.alpha +0 -0
- data/vendor/prawn-core/data/images/dice.dat +0 -0
- data/vendor/prawn-core/data/images/dice.png +0 -0
- data/vendor/prawn-core/data/images/dice_interlaced.png +0 -0
- data/vendor/prawn-core/data/images/fractal.jpg +0 -0
- data/vendor/prawn-core/data/images/letterhead.jpg +0 -0
- data/vendor/prawn-core/data/images/page_white_text.alpha +0 -0
- data/vendor/prawn-core/data/images/page_white_text.dat +0 -0
- data/vendor/prawn-core/data/images/page_white_text.png +0 -0
- data/vendor/prawn-core/data/images/pigs.jpg +0 -0
- data/vendor/prawn-core/data/images/rails.dat +0 -0
- data/vendor/prawn-core/data/images/rails.png +0 -0
- data/vendor/prawn-core/data/images/ruport.png +0 -0
- data/vendor/prawn-core/data/images/ruport_data.dat +0 -0
- data/vendor/prawn-core/data/images/ruport_transparent.png +0 -0
- data/vendor/prawn-core/data/images/ruport_type0.png +0 -0
- data/vendor/prawn-core/data/images/stef.jpg +0 -0
- data/vendor/prawn-core/data/images/tru256.bmp +0 -0
- data/vendor/prawn-core/data/images/web-links.dat +0 -1
- data/vendor/prawn-core/data/images/web-links.png +0 -0
- data/vendor/prawn-core/data/shift_jis_text.txt +0 -1
- data/vendor/prawn-core/examples/bounding_box/bounding_boxes.rb +0 -43
- data/vendor/prawn-core/examples/bounding_box/indentation.rb +0 -34
- data/vendor/prawn-core/examples/bounding_box/russian_boxes.rb +0 -36
- data/vendor/prawn-core/examples/bounding_box/stretched_nesting.rb +0 -67
- data/vendor/prawn-core/examples/column_box/column_box_example.rb +0 -43
- data/vendor/prawn-core/examples/example_helper.rb +0 -3
- data/vendor/prawn-core/examples/general/background.rb +0 -23
- data/vendor/prawn-core/examples/general/canvas.rb +0 -15
- data/vendor/prawn-core/examples/general/context_sensitive_headers.rb +0 -37
- data/vendor/prawn-core/examples/general/float.rb +0 -11
- data/vendor/prawn-core/examples/general/margin.rb +0 -36
- data/vendor/prawn-core/examples/general/measurement_units.rb +0 -51
- data/vendor/prawn-core/examples/general/metadata-info.rb +0 -16
- data/vendor/prawn-core/examples/general/multi_page_layout.rb +0 -18
- data/vendor/prawn-core/examples/general/outlines.rb +0 -50
- data/vendor/prawn-core/examples/general/page_geometry.rb +0 -31
- data/vendor/prawn-core/examples/general/page_numbering.rb +0 -15
- data/vendor/prawn-core/examples/general/repeaters.rb +0 -47
- data/vendor/prawn-core/examples/general/stamp.rb +0 -41
- data/vendor/prawn-core/examples/graphics/basic_images.rb +0 -23
- data/vendor/prawn-core/examples/graphics/cmyk.rb +0 -12
- data/vendor/prawn-core/examples/graphics/curves.rb +0 -11
- data/vendor/prawn-core/examples/graphics/hexagon.rb +0 -13
- data/vendor/prawn-core/examples/graphics/image_fit.rb +0 -15
- data/vendor/prawn-core/examples/graphics/image_flow.rb +0 -37
- data/vendor/prawn-core/examples/graphics/image_position.rb +0 -17
- data/vendor/prawn-core/examples/graphics/line.rb +0 -32
- data/vendor/prawn-core/examples/graphics/png_types.rb +0 -22
- data/vendor/prawn-core/examples/graphics/polygons.rb +0 -16
- data/vendor/prawn-core/examples/graphics/remote_images.rb +0 -12
- data/vendor/prawn-core/examples/graphics/rounded_polygons.rb +0 -19
- data/vendor/prawn-core/examples/graphics/rounded_rectangle.rb +0 -20
- data/vendor/prawn-core/examples/graphics/ruport_style_helpers.rb +0 -19
- data/vendor/prawn-core/examples/graphics/stroke_bounds.rb +0 -20
- data/vendor/prawn-core/examples/graphics/stroke_cap_and_join.rb +0 -45
- data/vendor/prawn-core/examples/graphics/stroke_dash.rb +0 -42
- data/vendor/prawn-core/examples/graphics/transformations.rb +0 -52
- data/vendor/prawn-core/examples/graphics/transparency.rb +0 -26
- data/vendor/prawn-core/examples/m17n/chinese_text_wrapping.rb +0 -17
- data/vendor/prawn-core/examples/m17n/euro.rb +0 -15
- data/vendor/prawn-core/examples/m17n/sjis.rb +0 -28
- data/vendor/prawn-core/examples/m17n/utf8.rb +0 -13
- data/vendor/prawn-core/examples/m17n/win_ansi_charset.rb +0 -54
- data/vendor/prawn-core/examples/text/alignment.rb +0 -18
- data/vendor/prawn-core/examples/text/dfont.rb +0 -48
- data/vendor/prawn-core/examples/text/family_based_styling.rb +0 -24
- data/vendor/prawn-core/examples/text/font_calculations.rb +0 -91
- data/vendor/prawn-core/examples/text/font_size.rb +0 -33
- data/vendor/prawn-core/examples/text/indent_paragraphs.rb +0 -18
- data/vendor/prawn-core/examples/text/kerning.rb +0 -30
- data/vendor/prawn-core/examples/text/rotated.rb +0 -98
- data/vendor/prawn-core/examples/text/simple_text.rb +0 -17
- data/vendor/prawn-core/examples/text/simple_text_ttf.rb +0 -17
- data/vendor/prawn-core/examples/text/span.rb +0 -29
- data/vendor/prawn-core/examples/text/text_box.rb +0 -88
- data/vendor/prawn-core/examples/text/text_box_returning_excess.rb +0 -51
- data/vendor/prawn-core/examples/text/text_flow.rb +0 -67
- data/vendor/prawn-core/lib/prawn/byte_string.rb +0 -7
- data/vendor/prawn-core/lib/prawn/compatibility.rb +0 -51
- data/vendor/prawn-core/lib/prawn/core.rb +0 -87
- data/vendor/prawn-core/lib/prawn/core/page.rb +0 -88
- data/vendor/prawn-core/lib/prawn/core/text.rb +0 -65
- data/vendor/prawn-core/lib/prawn/document.rb +0 -596
- data/vendor/prawn-core/lib/prawn/document/annotations.rb +0 -65
- data/vendor/prawn-core/lib/prawn/document/bounding_box.rb +0 -402
- data/vendor/prawn-core/lib/prawn/document/column_box.rb +0 -113
- data/vendor/prawn-core/lib/prawn/document/destinations.rb +0 -92
- data/vendor/prawn-core/lib/prawn/document/graphics_state.rb +0 -49
- data/vendor/prawn-core/lib/prawn/document/internals.rb +0 -153
- data/vendor/prawn-core/lib/prawn/document/page_geometry.rb +0 -136
- data/vendor/prawn-core/lib/prawn/document/snapshot.rb +0 -80
- data/vendor/prawn-core/lib/prawn/document/span.rb +0 -55
- data/vendor/prawn-core/lib/prawn/encoding.rb +0 -121
- data/vendor/prawn-core/lib/prawn/errors.rb +0 -83
- data/vendor/prawn-core/lib/prawn/font.rb +0 -329
- data/vendor/prawn-core/lib/prawn/font/afm.rb +0 -217
- data/vendor/prawn-core/lib/prawn/font/dfont.rb +0 -34
- data/vendor/prawn-core/lib/prawn/font/ttf.rb +0 -341
- data/vendor/prawn-core/lib/prawn/graphics.rb +0 -321
- data/vendor/prawn-core/lib/prawn/graphics/cap_style.rb +0 -38
- data/vendor/prawn-core/lib/prawn/graphics/color.rb +0 -205
- data/vendor/prawn-core/lib/prawn/graphics/dash.rb +0 -71
- data/vendor/prawn-core/lib/prawn/graphics/join_style.rb +0 -38
- data/vendor/prawn-core/lib/prawn/graphics/transformation.rb +0 -157
- data/vendor/prawn-core/lib/prawn/graphics/transparency.rb +0 -99
- data/vendor/prawn-core/lib/prawn/images.rb +0 -337
- data/vendor/prawn-core/lib/prawn/images/jpg.rb +0 -46
- data/vendor/prawn-core/lib/prawn/images/png.rb +0 -219
- data/vendor/prawn-core/lib/prawn/literal_string.rb +0 -14
- data/vendor/prawn-core/lib/prawn/measurement_extensions.rb +0 -46
- data/vendor/prawn-core/lib/prawn/measurements.rb +0 -71
- data/vendor/prawn-core/lib/prawn/name_tree.rb +0 -166
- data/vendor/prawn-core/lib/prawn/object_store.rb +0 -93
- data/vendor/prawn-core/lib/prawn/outline.rb +0 -278
- data/vendor/prawn-core/lib/prawn/pdf_object.rb +0 -83
- data/vendor/prawn-core/lib/prawn/reference.rb +0 -92
- data/vendor/prawn-core/lib/prawn/repeater.rb +0 -129
- data/vendor/prawn-core/lib/prawn/stamp.rb +0 -128
- data/vendor/prawn-core/lib/prawn/text.rb +0 -271
- data/vendor/prawn-core/lib/prawn/text/box.rb +0 -414
- data/vendor/prawn-core/meta/Rakefile +0 -36
- data/vendor/prawn-core/meta/lib/prawn.rb +0 -2
- data/vendor/prawn-core/reference_pdfs/alignment.pdf +0 -229
- data/vendor/prawn-core/reference_pdfs/background.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/basic_images.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/bounding_boxes.pdf +0 -128
- data/vendor/prawn-core/reference_pdfs/canvas.pdf +0 -78
- data/vendor/prawn-core/reference_pdfs/chinese_flow.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/cmyk.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/column_box.pdf +0 -3671
- data/vendor/prawn-core/reference_pdfs/context_sensitive_headers.pdf +0 -2331
- data/vendor/prawn-core/reference_pdfs/curves.pdf +0 -62
- data/vendor/prawn-core/reference_pdfs/dfont.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/euro.pdf +0 -75
- data/vendor/prawn-core/reference_pdfs/family_style.pdf +0 -286
- data/vendor/prawn-core/reference_pdfs/flow.pdf +0 -964
- data/vendor/prawn-core/reference_pdfs/font_calculations.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/font_size.pdf +0 -142
- data/vendor/prawn-core/reference_pdfs/hexagon.pdf +0 -61
- data/vendor/prawn-core/reference_pdfs/image-flow.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/image_fit.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/image_position.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/indentation.pdf +0 -124
- data/vendor/prawn-core/reference_pdfs/kerning.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/landscape_a4.pdf +0 -52
- data/vendor/prawn-core/reference_pdfs/landscape_legal.pdf +0 -52
- data/vendor/prawn-core/reference_pdfs/landscape_letter.pdf +0 -52
- data/vendor/prawn-core/reference_pdfs/lines.pdf +0 -116
- data/vendor/prawn-core/reference_pdfs/margin.pdf +0 -3850
- data/vendor/prawn-core/reference_pdfs/measurement_units.pdf +0 -4667
- data/vendor/prawn-core/reference_pdfs/metadata-info.pdf +0 -88
- data/vendor/prawn-core/reference_pdfs/multi-layout.pdf +0 -209
- data/vendor/prawn-core/reference_pdfs/page_with_numbering.pdf +0 -156
- data/vendor/prawn-core/reference_pdfs/png_types.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/portrait_a4.pdf +0 -52
- data/vendor/prawn-core/reference_pdfs/portrait_legal.pdf +0 -52
- data/vendor/prawn-core/reference_pdfs/portrait_letter.pdf +0 -52
- data/vendor/prawn-core/reference_pdfs/pretty_polygons.pdf +0 -122
- data/vendor/prawn-core/reference_pdfs/remote_images.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/ruport.pdf +0 -101
- data/vendor/prawn-core/reference_pdfs/russian_boxes.pdf +0 -2780
- data/vendor/prawn-core/reference_pdfs/simple_text.pdf +0 -136
- data/vendor/prawn-core/reference_pdfs/simple_text_ttf.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/sjis.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/span.pdf +0 -1975
- data/vendor/prawn-core/reference_pdfs/stamp.pdf +0 -649
- data/vendor/prawn-core/reference_pdfs/stretched_nesting.pdf +0 -200
- data/vendor/prawn-core/reference_pdfs/stroke_bounds.pdf +0 -135
- data/vendor/prawn-core/reference_pdfs/stroke_cap_and_join.pdf +0 -80
- data/vendor/prawn-core/reference_pdfs/stroke_dash.pdf +0 -457
- data/vendor/prawn-core/reference_pdfs/text_box.pdf +0 -962
- data/vendor/prawn-core/reference_pdfs/text_box_returning_excess.pdf +0 -271
- data/vendor/prawn-core/reference_pdfs/transparency.pdf +0 -347
- data/vendor/prawn-core/reference_pdfs/utf8.pdf +0 -0
- data/vendor/prawn-core/reference_pdfs/win-ansi.pdf +0 -6172
- data/vendor/prawn-core/spec/annotations_spec.rb +0 -90
- data/vendor/prawn-core/spec/bounding_box_spec.rb +0 -185
- data/vendor/prawn-core/spec/destinations_spec.rb +0 -15
- data/vendor/prawn-core/spec/document_spec.rb +0 -408
- data/vendor/prawn-core/spec/font_spec.rb +0 -314
- data/vendor/prawn-core/spec/graphics_spec.rb +0 -438
- data/vendor/prawn-core/spec/images_spec.rb +0 -79
- data/vendor/prawn-core/spec/jpg_spec.rb +0 -25
- data/vendor/prawn-core/spec/measurement_units_spec.rb +0 -23
- data/vendor/prawn-core/spec/name_tree_spec.rb +0 -112
- data/vendor/prawn-core/spec/object_store_spec.rb +0 -75
- data/vendor/prawn-core/spec/outline_spec.rb +0 -229
- data/vendor/prawn-core/spec/pdf_object_spec.rb +0 -122
- data/vendor/prawn-core/spec/png_spec.rb +0 -236
- data/vendor/prawn-core/spec/reference_spec.rb +0 -82
- data/vendor/prawn-core/spec/repeater_spec.rb +0 -96
- data/vendor/prawn-core/spec/snapshot_spec.rb +0 -138
- data/vendor/prawn-core/spec/span_spec.rb +0 -49
- data/vendor/prawn-core/spec/spec_helper.rb +0 -24
- data/vendor/prawn-core/spec/stamp_spec.rb +0 -108
- data/vendor/prawn-core/spec/stroke_styles_spec.rb +0 -152
- data/vendor/prawn-core/spec/text_at_spec.rb +0 -119
- data/vendor/prawn-core/spec/text_box_spec.rb +0 -603
- data/vendor/prawn-core/spec/text_spec.rb +0 -308
- data/vendor/prawn-core/spec/transparency_spec.rb +0 -75
- data/vendor/prawn-core/vendor/pdf-inspector/README +0 -18
- data/vendor/prawn-core/vendor/pdf-inspector/lib/pdf/inspector.rb +0 -26
- data/vendor/prawn-core/vendor/pdf-inspector/lib/pdf/inspector/extgstate.rb +0 -18
- data/vendor/prawn-core/vendor/pdf-inspector/lib/pdf/inspector/graphics.rb +0 -131
- data/vendor/prawn-core/vendor/pdf-inspector/lib/pdf/inspector/page.rb +0 -25
- data/vendor/prawn-core/vendor/pdf-inspector/lib/pdf/inspector/text.rb +0 -31
- data/vendor/prawn-core/vendor/pdf-inspector/lib/pdf/inspector/xobject.rb +0 -19
- data/vendor/prawn-core/vendor/ttfunk/data/fonts/DejaVuSans.ttf +0 -0
- data/vendor/prawn-core/vendor/ttfunk/data/fonts/comicsans.ttf +0 -0
- data/vendor/prawn-core/vendor/ttfunk/example.rb +0 -45
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk.rb +0 -102
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/directory.rb +0 -17
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/encoding/mac_roman.rb +0 -88
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/encoding/windows_1252.rb +0 -69
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/reader.rb +0 -44
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/resource_file.rb +0 -78
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/subset.rb +0 -18
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/subset/base.rb +0 -141
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/subset/mac_roman.rb +0 -46
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/subset/unicode.rb +0 -48
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/subset/unicode_8bit.rb +0 -63
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/subset/windows_1252.rb +0 -51
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/subset_collection.rb +0 -72
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table.rb +0 -46
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/cmap.rb +0 -34
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/cmap/format00.rb +0 -54
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/cmap/format04.rb +0 -126
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/cmap/subtable.rb +0 -79
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/glyf.rb +0 -64
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/glyf/compound.rb +0 -81
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/glyf/simple.rb +0 -37
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/head.rb +0 -44
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/hhea.rb +0 -41
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/hmtx.rb +0 -47
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/kern.rb +0 -79
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/kern/format0.rb +0 -62
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/loca.rb +0 -43
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/maxp.rb +0 -40
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/name.rb +0 -119
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/os2.rb +0 -78
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/post.rb +0 -91
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/post/format10.rb +0 -43
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/post/format20.rb +0 -35
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/post/format25.rb +0 -23
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/post/format30.rb +0 -17
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/post/format40.rb +0 -17
- data/vendor/prawn-core/vendor/ttfunk/lib/ttfunk/table/simple.rb +0 -14
- data/vendor/prawn-core/www/index.html +0 -196
- data/vendor/prawn-core/www/media/bounding_boxes.pdf +0 -146
- data/vendor/prawn-core/www/media/bounding_boxes.png +0 -0
- data/vendor/prawn-core/www/media/bounding_boxes_out.png +0 -0
- data/vendor/prawn-core/www/media/fancy_table.pdf +0 -350
- data/vendor/prawn-core/www/media/image.pdf +0 -0
- data/vendor/prawn-core/www/media/images.png +0 -0
- data/vendor/prawn-core/www/media/prawn_logo.png +0 -0
- data/vendor/prawn-core/www/media/tables.png +0 -0
- data/vendor/prawn-core/www/media/utf8.pdf +0 -0
- data/vendor/prawn-core/www/media/utf8.png +0 -0
- data/vendor/prawn-core/www/prawn-Chinese.html +0 -113
- data/vendor/prawn-core/www/prawn.css +0 -86
- data/vendor/prawn-core/www/twilight.css +0 -266
data/README.markdown
CHANGED
@@ -1,3 +1,52 @@
|
|
1
|
-
#
|
1
|
+
# Prawn::Graph - Easy Graphing for Prawn
|
2
2
|
|
3
|
-
|
3
|
+
Prawn::Graph copyrighted free software by Ryan Stenhouse
|
4
|
+
<ryan@ryanstenhouse.eu> with contributions form the community.
|
5
|
+
|
6
|
+
It extends Prawn::Core to add the ability for people to natively
|
7
|
+
draw graphs and charts in their PDFs.
|
8
|
+
|
9
|
+
Because Prawn::Graph only uses the native PDF drawing functions
|
10
|
+
exposed by Prawn, it removes the need to depend on projects like
|
11
|
+
Gruff to insert graphs in your documents. The results may not be
|
12
|
+
as pretty (yet), but the file-size differences are dramatic.
|
13
|
+
|
14
|
+
By default, graphs are drawn in monochrome, as that's likely how
|
15
|
+
they will be printed. You can pass an option to each of the graph
|
16
|
+
methods which will draw them in colour.
|
17
|
+
|
18
|
+
**Notice!** Much like Prawn, this software should be considered to
|
19
|
+
be in early alpha state at best. It's not recommended for use in
|
20
|
+
a production environment unless you're happy to put up with bugs and
|
21
|
+
are willing to help fix them!
|
22
|
+
|
23
|
+
## Branches
|
24
|
+
|
25
|
+
The master branch of this repository tracks edge Prawn and will
|
26
|
+
be updated to reflect any changes there. If you need to work on
|
27
|
+
a version which is compatible with the current stable release,
|
28
|
+
0.7.*, then please use the <tt>stable-compat</tt> branch instead.
|
29
|
+
|
30
|
+
## Installing & Using through RubyGems
|
31
|
+
|
32
|
+
Installing and running prawn-graph is very easy:
|
33
|
+
|
34
|
+
* <tt>gem install prawn prawn-graph</tt>
|
35
|
+
|
36
|
+
Will give you the latest 'stable' version of Prawn and the latest
|
37
|
+
compatible version of prawn-graph.
|
38
|
+
|
39
|
+
Using graphs in your PDF is as straightforward as:
|
40
|
+
|
41
|
+
<pre>
|
42
|
+
require 'rubygems'
|
43
|
+
require 'prawn/core'
|
44
|
+
require 'prawn/graph'
|
45
|
+
|
46
|
+
data = [ ['A', 10], ['B', 11], ['C' 12] ]
|
47
|
+
|
48
|
+
Prawn::Document.generate('test.pdf') do
|
49
|
+
test 'Graph Example'
|
50
|
+
bar_graph data at => [10,10]
|
51
|
+
end
|
52
|
+
</pre>
|
data/Rakefile
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'rake'
|
3
3
|
require "rake/gempackagetask"
|
4
|
+
require "rake/rdoctask"
|
4
5
|
|
5
|
-
PRAWN_GRAPH_VERSION = '0.0.
|
6
|
+
PRAWN_GRAPH_VERSION = '0.0.3'
|
6
7
|
|
7
8
|
spec = Gem::Specification.new do |spec|
|
8
9
|
spec.name = "prawn-graph"
|
@@ -17,15 +18,28 @@ spec = Gem::Specification.new do |spec|
|
|
17
18
|
spec.has_rdoc = true
|
18
19
|
spec.extra_rdoc_files = %w{README.markdown}
|
19
20
|
spec.rdoc_options << '--title' << 'Prawn Documentation' <<
|
20
|
-
'--main' << 'README
|
21
|
+
'--main' << 'README' << '-q'
|
21
22
|
spec.author = "Ryan Stenhouse"
|
22
23
|
spec.email = " ryan@ryanstenhouse.eu"
|
23
24
|
spec.rubyforge_project = "prawn"
|
25
|
+
spec.add_dependency 'prawn'
|
24
26
|
spec.homepage = "http://ryanstenhouse.eu"
|
25
27
|
spec.description = <<END_DESC
|
26
28
|
An extension to Prawn that provides the ability to draw basic graphs and charts natively in your PDFs.
|
27
29
|
END_DESC
|
28
30
|
end
|
31
|
+
|
32
|
+
desc "genrates documentation"
|
33
|
+
Rake::RDocTask.new do |rdoc|
|
34
|
+
rdoc.rdoc_files.include( "README.markdown",
|
35
|
+
"COPYING",
|
36
|
+
"LICENSE",
|
37
|
+
"HACKING", "lib/" )
|
38
|
+
rdoc.main = "README.markdown"
|
39
|
+
rdoc.rdoc_dir = "doc/html"
|
40
|
+
rdoc.title = "Prawn Documentation"
|
41
|
+
end
|
42
|
+
|
29
43
|
|
30
44
|
Rake::GemPackageTask.new(spec) do |pkg|
|
31
45
|
pkg.need_zip = true
|
data/lib/prawn/graph.rb
CHANGED
@@ -2,6 +2,7 @@ require 'bigdecimal'
|
|
2
2
|
|
3
3
|
require File.dirname(__FILE__) + '/graph/errors'
|
4
4
|
require File.dirname(__FILE__) + '/graph/chart'
|
5
|
+
require File.dirname(__FILE__) + '/graph/base'
|
5
6
|
require File.dirname(__FILE__) + '/graph/grid'
|
6
7
|
require File.dirname(__FILE__) + '/graph/bar'
|
7
8
|
require File.dirname(__FILE__) + '/graph/line'
|
@@ -10,10 +11,6 @@ module Prawn
|
|
10
11
|
|
11
12
|
class Document
|
12
13
|
|
13
|
-
# Adds compatibility with the current stable version of prawn
|
14
|
-
#
|
15
|
-
alias draw_text text
|
16
|
-
|
17
14
|
# Draws a fairly simple bar chart. Data should be passed in as an array of
|
18
15
|
# arrays, much like how Tables are dealt with:
|
19
16
|
#
|
data/lib/prawn/graph/bar.rb
CHANGED
@@ -1,48 +1,48 @@
|
|
1
1
|
module Prawn
|
2
2
|
module Chart
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
|
4
|
+
# Prawn::Chart::Bar plots its values as a Bar graph, relatively
|
5
|
+
# sized to fit within the space defined by the Prawn::Chart::Grid
|
6
|
+
# associated with it.
|
7
|
+
#
|
8
|
+
# Call to new will return a new instance of Prawn::Chart::Bar ready to
|
9
|
+
# be rendered.
|
10
|
+
#
|
11
|
+
# Takes an Array of +data+, which should contain complete rows of data for
|
12
|
+
# values to be plotted; a reference to a +document+ which should be an
|
13
|
+
# instance of Prawn::Document and an +options+ with at least a value for :at
|
14
|
+
# specified.
|
15
|
+
#
|
16
|
+
# Options are:
|
17
|
+
#
|
18
|
+
# :at , which should be an Array representing the point at which the graph
|
19
|
+
# should be drawn.
|
20
|
+
#
|
21
|
+
# :title, the title for this graph, wil be rendered centered to the top of
|
22
|
+
# the Grid.
|
23
|
+
#
|
24
|
+
# :label_x, a label to be shown along the X axis of he graph, rendered centered
|
25
|
+
# on the grid.
|
26
|
+
#
|
27
|
+
# :label_y, a label to be shown along the Y axis of he graph, rendered centered
|
28
|
+
# on the grid and rotated to be perpendicular to the axis.
|
29
|
+
#
|
30
|
+
# Data should be formatted like:
|
31
|
+
#
|
32
|
+
# [
|
33
|
+
# [ 'Column Heading', SomeValue ],
|
34
|
+
# [ 'Column Heading', SomeValue ],
|
35
|
+
# [ 'Column Heading', SomeValue ],
|
36
|
+
# [ 'Column Heading', SomeValue ],
|
37
|
+
# [ 'Column Heading', SomeValue ],
|
38
|
+
# [ 'Column Heading', SomeValue ]
|
39
|
+
# ]
|
40
|
+
#
|
41
|
+
class Bar < Base
|
6
42
|
|
7
|
-
def initialize(data, document, options = {})
|
8
|
-
if options[:at].nil? || options[:at].empty?
|
9
|
-
raise Prawn::Errors::NoGraphStartSet,
|
10
|
-
"you must specify options[:at] as the coordinates wher you" +
|
11
|
-
" wish this graph to be drawn from."
|
12
|
-
end
|
13
|
-
opts = { :width => 500, :height => 200, :spacing => 20 }.merge(options)
|
14
|
-
(@headings, @values, @highest_value) = process_the data
|
15
|
-
(grid_x_start, grid_y_start, grid_width, grid_height) = parse_sizing_from opts
|
16
|
-
@colour = (!opts[:use_color].nil? || !opts[:use_colour].nil?)
|
17
|
-
@document = document
|
18
|
-
@grid = Prawn::Chart::Grid.new(grid_x_start, grid_y_start, grid_width, grid_height, opts[:spacing], document)
|
19
|
-
end
|
20
43
|
|
21
|
-
def draw
|
22
|
-
@grid.draw
|
23
|
-
label_axes
|
24
|
-
if @title
|
25
|
-
draw_title
|
26
|
-
end
|
27
|
-
plot_values
|
28
|
-
if @x_label
|
29
|
-
draw_x_axis_label
|
30
|
-
end
|
31
|
-
if @y_label
|
32
|
-
draw_y_axis_label
|
33
|
-
end
|
34
|
-
reset
|
35
|
-
end
|
36
|
-
|
37
44
|
private
|
38
45
|
|
39
|
-
def reset
|
40
|
-
@document.line_width 1
|
41
|
-
@document.stroke_color '000000'
|
42
|
-
@document.fill_color '000000'
|
43
|
-
@document.move_to @grid.point
|
44
|
-
end
|
45
|
-
|
46
46
|
def plot_values
|
47
47
|
base_x = @grid.start_x + 1
|
48
48
|
base_y = @grid.start_y + 1
|
@@ -63,110 +63,6 @@ module Prawn
|
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
-
def label_axes
|
67
|
-
base_x = @grid.start_x + 1
|
68
|
-
base_y = @grid.start_y + 1
|
69
|
-
|
70
|
-
# Put the values up the Y Axis
|
71
|
-
#
|
72
|
-
@document.draw_text @highest_value, :at => [base_x - 15, base_y + @grid.height], :size => 5
|
73
|
-
@document.draw_text '0', :at => [base_x - 15, base_y ], :size => 5
|
74
|
-
|
75
|
-
# Put the column headings along the X Axis
|
76
|
-
#
|
77
|
-
point_spacing = calculate_plot_spacing
|
78
|
-
last_position = base_x + (point_spacing / 2)
|
79
|
-
@headings.each do |heading|
|
80
|
-
@document.draw_text heading, :at => [last_position, base_y - 15 ], :size => 5
|
81
|
-
last_position += point_spacing
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
def draw_x_axis_label
|
86
|
-
x_coord = calculate_x_axis_center_point(@x_label, 8)
|
87
|
-
y_coord = @grid.start_y - 30
|
88
|
-
@document.draw_text @x_label, :at => [x_coord, y_coord] ,:size => 8
|
89
|
-
end
|
90
|
-
|
91
|
-
def draw_y_axis_label
|
92
|
-
y_coord = calculate_y_axis_center_point(@y_label, 8)
|
93
|
-
x_coord = @grid.start_x - 30
|
94
|
-
@document.draw_text @y_label, :at => [x_coord, y_coord] ,:size => 8, :rotate => 90
|
95
|
-
end
|
96
|
-
|
97
|
-
def draw_title
|
98
|
-
x_coord = calculate_x_axis_center_point(@title, 10)
|
99
|
-
y_coord = @grid.start_y + @grid.height + 10
|
100
|
-
@document.draw_text @title, :at => [x_coord, y_coord] ,:size => 10
|
101
|
-
end
|
102
|
-
|
103
|
-
def parse_sizing_from(o)
|
104
|
-
x_offset = 15
|
105
|
-
y_offset = 0
|
106
|
-
move_y_up = 0
|
107
|
-
grid_width = o[:width]
|
108
|
-
grid_height = o[:height]
|
109
|
-
|
110
|
-
# Make room for the title if we're choosing to Render it.
|
111
|
-
#
|
112
|
-
if o[:title]
|
113
|
-
@title = o[:title]
|
114
|
-
y_offset += 10
|
115
|
-
end
|
116
|
-
|
117
|
-
# Make room for X Axis labels if we're using them.
|
118
|
-
#
|
119
|
-
if o[:label_x]
|
120
|
-
y_offset += 30
|
121
|
-
move_y_up += 30
|
122
|
-
@x_label = o[:label_x]
|
123
|
-
end
|
124
|
-
|
125
|
-
# Make room for Y Axis labels if we're using them.
|
126
|
-
#
|
127
|
-
if o[:label_y]
|
128
|
-
@y_label = o[:label_y]
|
129
|
-
x_offset += 15
|
130
|
-
end
|
131
|
-
|
132
|
-
# Return the values calculated here.
|
133
|
-
#
|
134
|
-
[ (o[:at][0] + x_offset), (o[:at][1] + move_y_up), (grid_width - x_offset), (grid_height - y_offset) ]
|
135
|
-
end
|
136
|
-
|
137
|
-
def process_the(data_array)
|
138
|
-
col = []
|
139
|
-
val = []
|
140
|
-
data_array.each { |i| val << i[1]; col << i[0] }
|
141
|
-
[ col, val ,val.sort.last ]
|
142
|
-
end
|
143
|
-
|
144
|
-
def calculate_x_axis_center_point(text, text_size, graph_start_x = @grid.start_x, graph_width = @grid.width)
|
145
|
-
((graph_start_x + (graph_width / 2)) - ((text.length * text_size) / 4))
|
146
|
-
end
|
147
|
-
alias calculate_x_axis_centre_point calculate_x_axis_center_point
|
148
|
-
|
149
|
-
def calculate_y_axis_center_point(text, text_size, graph_start_y = @grid.start_y, graph_height = @grid.height)
|
150
|
-
((graph_start_y + (graph_height / 2)) - ((text.length * text_size) / 4))
|
151
|
-
end
|
152
|
-
alias calculate_y_axis_centre_point calculate_y_axis_center_point
|
153
|
-
|
154
|
-
def calculate_plot_spacing
|
155
|
-
(@grid.width / @values.nitems)
|
156
|
-
end
|
157
|
-
|
158
|
-
def calculate_bar_width
|
159
|
-
calculate_plot_spacing / 2
|
160
|
-
end
|
161
|
-
|
162
|
-
def calculate_point_height_from(column_value)
|
163
|
-
cv = BigDecimal("#{column_value}")
|
164
|
-
hv = BigDecimal("#{@highest_value}")
|
165
|
-
gh = BigDecimal("#{@grid.height}")
|
166
|
-
percentage = (cv / (hv / 100))
|
167
|
-
((gh / 100) * percentage).to_i
|
168
|
-
end
|
169
|
-
|
170
66
|
end
|
171
67
|
end
|
172
68
|
end
|
@@ -0,0 +1,207 @@
|
|
1
|
+
module Prawn
|
2
|
+
module Chart
|
3
|
+
|
4
|
+
# Prawn::Chart::Base implements the common methods shared by most of the graphs
|
5
|
+
# and charts whcih will need to be plotted.
|
6
|
+
#
|
7
|
+
# All Prawn::Chart::Base instances and their children will have the following
|
8
|
+
# associated with them:
|
9
|
+
#
|
10
|
+
# 1. A Prawn::Chart::Grid which is where the graph will be drawn
|
11
|
+
# 2. A refernce to the Prawn::Document being affected
|
12
|
+
# 3. A set of data to be plotted.
|
13
|
+
#
|
14
|
+
# A public draw method is available which does what it says on the tin and...
|
15
|
+
# well.. draws the graph on the document it has a reference to.
|
16
|
+
#
|
17
|
+
class Base
|
18
|
+
|
19
|
+
attr_accessor :grid, :headings, :values, :highest_value, :document, :colour
|
20
|
+
|
21
|
+
# Returns a new instance of a graph to be drawn, really only useful for the
|
22
|
+
# subclasses which actually have a plot_values method declared so the data
|
23
|
+
# is actually rendered as a graph.
|
24
|
+
#
|
25
|
+
# Takes an Array of +data+, which should contain complete rows of data for
|
26
|
+
# values to be plotted; a reference to a +document+ which should be an
|
27
|
+
# instance of Prawn::Document and an +options+ with at least a value for :at
|
28
|
+
# specified.
|
29
|
+
#
|
30
|
+
# Options are:
|
31
|
+
#
|
32
|
+
# :at , which should be an Array representing the point at which the graph
|
33
|
+
# should be drawn.
|
34
|
+
#
|
35
|
+
# :title, the title for this graph, wil be rendered centered to the top of
|
36
|
+
# the Grid.
|
37
|
+
#
|
38
|
+
# :label_x, a label to be shown along the X axis of he graph, rendered centered
|
39
|
+
# on the grid.
|
40
|
+
#
|
41
|
+
# :label_y, a label to be shown along the Y axis of he graph, rendered centered
|
42
|
+
# on the grid and rotated to be perpendicular to the axis.
|
43
|
+
#
|
44
|
+
def initialize(data, document, options = {})
|
45
|
+
if options[:at].nil? || options[:at].empty?
|
46
|
+
raise Prawn::Errors::NoGraphStartSet,
|
47
|
+
"you must specify options[:at] as the coordinates wher you" +
|
48
|
+
" wish this graph to be drawn from."
|
49
|
+
end
|
50
|
+
opts = { :width => 500, :height => 200, :spacing => 20 }.merge(options)
|
51
|
+
(@headings, @values, @highest_value) = process_the data
|
52
|
+
(grid_x_start, grid_y_start, grid_width, grid_height) = parse_sizing_from opts
|
53
|
+
@colour = (!opts[:use_color].nil? || !opts[:use_colour].nil?)
|
54
|
+
@document = document
|
55
|
+
@grid = Prawn::Chart::Grid.new(grid_x_start, grid_y_start, grid_width, grid_height, opts[:spacing], document)
|
56
|
+
end
|
57
|
+
|
58
|
+
# Draws the graph on the document which we have a reference to.
|
59
|
+
#
|
60
|
+
def draw
|
61
|
+
@grid.draw
|
62
|
+
label_axes
|
63
|
+
if @title
|
64
|
+
draw_title
|
65
|
+
end
|
66
|
+
plot_values
|
67
|
+
if @x_label
|
68
|
+
draw_x_axis_label
|
69
|
+
end
|
70
|
+
if @y_label
|
71
|
+
draw_y_axis_label
|
72
|
+
end
|
73
|
+
reset
|
74
|
+
end
|
75
|
+
|
76
|
+
private
|
77
|
+
|
78
|
+
def label_axes
|
79
|
+
base_x = @grid.start_x + 1
|
80
|
+
base_y = @grid.start_y + 1
|
81
|
+
|
82
|
+
# Put the values up the Y Axis
|
83
|
+
#
|
84
|
+
@document.draw_text @highest_value, :at => [base_x - 15, base_y + @grid.height], :size => 5
|
85
|
+
@document.draw_text '0', :at => [base_x - 15, base_y ], :size => 5
|
86
|
+
|
87
|
+
# Put the column headings along the X Axis
|
88
|
+
#
|
89
|
+
point_spacing = calculate_plot_spacing
|
90
|
+
last_position = base_x + (point_spacing / 2)
|
91
|
+
@headings.each do |heading|
|
92
|
+
@document.draw_text heading, :at => [last_position, base_y - 15 ], :size => 5
|
93
|
+
last_position += point_spacing
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def draw_title
|
98
|
+
x_coord = calculate_x_axis_center_point(@title, 10)
|
99
|
+
y_coord = @grid.start_y + @grid.height + 10
|
100
|
+
@document.draw_text @title, :at => [x_coord, y_coord] ,:size => 10
|
101
|
+
end
|
102
|
+
|
103
|
+
def draw_x_axis_label
|
104
|
+
x_coord = calculate_x_axis_center_point(@x_label, 8)
|
105
|
+
y_coord = @grid.start_y - 30
|
106
|
+
@document.draw_text @x_label, :at => [x_coord, y_coord] ,:size => 8
|
107
|
+
end
|
108
|
+
|
109
|
+
def draw_y_axis_label
|
110
|
+
y_coord = calculate_y_axis_center_point(@y_label, 8)
|
111
|
+
x_coord = @grid.start_x - 30
|
112
|
+
@document.draw_text @y_label, :at => [x_coord, y_coord] ,:size => 8, :rotate => 90
|
113
|
+
end
|
114
|
+
|
115
|
+
# All subclasses of Prawn::Chart::Base must implement thier own plot_values
|
116
|
+
# method, which does the actual real heavy lifting of drawing the graph.
|
117
|
+
#
|
118
|
+
def plot_values
|
119
|
+
raise Prawn::Errors::NoPlotValuesMethod, 'subclasses of Prawn::Chart::Base must implement '
|
120
|
+
+ 'their own plot_values method.'
|
121
|
+
end
|
122
|
+
|
123
|
+
def reset
|
124
|
+
@document.line_width 1
|
125
|
+
@document.stroke_color '000000'
|
126
|
+
@document.fill_color '000000'
|
127
|
+
@document.move_to @grid.point
|
128
|
+
end
|
129
|
+
|
130
|
+
|
131
|
+
# Utility methods for dealing with working out where things should be
|
132
|
+
# the calculations and such done here are all very rough, but are
|
133
|
+
# sufficient for now to plot just what we need.
|
134
|
+
#
|
135
|
+
|
136
|
+
|
137
|
+
def parse_sizing_from(o)
|
138
|
+
x_offset = 15
|
139
|
+
y_offset = 0
|
140
|
+
move_y_up = 0
|
141
|
+
grid_width = o[:width]
|
142
|
+
grid_height = o[:height]
|
143
|
+
|
144
|
+
# Make room for the title if we're choosing to Render it.
|
145
|
+
#
|
146
|
+
if o[:title]
|
147
|
+
@title = o[:title]
|
148
|
+
y_offset += 10
|
149
|
+
end
|
150
|
+
|
151
|
+
# Make room for X Axis labels if we're using them.
|
152
|
+
#
|
153
|
+
if o[:label_x]
|
154
|
+
y_offset += 30
|
155
|
+
move_y_up += 30
|
156
|
+
@x_label = o[:label_x]
|
157
|
+
end
|
158
|
+
|
159
|
+
# Make room for Y Axis labels if we're using them.
|
160
|
+
#
|
161
|
+
if o[:label_y]
|
162
|
+
@y_label = o[:label_y]
|
163
|
+
x_offset += 15
|
164
|
+
end
|
165
|
+
|
166
|
+
# Return the values calculated here.
|
167
|
+
#
|
168
|
+
[ (o[:at][0] + x_offset), (o[:at][1] + move_y_up), (grid_width - x_offset), (grid_height - y_offset) ]
|
169
|
+
end
|
170
|
+
|
171
|
+
def process_the(data_array)
|
172
|
+
col = []
|
173
|
+
val = []
|
174
|
+
data_array.each { |i| val << i[1]; col << i[0] }
|
175
|
+
[ col, val ,val.sort.last ]
|
176
|
+
end
|
177
|
+
|
178
|
+
def calculate_x_axis_center_point(text, text_size, graph_start_x = @grid.start_x, graph_width = @grid.width)
|
179
|
+
((graph_start_x + (graph_width / 2)) - ((text.length * text_size) / 4))
|
180
|
+
end
|
181
|
+
alias calculate_x_axis_centre_point calculate_x_axis_center_point
|
182
|
+
|
183
|
+
def calculate_y_axis_center_point(text, text_size, graph_start_y = @grid.start_y, graph_height = @grid.height)
|
184
|
+
((graph_start_y + (graph_height / 2)) - ((text.length * text_size) / 4))
|
185
|
+
end
|
186
|
+
alias calculate_y_axis_centre_point calculate_y_axis_center_point
|
187
|
+
|
188
|
+
def calculate_plot_spacing
|
189
|
+
(@grid.width / @values.nitems)
|
190
|
+
end
|
191
|
+
|
192
|
+
def calculate_bar_width
|
193
|
+
calculate_plot_spacing / 2
|
194
|
+
end
|
195
|
+
|
196
|
+
def calculate_point_height_from(column_value)
|
197
|
+
cv = BigDecimal("#{column_value}")
|
198
|
+
hv = BigDecimal("#{@highest_value}")
|
199
|
+
gh = BigDecimal("#{@grid.height}")
|
200
|
+
percentage = (cv / (hv / 100))
|
201
|
+
((gh / 100) * percentage).to_i
|
202
|
+
end
|
203
|
+
|
204
|
+
|
205
|
+
end
|
206
|
+
end
|
207
|
+
end
|