Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data Label Positions not working for Doughnut Chart #791

Open
alaglil opened this issue Feb 8, 2024 · 0 comments
Open

Data Label Positions not working for Doughnut Chart #791

alaglil opened this issue Feb 8, 2024 · 0 comments

Comments

@alaglil
Copy link

alaglil commented Feb 8, 2024

When I added $series->setLabelPosition(Series::LABEL OUTSIDE END); it doesn't change anything

`
// Generate sample data for second chart
echo date('H:i:s') . ' Generate sample data for chart' . EOL;
$seriesData = ['Monday' => 18, 'Tuesday' => 23, 'Wednesday' => 14, 'Thursday' => 12, 'Friday' => 20, 'Saturday' => 8, 'Sunday' => 10];

// Create a doughnut chart (that should be inserted in a shape)
echo date('H:i:s') . ' Create a non-3D Doughnut chart (that should be inserted in a chart shape)' . EOL;
$doughnutChart = new Doughnut();
$doughnutChart->setHoleSize(43);
$series = new Series('Downloads', $seriesData);
$series->getDataPointFill(0)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF7CB5EC'));
$series->getDataPointFill(1)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF434348'));
$series->getDataPointFill(2)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF90ED7D'));
$series->getDataPointFill(3)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFF7A35C'));
$series->getDataPointFill(4)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF8085E9'));
$series->getDataPointFill(5)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFF15C80'));
$series->getDataPointFill(6)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFE4D354'));

$series->setLabelPosition(Series::LABEL_OUTSIDEEND);

$series->setShowPercentage(true);
$series->setShowValue(false);
$series->setShowSeriesName(false);
$series->setShowCategoryName(true);
$series->setDlblNumFormat('%d');
$series->setSeparator(' > ');
$series->getFont()->getColor()->setRGB('FFFF00');
$series->getFont()->setBold(true);
$doughnutChart->addSeries($series);

// Create a shape (chart)
echo date('H:i:s') . ' Create a shape (chart)' . EOL;
$shape = $currentSlide->createChartShape();
$shape->setName('PHPPresentation Daily Downloads')
    ->setResizeProportional(false)
    ->setHeight(550)
    ->setWidth(700)
    ->setOffsetX(120)
    ->setOffsetY(80);
$shape->setShadow($oShadow);
$shape->setFill($oFill);
$shape->getBorder()->setLineStyle(Border::LINE_SINGLE);
$shape->getTitle()->setText('PHPPresentation Daily Downloads');
$shape->getTitle()->getFont()->setItalic(true);
$shape->getPlotArea()->setType($doughnutChart);
$shape->getLegend()->getBorder()->setLineStyle(Border::LINE_SINGLE);
$shape->getLegend()->getFont()->setItalic(true);
$shape->getLegend()->setPosition(Legend::POSITION_LEFT);

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants