[]
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);
booleanbooleanbooleanbooleanbooleanbooleanvoidsetShowAllFieldButtons(boolean value) voidsetShowAxisFieldButtons(boolean value) voidsetShowExpandCollapseEntireFieldButtons(boolean value) voidsetShowLegendFieldButtons(boolean value) voidsetShowReportFilterFieldButtons(boolean value) voidsetShowValueFieldButtons(boolean value) 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();
true if the report filter field buttons are displayed on the PivotChart; otherwise, false.
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);
value - true if the report filter field buttons are displayed on the PivotChart; otherwise, false.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();
true if legend field buttons are displayed on the PivotChart; otherwise, false.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);
value - true if legend field buttons are displayed on the PivotChart; otherwise, false.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();
true if the axis field buttons are displayed on the PivotChart; otherwise, false.
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);
value - true if the axis field buttons are displayed on the PivotChart; otherwise, false.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();
true if value field buttons are displayed on the PivotChart; otherwise, false.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);
value - true if value field buttons are displayed on the PivotChart; otherwise, false.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();
true if all field buttons are displayed on the PivotChart; otherwise, false.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);
value - true if all field buttons are displayed on the PivotChart; otherwise, false.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();
true if the expand entire field and collapse entire field buttons are displayed on the PivotChart; otherwise, false.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);
value - true if the expand entire field and collapse entire field buttons are displayed on the PivotChart; otherwise, false.