Sha256: 235f1feb1ad6b5664946a35893148d66cf7d3b2dd3def0f3620462b141ccfaf9

Contents?: true

Size: 1.17 KB

Versions: 5

Compression:

Stored size: 1.17 KB

Contents

require_relative './xlsx-func-testcase'

class TestChartPie < XlsxWriterTestCase
  DATA = [ [2, 60], [4, 30], [6, 10] ]

  test 'chart_pie02' do |wb|
    wb.add_worksheet do |ws|
      DATA.each { |row| ws.add_row row }

      wb.add_chart(XlsxWriter::Workbook::Chart::PIE) do |chart|
        chart.add_series '=Sheet1!$A$1:$A$3', '=Sheet1!$B$1:$B$3'
        chart.legend_set_font bold: true, italic: true, baseline: -1

        ws.insert_chart('E9', chart)
      end
    end
  end

  test 'chart_pie03' do |wb|
    wb.add_worksheet do |ws|
      DATA.each { |row| ws.add_row row }

      wb.add_chart(XlsxWriter::Workbook::Chart::PIE) do |chart|
        chart.add_series '=Sheet1!$A$1:$A$3', '=Sheet1!$B$1:$B$3'
        chart.legend_delete_series [1]

        ws.insert_chart('E9', chart)
      end
    end
  end

  test 'chart_pie04' do |wb|
    wb.add_worksheet do |ws|
      DATA.each { |row| ws.add_row row }

      wb.add_chart(XlsxWriter::Workbook::Chart::PIE) do |chart|
        chart.add_series '=Sheet1!$A$1:$A$3', '=Sheet1!$B$1:$B$3'
        chart.legend_position = XlsxWriter::Workbook::Chart::LEGEND_OVERLAY_RIGHT

        ws.insert_chart('E9', chart)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
xlsxwriter-0.0.6 test/test-chart-pie.rb
xlsxwriter-0.0.5 test/test-chart-pie.rb
xlsxwriter-0.0.4 test/test-chart-pie.rb
xlsxwriter-0.0.4.pre.2 test/test-chart-pie.rb
xlsxwriter-0.0.3 test/test-chart-pie.rb