lib/writeexcel/charts/bar.rb in writeexcel-0.4.1 vs lib/writeexcel/charts/bar.rb in writeexcel-0.4.2
- old
+ new
@@ -13,10 +13,12 @@
# converted to Ruby by Hideo Nakamura, cxn03651@msj.biglobe.ne.jp
#
require 'writeexcel/chart'
+module Writeexcel
+
class Chart
#
# ==SYNOPSIS
#
@@ -27,11 +29,11 @@
# require 'writeexcel'
#
# workbook = WriteExcel.new('chart.xls')
# worksheet = workbook.add_worksheet
#
- # chart = workbook.add_chart(:type => Chart::Bar)
+ # chart = workbook.add_chart(:type => 'Chart::Bar')
#
# # Configure the chart.
# chart.add_series(
# :categories => '=Sheet1!$A$2:$A$7',
# :values => '=Sheet1!$B$2:$B$7',
@@ -50,11 +52,11 @@
# ==DESCRIPTION
#
# This module implements Bar charts for WriteExcel. The chart object is
# created via the Workbook add_chart method:
#
- # chart = workbook.add_chart(:type => Chart::Bar)
+ # chart = workbook.add_chart(:type => 'Chart::Bar')
#
# Once the object is created it can be configured via the following methods
# that are common to all chart classes:
#
# chart.add_series
@@ -93,11 +95,11 @@
#
# worksheet.write('A1', headings, bold)
# worksheet.write('A2', data)
#
# # Create a new chart object. In this case an embedded chart.
- # chart = workbook.add_chart(:type => Chart::Bar, :embedded => 1)
+ # chart = workbook.add_chart(:type => 'Chart::Bar', :embedded => 1)
#
# # Configure the first series. (Sample 1)
# chart.add_series(
# :name => 'Sample 1',
# :categories => '=Sheet1!$A$2:$A$7',
@@ -148,16 +150,11 @@
length = 0x0006 # Number of bytes to follow.
pcOverlap = 0x0000 # Space between bars.
pcGap = 0x0096 # Space between cats.
grbit = 0x0001 # Option flags.
- header = [record, length].pack('vv')
- data = [pcOverlap].pack('v')
- data += [pcGap].pack('v')
- data += [grbit].pack('v')
-
- append(header, data)
+ store_simple(record, length, pcOverlap, pcGap, grbit)
end
###############################################################################
#
# _set_embedded_config_data()
@@ -173,6 +170,8 @@
@config[:x_axis_text_pos] = [ 2, 2, 0, 0, 0x17, 0x2A ]
@config[:y_axis_text] = [ 0x074A, 0x0C8F, 0x021F, 0x123, 0x81, 0x0000 ]
@config[:y_axis_text_pos] = [ 2, 2, 0, 0, 0x45, 0x17 ]
end
end
-end
+end # class Chart
+
+end # module Writeexcel