[]
        
(Showing Draft Content)

IPivotOptions

Interface IPivotOptions


public interface IPivotOptions
Represents the display options for PivotChart field buttons.

Use this interface to control whether report filter, legend, axis, value, and other field buttons are shown on a PivotChart. Obtain an IPivotOptions object from IChart.getPivotOptions().


 worksheet.getRange("A1:B4").setValue(new Object[][] {
     {"Category", "Amount"},
     {"Fruit", 100},
     {"Fruit", 200},
     {"Vegetable", 150}
 });
 IPivotCache pivotCache = workbook.getPivotCaches().create(worksheet.getRange("A1:B4"));
 IPivotTable pivotTable = worksheet.getPivotTables().add(pivotCache, worksheet.getRange("D1"));
 pivotTable.getPivotFields().get("Category").setOrientation(PivotFieldOrientation.RowField);
 pivotTable.getPivotFields().get("Amount").setOrientation(PivotFieldOrientation.DataField);
 IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 10, 10, 300, 200).getChart();
 chart.getSeriesCollection().add(pivotTable.getTableRange1());
 IPivotOptions pivotOptions = chart.getPivotOptions();
 pivotOptions.setShowLegendFieldButtons(false);
 
  • Method Details

    • getShowReportFilterFieldButtons

      boolean getShowReportFilterFieldButtons()
      Gets whether the report filter field buttons are displayed on a PivotChart.

      Report filter field buttons correspond to PivotTable page fields shown on the PivotChart. Use setShowReportFilterFieldButtons(boolean) to change this setting.

      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Region", "Amount"},
           {"East", 100},
           {"West", 200},
           {"East", 150}
       });
       IPivotCache pivotCache = workbook.getPivotCaches().create(worksheet.getRange("A1:B4"));
       IPivotTable pivotTable = worksheet.getPivotTables().add(pivotCache, worksheet.getRange("D1"), "SalesPivot");
       pivotTable.getPivotFields().get("Region").setOrientation(PivotFieldOrientation.PageField);
       pivotTable.getPivotFields().get("Amount").setOrientation(PivotFieldOrientation.DataField);
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 10, 10, 300, 200).getChart();
       chart.getSeriesCollection().add(pivotTable.getTableRange1());
       boolean showReportFilterButtons = chart.getPivotOptions().getShowReportFilterFieldButtons();
       
      Returns:
      true if the report filter field buttons are displayed on the PivotChart; otherwise, false.
    • setShowReportFilterFieldButtons

      void setShowReportFilterFieldButtons(boolean value)
      Sets whether the report filter field buttons are displayed on a PivotChart.
      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Region", "Amount"},
           {"East", 100},
           {"West", 200},
           {"East", 150}
       });
       IPivotCache pivotCache = workbook.getPivotCaches().create(worksheet.getRange("A1:B4"));
       IPivotTable pivotTable = worksheet.getPivotTables().add(pivotCache, worksheet.getRange("D1"), "SalesPivot");
       pivotTable.getPivotFields().get("Region").setOrientation(PivotFieldOrientation.PageField);
       pivotTable.getPivotFields().get("Amount").setOrientation(PivotFieldOrientation.DataField);
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 10, 10, 300, 200).getChart();
       chart.getSeriesCollection().add(pivotTable.getTableRange1());
       chart.getPivotOptions().setShowReportFilterFieldButtons(true);
       
      Parameters:
      value - true if the report filter field buttons are displayed on the PivotChart; otherwise, false.
    • getShowLegendFieldButtons

      boolean getShowLegendFieldButtons()
      Gets whether legend field buttons are displayed on a PivotChart.

      Use this method to determine the current visibility of legend field buttons for a PivotChart's IChart.getPivotOptions() settings.

      
       worksheet.getRange("A1:C4").setValue(new Object[][] {
           {"Product", "Region", "Amount"},
           {"Apple", "East", 100},
           {"Apple", "West", 200},
           {"Pear", "East", 150}
       });
       IPivotCache pivotCache = workbook.getPivotCaches().create(worksheet.getRange("A1:C4"));
       IPivotTable pivotTable = worksheet.getPivotTables().add(pivotCache, worksheet.getRange("E1"), "SalesPivot");
       pivotTable.getPivotFields().get("Product").setOrientation(PivotFieldOrientation.RowField);
       pivotTable.getPivotFields().get("Region").setOrientation(PivotFieldOrientation.ColumnField);
       pivotTable.getPivotFields().get("Amount").setOrientation(PivotFieldOrientation.DataField);
       IChart chart = worksheet.getShapes().addChartInPixel(ChartType.ColumnClustered, 0, 120, 360, 240).getChart();
       chart.setSourceData(pivotTable.getTableRange1());
       chart.getPivotOptions().setShowLegendFieldButtons(false);
       boolean showLegendFieldButtons = chart.getPivotOptions().getShowLegendFieldButtons();
       
      Returns:
      true if legend field buttons are displayed on the PivotChart; otherwise, false.
    • setShowLegendFieldButtons

      void setShowLegendFieldButtons(boolean value)
      Sets whether legend field buttons are displayed on a PivotChart.

      Use this method to determine the current visibility of legend field buttons for a PivotChart's IChart.getPivotOptions() settings.

      
       worksheet.getRange("A1:C4").setValue(new Object[][] {
           {"Product", "Region", "Amount"},
           {"Apple", "East", 100},
           {"Apple", "West", 200},
           {"Pear", "East", 150}
       });
       IPivotCache pivotCache = workbook.getPivotCaches().create(worksheet.getRange("A1:C4"));
       IPivotTable pivotTable = worksheet.getPivotTables().add(pivotCache, worksheet.getRange("E1"), "SalesPivot");
       pivotTable.getPivotFields().get("Product").setOrientation(PivotFieldOrientation.RowField);
       pivotTable.getPivotFields().get("Region").setOrientation(PivotFieldOrientation.ColumnField);
       pivotTable.getPivotFields().get("Amount").setOrientation(PivotFieldOrientation.DataField);
       IChart chart = worksheet.getShapes().addChartInPixel(ChartType.ColumnClustered, 0, 120, 360, 240).getChart();
       chart.setSourceData(pivotTable.getTableRange1());
       chart.getPivotOptions().setShowLegendFieldButtons(false);
       
      Parameters:
      value - true if legend field buttons are displayed on the PivotChart; otherwise, false.
    • getShowAxisFieldButtons

      boolean getShowAxisFieldButtons()
      Gets whether the axis field buttons are displayed on a PivotChart.

      Axis field buttons appear on a PivotChart and provide access to the field's filter controls. Use setShowAxisFieldButtons(boolean) to change this setting.

      
       Object[][] sourceData = {{"Category", "Amount"}, {"Beverages", 100}, {"Snacks", 200}};
       worksheet.getRange("A1:B3").setValue(sourceData);
       IPivotCache pivotCache = workbook.getPivotCaches().create(worksheet.getRange("A1:B3"));
       IPivotTable pivotTable = worksheet.getPivotTables().add(pivotCache, worksheet.getRange("D1"), "SalesPivot");
       pivotTable.getPivotFields().get("Category").setOrientation(PivotFieldOrientation.RowField);
       pivotTable.getPivotFields().get("Amount").setOrientation(PivotFieldOrientation.DataField);
       IChart chart = worksheet.getShapes().addChartInPixel(ChartType.ColumnClustered, 0, 100, 360, 240).getChart();
       chart.setSourceData(pivotTable.getTableRange1());
       boolean showAxisButtons = chart.getPivotOptions().getShowAxisFieldButtons();
       
      Returns:
      true if the axis field buttons are displayed on the PivotChart; otherwise, false.
    • setShowAxisFieldButtons

      void setShowAxisFieldButtons(boolean value)
      Sets whether the axis field buttons are displayed on a PivotChart.
      
       Object[][] sourceData = {{"Category", "Amount"}, {"Beverages", 100}, {"Snacks", 200}};
       worksheet.getRange("A1:B3").setValue(sourceData);
       IPivotCache pivotCache = workbook.getPivotCaches().create(worksheet.getRange("A1:B3"));
       IPivotTable pivotTable = worksheet.getPivotTables().add(pivotCache, worksheet.getRange("D1"), "SalesPivot");
       pivotTable.getPivotFields().get("Category").setOrientation(PivotFieldOrientation.RowField);
       pivotTable.getPivotFields().get("Amount").setOrientation(PivotFieldOrientation.DataField);
       IChart chart = worksheet.getShapes().addChartInPixel(ChartType.ColumnClustered, 0, 100, 360, 240).getChart();
       chart.setSourceData(pivotTable.getTableRange1());
       chart.getPivotOptions().setShowAxisFieldButtons(true);
       
      Parameters:
      value - true if the axis field buttons are displayed on the PivotChart; otherwise, false.
    • getShowValueFieldButtons

      boolean getShowValueFieldButtons()
      Gets whether value field buttons are displayed on a PivotChart.

      This method returns the current visibility setting for value field buttons in the IChart.getPivotOptions() object of a PivotChart.

      
       worksheet.getRange("A1:D5").setValue(new Object[][] {
           {"Category", "Country", "Amount", "Order ID"},
           {"Beverages", "United States", 100, 1},
           {"Beverages", "Canada", 200, 2},
           {"Snacks", "United States", 150, 3}
       });
       IPivotCache pivotCache = workbook.getPivotCaches().create(worksheet.getRange("A1:D5"));
       IPivotTable pivotTable = worksheet.getPivotTables().add(pivotCache, worksheet.getRange("F1"), "PivotTable1");
       pivotTable.getPivotFields().get("Category").setOrientation(PivotFieldOrientation.RowField);
       pivotTable.getPivotFields().get("Amount").setOrientation(PivotFieldOrientation.DataField);
       IChart chart = worksheet.getShapes().addChartInPixel(ChartType.ColumnClustered, 0, 120, 400, 240).getChart();
       chart.setSourceData(pivotTable.getTableRange1());
       boolean showValueFieldButtons = chart.getPivotOptions().getShowValueFieldButtons();
       
      Returns:
      true if value field buttons are displayed on the PivotChart; otherwise, false.
    • setShowValueFieldButtons

      void setShowValueFieldButtons(boolean value)
      Sets whether value field buttons are displayed on a PivotChart.

      This method Sets the current visibility setting for value field buttons in the IChart.getPivotOptions() object of a PivotChart.

      
       worksheet.getRange("A1:D5").setValue(new Object[][] {
           {"Category", "Country", "Amount", "Order ID"},
           {"Beverages", "United States", 100, 1},
           {"Beverages", "Canada", 200, 2},
           {"Snacks", "United States", 150, 3}
       });
       IPivotCache pivotCache = workbook.getPivotCaches().create(worksheet.getRange("A1:D5"));
       IPivotTable pivotTable = worksheet.getPivotTables().add(pivotCache, worksheet.getRange("F1"), "PivotTable1");
       pivotTable.getPivotFields().get("Category").setOrientation(PivotFieldOrientation.RowField);
       pivotTable.getPivotFields().get("Amount").setOrientation(PivotFieldOrientation.DataField);
       IChart chart = worksheet.getShapes().addChartInPixel(ChartType.ColumnClustered, 0, 120, 400, 240).getChart();
       chart.setSourceData(pivotTable.getTableRange1());
       chart.getPivotOptions().setShowValueFieldButtons(true);
       
      Parameters:
      value - true if value field buttons are displayed on the PivotChart; otherwise, false.
    • getShowAllFieldButtons

      boolean getShowAllFieldButtons()
      Gets whether all field buttons are displayed on a PivotChart.

      Field buttons include the interactive buttons shown on a PivotChart for filtering and expanding PivotTable fields.

      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Category", "Amount"},
           {"Fruit", 100},
           {"Fruit", 200},
           {"Vegetable", 150}
       });
       IPivotCache pivotCache = workbook.getPivotCaches().create(worksheet.getRange("A1:B4"));
       IPivotTable pivotTable = worksheet.getPivotTables().add(pivotCache, worksheet.getRange("D1"));
       pivotTable.getPivotFields().get("Category").setOrientation(PivotFieldOrientation.RowField);
       pivotTable.getPivotFields().get("Amount").setOrientation(PivotFieldOrientation.DataField);
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 10, 10, 300, 200).getChart();
       chart.getSeriesCollection().add(pivotTable.getTableRange1());
       chart.getPivotOptions().setShowAllFieldButtons(false);
       boolean showAllFieldButtons = chart.getPivotOptions().getShowAllFieldButtons();
       
      Returns:
      true if all field buttons are displayed on the PivotChart; otherwise, false.
    • setShowAllFieldButtons

      void setShowAllFieldButtons(boolean value)
      Sets whether all field buttons are displayed on a PivotChart.

      Field buttons include the interactive buttons shown on a PivotChart for filtering and expanding PivotTable fields.

      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Category", "Amount"},
           {"Fruit", 100},
           {"Fruit", 200},
           {"Vegetable", 150}
       });
       IPivotCache pivotCache = workbook.getPivotCaches().create(worksheet.getRange("A1:B4"));
       IPivotTable pivotTable = worksheet.getPivotTables().add(pivotCache, worksheet.getRange("D1"));
       pivotTable.getPivotFields().get("Category").setOrientation(PivotFieldOrientation.RowField);
       pivotTable.getPivotFields().get("Amount").setOrientation(PivotFieldOrientation.DataField);
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 10, 10, 300, 200).getChart();
       chart.getSeriesCollection().add(pivotTable.getTableRange1());
       chart.getPivotOptions().setShowAllFieldButtons(false);
       
      Parameters:
      value - true if all field buttons are displayed on the PivotChart; otherwise, false.
    • getShowExpandCollapseEntireFieldButtons

      boolean getShowExpandCollapseEntireFieldButtons()
      Gets whether the expand entire field and collapse entire field buttons are displayed on a PivotChart.

      These buttons let users expand or collapse an entire field directly from the PivotChart.

      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Category", "Amount"},
           {"Fruit", 100},
           {"Fruit", 200},
           {"Vegetable", 150}
       });
       IPivotCache pivotCache = workbook.getPivotCaches().create(worksheet.getRange("A1:B4"));
       IPivotTable pivotTable = worksheet.getPivotTables().add(pivotCache, worksheet.getRange("D1"));
       pivotTable.getPivotFields().get("Category").setOrientation(PivotFieldOrientation.RowField);
       pivotTable.getPivotFields().get("Amount").setOrientation(PivotFieldOrientation.DataField);
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 10, 10, 300, 200).getChart();
       chart.getSeriesCollection().add(pivotTable.getTableRange1());
       chart.getPivotOptions().setShowExpandCollapseEntireFieldButtons(true);
       boolean showExpandCollapseButtons = chart.getPivotOptions().getShowExpandCollapseEntireFieldButtons();
       
      Returns:
      true if the expand entire field and collapse entire field buttons are displayed on the PivotChart; otherwise, false.
    • setShowExpandCollapseEntireFieldButtons

      void setShowExpandCollapseEntireFieldButtons(boolean value)
      Sets whether the expand entire field and collapse entire field buttons are displayed on a PivotChart.

      These buttons let users expand or collapse an entire field directly from the PivotChart.

      
       worksheet.getRange("A1:B4").setValue(new Object[][] {
           {"Category", "Amount"},
           {"Fruit", 100},
           {"Fruit", 200},
           {"Vegetable", 150}
       });
       IPivotCache pivotCache = workbook.getPivotCaches().create(worksheet.getRange("A1:B4"));
       IPivotTable pivotTable = worksheet.getPivotTables().add(pivotCache, worksheet.getRange("D1"));
       pivotTable.getPivotFields().get("Category").setOrientation(PivotFieldOrientation.RowField);
       pivotTable.getPivotFields().get("Amount").setOrientation(PivotFieldOrientation.DataField);
       IChart chart = worksheet.getShapes().addChart(ChartType.ColumnClustered, 10, 10, 300, 200).getChart();
       chart.getSeriesCollection().add(pivotTable.getTableRange1());
       chart.getPivotOptions().setShowExpandCollapseEntireFieldButtons(true);
       
      Parameters:
      value - true if the expand entire field and collapse entire field buttons are displayed on the PivotChart; otherwise, false.