Code Duplication    Length = 52-52 lines in 2 locations

samples/Sample_05_Chart.php 2 locations

@@ 69-120 (lines=52) @@
66
    $shape->getLegend()->getFont()->setItalic(true);
67
}
68
69
function fnSlide_Bar(PhpPresentation $objPHPPresentation) {
70
    global $oFill;
71
    global $oShadow;
72
73
    // Create templated slide
74
    echo EOL.date('H:i:s') . ' Create templated slide'.EOL;
75
    $currentSlide = createTemplatedSlide($objPHPPresentation);
76
77
    // Generate sample data for first chart
78
    echo date('H:i:s') . ' Generate sample data for chart'.EOL;
79
    $series1Data = array('Jan' => 133, 'Feb' => 99, 'Mar' => 191, 'Apr' => 205, 'May' => 167, 'Jun' => 201, 'Jul' => 240, 'Aug' => 226, 'Sep' => 255, 'Oct' => 264, 'Nov' => 283, 'Dec' => 293);
80
    $series2Data = array('Jan' => 266, 'Feb' => 198, 'Mar' => 271, 'Apr' => 305, 'May' => 267, 'Jun' => 301, 'Jul' => 340, 'Aug' => 326, 'Sep' => 344, 'Oct' => 364, 'Nov' => 383, 'Dec' => 379);
81
82
    // Create a bar chart (that should be inserted in a shape)
83
    echo date('H:i:s') . ' Create a bar chart (that should be inserted in a chart shape)'.EOL;
84
    $barChart = new Bar();
85
    $barChart->setGapWidthPercent(158);
86
    $series1 = new Series('2009', $series1Data);
87
    $series1->setShowSeriesName(true);
88
    $series1->getFill()->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF4F81BD'));
89
    $series1->getFont()->getColor()->setRGB('00FF00');
90
    $series1->getDataPointFill(2)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFE06B20'));
91
    $series2 = new Series('2010', $series2Data);
92
    $series2->setShowSeriesName(true);
93
    $series2->getFont()->getColor()->setRGB('FF0000');
94
    $series2->getFill()->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFC0504D'));
95
    $series2->setLabelPosition(Series::LABEL_INSIDEEND);
96
    $barChart->addSeries($series1);
97
    $barChart->addSeries($series2);
98
99
    // Create a shape (chart)
100
    echo date('H:i:s') . ' Create a shape (chart)'.EOL;
101
    $shape = $currentSlide->createChartShape();
102
    $shape->setName('PHPPresentation Monthly Downloads')
103
        ->setResizeProportional(false)
104
        ->setHeight(550)
105
        ->setWidth(700)
106
        ->setOffsetX(120)
107
        ->setOffsetY(80);
108
    $shape->setShadow($oShadow);
109
    $shape->setFill($oFill);
110
    $shape->getBorder()->setLineStyle(Border::LINE_SINGLE);
111
    $shape->getTitle()->setText('PHPPresentation Monthly Downloads');
112
    $shape->getTitle()->getFont()->setItalic(true);
113
    $shape->getTitle()->getAlignment()->setHorizontal(Alignment::HORIZONTAL_RIGHT);
114
    $shape->getPlotArea()->getAxisX()->setTitle('Month');
115
    $shape->getPlotArea()->getAxisY()->getFont()->getColor()->setRGB('00FF00');
116
    $shape->getPlotArea()->getAxisY()->setTitle('Downloads');
117
    $shape->getPlotArea()->setType($barChart);
118
    $shape->getLegend()->getBorder()->setLineStyle(Border::LINE_SINGLE);
119
    $shape->getLegend()->getFont()->setItalic(true);
120
}
121
122
function fnSlide_BarHorizontal(PhpPresentation $objPHPPresentation) {
123
    global $oFill;
@@ 296-347 (lines=52) @@
293
    $shape->getLegend()->getFont()->setItalic(true);
294
}
295
296
function fnSlide_Bar3D(PhpPresentation $objPHPPresentation) {
297
    global $oFill;
298
    global $oShadow;
299
300
    // Create templated slide
301
    echo EOL.date('H:i:s') . ' Create templated slide'.EOL;
302
    $currentSlide = createTemplatedSlide($objPHPPresentation);
303
304
    // Generate sample data for first chart
305
    echo date('H:i:s') . ' Generate sample data for chart'.EOL;
306
    $series1Data = array('Jan' => 133, 'Feb' => 99, 'Mar' => 191, 'Apr' => 205, 'May' => 167, 'Jun' => 201, 'Jul' => 240, 'Aug' => 226, 'Sep' => 255, 'Oct' => 264, 'Nov' => 283, 'Dec' => 293);
307
    $series2Data = array('Jan' => 266, 'Feb' => 198, 'Mar' => 271, 'Apr' => 305, 'May' => 267, 'Jun' => 301, 'Jul' => 340, 'Aug' => 326, 'Sep' => 344, 'Oct' => 364, 'Nov' => 383, 'Dec' => 379);
308
309
    // Create a bar chart (that should be inserted in a shape)
310
    echo date('H:i:s') . ' Create a bar chart (that should be inserted in a chart shape)'.EOL;
311
    $bar3DChart = new Bar3D();
312
    $series1 = new Series('2009', $series1Data);
313
    $series1->setShowSeriesName(true);
314
    $series1->getFill()->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF4F81BD'));
315
    $series1->getFont()->getColor()->setRGB('00FF00');
316
    $series1->getDataPointFill(2)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFE06B20'));
317
    $series2 = new Series('2010', $series2Data);
318
    $series2->setShowSeriesName(true);
319
    $series2->getFont()->getColor()->setRGB('FF0000');
320
    $series2->getFill()->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFC0504D'));
321
    $bar3DChart->addSeries($series1);
322
    $bar3DChart->addSeries($series2);
323
324
    // Create a shape (chart)
325
    echo date('H:i:s') . ' Create a shape (chart)'.EOL;
326
    $shape = $currentSlide->createChartShape();
327
    $shape->setName('PHPPresentation Monthly Downloads')
328
        ->setResizeProportional(false)
329
        ->setHeight(550)
330
        ->setWidth(700)
331
        ->setOffsetX(120)
332
        ->setOffsetY(80);
333
    $shape->setShadow($oShadow);
334
    $shape->setFill($oFill);
335
    $shape->getBorder()->setLineStyle(Border::LINE_SINGLE);
336
    $shape->getTitle()->setText('PHPPresentation Monthly Downloads');
337
    $shape->getTitle()->getFont()->setItalic(true);
338
    $shape->getTitle()->getAlignment()->setHorizontal(Alignment::HORIZONTAL_RIGHT);
339
    $shape->getPlotArea()->getAxisX()->setTitle('Month');
340
    $shape->getPlotArea()->getAxisY()->setTitle('Downloads');
341
    $shape->getPlotArea()->setType($bar3DChart);
342
    $shape->getView3D()->setRightAngleAxes(true);
343
    $shape->getView3D()->setRotationX(20);
344
    $shape->getView3D()->setRotationY(20);
345
    $shape->getLegend()->getBorder()->setLineStyle(Border::LINE_SINGLE);
346
    $shape->getLegend()->getFont()->setItalic(true);
347
}
348
349
function fnSlide_Bar3DHorizontal(PhpPresentation $objPHPPresentation) {
350
    global $oFill;