Example:
//Instantiate the License class $license = new cells\License(); //Pass only the name of the license file embedded in the assembly license->setLicense("Aspose.Cells.lic"); $workbook = new cells\Workbook(); //Get cells collection $cells = $workbook->getWorksheets()->get(0)->getCells(); //Put values in cells $cells->get("A1")->putValue(1); $cells->get("A2")->putValue(2); $cells->get("A3")->putValue(3); //get charts colletion $charts = $workbook->getWorksheets()->get(0)->getCharts(); //add a new chart $index = $charts->add(cells\ChartType::COLUMN_3_D_STACKED, 5, 0, 15, 5); //get the newly added chart $chart = $charts->get($index); //set charts nseries $chart->getNSeries()->add("A1:A3", true); //Show data labels $chart->getNSeries()->get(0)->getDataLabels()->setShowValue(true); //Get chart's floor $floor = $chart->getFloor(); //set floor's border as red $floor->getBorder()->setColor(cells\Color::getRed()); //set fill format $floor->getFillFormat()->setPresetColorGradient(cells\GradientPresetType::CALM_WATER, cells\GradientStyleType::DIAGONAL_DOWN, 2);
Property Getters/Setters Summary | ||
---|---|---|
function | getBackgroundColor() | |
function | setBackgroundColor(value) | |
Gets or sets the background |
||
function | getBorder() | |
function | setBorder(value) | |
Gets or sets the border |
||
function | getFillFormat() | |
Represents a |
||
function | getForegroundColor() | |
function | setForegroundColor(value) | |
Gets or sets the foreground |
||
function | getFormatting() | |
function | setFormatting(value) | |
Represents the formatting of the area. The value of the property is FormattingType integer constant. | ||
function | getInvertIfNegative() | |
function | setInvertIfNegative(value) | |
If the property is true and the value of chart point is a negative number, the foreground color and background color will be exchanged. | ||
function | getTransparency() | |
function | setTransparency(value) | |
Returns or sets the degree of transparency of the area as a value from 0.0 (opaque) through 1.0 (clear). |
function getBorder() / function setBorder(value)
function getBackgroundColor() / function setBackgroundColor(value)
function getForegroundColor() / function setForegroundColor(value)
function getFormatting() / function setFormatting(value)
function getInvertIfNegative() / function setInvertIfNegative(value)
Example:
//Instantiating a Workbook object $workbook = new cells\Workbook(); $worksheet = $workbook->getWorksheets()->get(0); $cells = $worksheet->getCells(); $cells->get("A1")->putValue(50); $cells->get("A2")->putValue(-100); $cells->get("A3")->putValue(150); //Adding a chart to the worksheet $chartIndex = $worksheet->getCharts()->add(cells\ChartType::COLUMN, 5, 0, 15, 5); //Accessing the instance of the newly added chart $chart = $worksheet->getCharts()->get($chartIndex); //Adding NSeries (chart data source) to the chart ranging from "A1" cell to "A3" $chart->getNSeries()->add("A1:A3", true); $chart->getNSeries()->get(0)->getArea()->setInvertIfNegative(true); //Setting the foreground color of the 1st NSeries area $chart->getNSeries()->get(0)->getArea()->setForegroundColor(cells\Color::getRed()); //Setting the background color of the 1st NSeries area-> //The displayed area color of second chart point will be the background color-> $chart->getNSeries()->get(0)->getArea()->setBackgroundColor(cells\Color::getYellow());
function getFillFormat()
function getTransparency() / function setTransparency(value)