Sha256: 52e6a3a3c4fbb3f6090e16e43a21ddce31bc78b2dfeb54df2098229fbc748c2f

Contents?: true

Size: 1.2 KB

Versions: 8

Compression:

Stored size: 1.2 KB

Contents

# frozen_string_literal: true

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

8 entries across 8 versions & 1 rubygems

Version Path
xlsxwriter-0.2.1.pre.2 test/test-chart-pie.rb
xlsxwriter-0.2.1.pre test/test-chart-pie.rb
xlsxwriter-0.2.0 test/test-chart-pie.rb
xlsxwriter-0.2.0.pre.2 test/test-chart-pie.rb
xlsxwriter-0.2.0.pre test/test-chart-pie.rb
xlsxwriter-0.1.2.pre test/test-chart-pie.rb
xlsxwriter-0.1.1 test/test-chart-pie.rb
xlsxwriter-0.1.0 test/test-chart-pie.rb