DsExcel Java provides support to display #N/A cells as empty cells in charts. The setDisplayNaAsBlank method of IChart interface, when set to true, considers the cells containing #N/A values as empty cells. When setDisplayNaAsBlank is set to true, the display of empty cells, when plotted on a chart depends on the value of setDisplayBlanksAs method. The method accepts values from DisplayBlanksAs enumeration and can have following three values:
The below screenshot depicts a chart created from data containing #N/A cells which is displayed as zero because value of DisplayBlanksAs is set to 'Zero'.
Following code demonstrates a line chart showing values plotted with setDisplayNaAsBlank set to true.
Java |
Copy Code |
---|---|
// Set show blank as zero. shape.getChart().setDisplayBlanksAs(DisplayBlanksAs.Zero); // Set show #N/A as empty cell. shape.getChart().setDisplayNaAsBlank(true); shape.getChart().getChartTitle().setText("DisplayNaAsBlank:True"); |
When the setDisplayNaAsBlank method is set to false, chart plots the #N/A values depending on the chart type.