{
    "content": [
        {
            "type": "text",
            "text": "# Spreadsheet::WriteExcel::Chart::Pie (perldoc)\n\n## NAME\n\nPie - A writer class for Excel Pie charts.\n\n## SYNOPSIS\n\nTo create a simple Excel file with a Pie chart using Spreadsheet::WriteExcel:\n#!/usr/bin/perl -w\nuse strict;\nuse Spreadsheet::WriteExcel;\nmy $workbook  = Spreadsheet::WriteExcel->new( 'chart.xls' );\nmy $worksheet = $workbook->addworksheet();\nmy $chart     = $workbook->addchart( type => 'pie' );\n# Configure the chart.\n$chart->addseries(\ncategories => '=Sheet1!$A$2:$A$7',\nvalues     => '=Sheet1!$B$2:$B$7',\n);\n# Add the worksheet data the chart refers to.\nmy $data = [\n[ 'Category', 2, 3, 4, 5, 6, 7 ],\n[ 'Value',    1, 4, 5, 2, 1, 5 ],\n];\n$worksheet->write( 'A1', $data );\nEND\n\n## DESCRIPTION\n\nThis module implements Pie charts for Spreadsheet::WriteExcel. The chart object is created via\nthe Workbook \"addchart()\" method:\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **Pie Chart Methods**\n- **EXAMPLE**\n- **AUTHOR**\n- **COPYRIGHT**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Spreadsheet::WriteExcel::Chart::Pie",
        "section": "",
        "mode": "perldoc",
        "summary": "Pie - A writer class for Excel Pie charts.",
        "synopsis": "To create a simple Excel file with a Pie chart using Spreadsheet::WriteExcel:\n#!/usr/bin/perl -w\nuse strict;\nuse Spreadsheet::WriteExcel;\nmy $workbook  = Spreadsheet::WriteExcel->new( 'chart.xls' );\nmy $worksheet = $workbook->addworksheet();\nmy $chart     = $workbook->addchart( type => 'pie' );\n# Configure the chart.\n$chart->addseries(\ncategories => '=Sheet1!$A$2:$A$7',\nvalues     => '=Sheet1!$B$2:$B$7',\n);\n# Add the worksheet data the chart refers to.\nmy $data = [\n[ 'Category', 2, 3, 4, 5, 6, 7 ],\n[ 'Value',    1, 4, 5, 2, 1, 5 ],\n];\n$worksheet->write( 'A1', $data );\nEND",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [
            "Here is a complete example that demonstrates most of the available features when creating a",
            "chart.",
            "#!/usr/bin/perl -w",
            "use strict;",
            "use Spreadsheet::WriteExcel;",
            "my $workbook  = Spreadsheet::WriteExcel->new( 'chartpie.xls' );",
            "my $worksheet = $workbook->addworksheet();",
            "my $bold      = $workbook->addformat( bold => 1 );",
            "# Add the worksheet data that the charts will refer to.",
            "my $headings = [ 'Category', 'Values' ];",
            "my $data = [",
            "[ 'Apple', 'Cherry', 'Pecan' ],",
            "[ 60,       30,       10     ],",
            "];",
            "$worksheet->write( 'A1', $headings, $bold );",
            "$worksheet->write( 'A2', $data );",
            "# Create a new chart object. In this case an embedded chart.",
            "my $chart = $workbook->addchart( type => 'pie', embedded => 1 );",
            "# Configure the series.",
            "$chart->addseries(",
            "name       => 'Pie sales data',",
            "categories => '=Sheet1!$A$2:$A$4',",
            "values     => '=Sheet1!$B$2:$B$4',",
            ");",
            "# Add a title.",
            "$chart->settitle( name => 'Popular Pie Types' );",
            "# Insert the chart into the worksheet (with an offset).",
            "$worksheet->insertchart( 'C2', $chart, 25, 10 );",
            "END"
        ],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 28,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 14,
                "subsections": []
            },
            {
                "name": "Pie Chart Methods",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "EXAMPLE",
                "lines": 41,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Pie - A writer class for Excel Pie charts.\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "To create a simple Excel file with a Pie chart using Spreadsheet::WriteExcel:\n\n#!/usr/bin/perl -w\n\nuse strict;\nuse Spreadsheet::WriteExcel;\n\nmy $workbook  = Spreadsheet::WriteExcel->new( 'chart.xls' );\nmy $worksheet = $workbook->addworksheet();\n\nmy $chart     = $workbook->addchart( type => 'pie' );\n\n# Configure the chart.\n$chart->addseries(\ncategories => '=Sheet1!$A$2:$A$7',\nvalues     => '=Sheet1!$B$2:$B$7',\n);\n\n# Add the worksheet data the chart refers to.\nmy $data = [\n[ 'Category', 2, 3, 4, 5, 6, 7 ],\n[ 'Value',    1, 4, 5, 2, 1, 5 ],\n];\n\n$worksheet->write( 'A1', $data );\n\nEND\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This module implements Pie charts for Spreadsheet::WriteExcel. The chart object is created via\nthe Workbook \"addchart()\" method:\n\nmy $chart = $workbook->addchart( type => 'pie' );\n\nOnce the object is created it can be configured via the following methods that are common to all\nchart classes:\n\n$chart->addseries();\n$chart->settitle();\n\nThese methods are explained in detail in Spreadsheet::WriteExcel::Chart. Class specific methods\nor settings, if any, are explained below.\n",
                "subsections": []
            },
            "Pie Chart Methods": {
                "content": "There aren't currently any pie chart specific methods. See the TODO section of\nSpreadsheet::WriteExcel::Chart.\n\nA Pie chart doesn't have an X or Y axis so the following common chart methods are ignored.\n\n$chart->setxaxis();\n$chart->setyaxis();\n",
                "subsections": []
            },
            "EXAMPLE": {
                "content": "Here is a complete example that demonstrates most of the available features when creating a\nchart.\n\n#!/usr/bin/perl -w\n\nuse strict;\nuse Spreadsheet::WriteExcel;\n\nmy $workbook  = Spreadsheet::WriteExcel->new( 'chartpie.xls' );\nmy $worksheet = $workbook->addworksheet();\nmy $bold      = $workbook->addformat( bold => 1 );\n\n# Add the worksheet data that the charts will refer to.\nmy $headings = [ 'Category', 'Values' ];\nmy $data = [\n[ 'Apple', 'Cherry', 'Pecan' ],\n[ 60,       30,       10     ],\n];\n\n$worksheet->write( 'A1', $headings, $bold );\n$worksheet->write( 'A2', $data );\n\n# Create a new chart object. In this case an embedded chart.\nmy $chart = $workbook->addchart( type => 'pie', embedded => 1 );\n\n# Configure the series.\n$chart->addseries(\nname       => 'Pie sales data',\ncategories => '=Sheet1!$A$2:$A$4',\nvalues     => '=Sheet1!$B$2:$B$4',\n);\n\n# Add a title.\n$chart->settitle( name => 'Popular Pie Types' );\n\n\n# Insert the chart into the worksheet (with an offset).\n$worksheet->insertchart( 'C2', $chart, 25, 10 );\n\nEND\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "John McNamara jmcnamara@cpan.org\n",
                "subsections": []
            },
            "COPYRIGHT": {
                "content": "Copyright MM-MMX, John McNamara.\n\nAll Rights Reserved. This module is free software. It may be used, redistributed and/or modified\nunder the same terms as Perl itself.\n",
                "subsections": []
            }
        }
    }
}