lib/writeexcel/charts/scatter.rb in writeexcel-0.4.1 vs lib/writeexcel/charts/scatter.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' +module Writeexcel + class Chart # ==SYNOPSIS # # To create a simple Excel file with a Scatter chart using WriteExcel: @@ -26,11 +28,11 @@ # require 'writeexcel' # # workbook = Spreadsheet::WriteExcel.new('chart.xls') # worksheet = workbook.add_worksheet # - # chart = workbook.add_chart(:type => Chart::Scatter) + # chart = workbook.add_chart(:type => 'Chart::Scatter') # # # Configure the chart. # chart.add_series( # :categories => '=Sheet1!$A$2:$A$7', # :values => '=Sheet1!$B$2:$B$7' @@ -49,11 +51,11 @@ # ==DESCRIPTION # # This module implements Scatter charts for WriteExcel. # The chart object is created via the Workbook add_chart() method: # - # chart = workbook.add_chart(:type => Chart::Scatter) + # chart = workbook.add_chart(:type => 'Chart::Scatter') # # Once the object is created it can be configured via the following # methods that are common to all chart classes: # # chart.add_series @@ -92,11 +94,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::Scatter, :embedded => 1) + # chart = workbook.add_chart(:type => 'Chart::Scatter', :embedded => 1) # # # Configure the first series. (Sample 1) # chart.add_series( # :name => 'Sample 1', # :categories => '=Sheet1!$A$2:$A$7', @@ -143,16 +145,11 @@ length = 0x0006 # Number of bytes to follow. bubble_ratio = 0x0064 # Bubble ratio. bubble_type = 0x0001 # Bubble type. grbit = 0x0000 # Option flags. - header = [record, length].pack('vv') - data = [bubble_ratio].pack('v') - data += [bubble_type].pack('v') - data += [grbit].pack('v') - - append(header, data) + store_simple(record, length, bubble_ratio, bubble_type, grbit) end ############################################################################### # # _store_axis_category_stream(). Overridden. @@ -188,6 +185,8 @@ store_pieformat store_markerformat(0x00, 0x00, 0x02, 0x01, 0x4D, 0x4D, 0x3C) store_end end end -end +end # class Chart + +end # module Writeexcel