}
$pChart->addPoints(array(get_tile_total_count($tile_colour_results, 0), get_tile_total_count($tile_colour_results, 1), get_tile_total_count($tile_colour_results, 2), get_tile_total_count($tile_colour_results, 3), get_tile_total_count($tile_colour_results, 4), get_tile_total_count($tile_colour_results, 5), get_tile_total_count($tile_colour_results, 6), get_tile_total_count($tile_colour_results, 7), get_tile_total_count($tile_colour_results, 8), get_tile_total_count($tile_colour_results, 9), get_tile_total_count($tile_colour_results, 10), get_tile_total_count($tile_colour_results, 11), get_tile_total_count($tile_colour_results, 12)), "Serie10");
$pChart->setSerieDrawable("Serie10", FALSE);
$pChart->setPalette("Serie10", array("Alpha" => 0));
$pChart->addPoints(array("Ormax", "Protector", "Polar", "Minster", "Turmalin", "Granat", "E13", "T11", "Nova", "Rubin", "Nortegl", "Hollander", "KDN"), "Absissa");
$pChart->setAbscissa("Absissa");
$pChart->setAxisPosition(0, AXIS_POSITION_LEFT);
$pChart->setAxisName(0, "Laskentamäärät kpl");
$pChart->setAxisUnit(0, "");
$pChartPicture = new pImage($width, $height, $pChart);
$Settings = array("R" => 255, "G" => 255, "B" => 255);
$pChartPicture->drawFilledRectangle(0, 0, $width, $height, $Settings);
$pChartPicture->setFontProperties(array("FontName" => "pChart/fonts/arial.ttf", "FontSize" => 14));
$TextSettings = array("Align" => TEXT_ALIGN_BOTTOMMIDDLE, "R" => 0, "G" => 0, "B" => 0);
$pChartPicture->drawText($width / 2, 25, ucfirst($table) . " - Tiilet / Värit", $TextSettings);
$description .= GetYearsDescription($years);
$description .= " - (" . GetSeriesTotalSum($pChart, "Half") . "kpl)";
if (strlen($description) > 120) {
    $description = substr($description, strpos($description, "joissa"));
}
$pChartPicture->setFontProperties(array("FontSize" => 11));
$pChartPicture->drawText($width / 2, 45, $description, $TextSettings);
$pChartPicture->setGraphArea(50, 55, $width - 25, $height - 75);
$pChartPicture->setFontProperties(array("R" => 0, "G" => 0, "B" => 0, "FontName" => "pChart/fonts/arial.ttf", "FontSize" => 10));
$Settings = array("Pos" => SCALE_POS_LEFTRIGHT, "Mode" => SCALE_MODE_ADDALL_START0, "LabelingMethod" => LABELING_DIFFERENT, "GridR" => 240, "GridG" => 240, "GridB" => 240, "GridAlpha" => 50, "TickR" => 0, "TickG" => 0, "TickB" => 0, "TickAlpha" => 50, "LabelRotation" => 0, "CycleBackground" => 1, "DrawXLines" => 1, "DrawSubTicks" => 1, "SubTickR" => 255, "SubTickG" => 0, "SubTickB" => 0, "SubTickAlpha" => 50, "DrawYLines" => ALL);
$pChartPicture->drawScale($Settings);
$Config = array("DisplayValues" => 1, "AroundZero" => 1, "Gradient" => 1, "Surrounding" => -15, "InnerSurrounding" => 15);
$pChartPicture->drawStackedBarChart($Config);
$Config = array("FontR" => 0, "FontG" => 0, "FontB" => 0, "FontName" => "pChart/fonts/arial.ttf", "FontSize" => 10, "Margin" => 40, "Alpha" => 30, "BoxWidth" => 10, "BoxHeight" => 10, "Style" => LEGEND_NOBORDER, "Mode" => LEGEND_HORIZONTAL);
$pChartPicture->drawLegend(50, $height - 40, $Config);
$pChart->setSerieDrawable('Serie10', TRUE);
$pChart->setSerieDescription("Serie1", "Serie 1");
$pChart->setSerieOnAxis("Serie1", 0);
$pChart->addPoints(array("00-10", "11-14", "15-19", "20-27", "22-23", "28-29", "30-32", "33-39", "40-44", "45-47", "48-49", "50-52", "53-56", "57-59", "60-64", "65-66", "67-69", "70-75", "76-79", "80-83", "84-86", "87-89", "90-93", "94-95", "96-99"), "Absissa");
$pChart->setAbscissa("Absissa");
$pChart->setAxisPosition(0, AXIS_POSITION_LEFT);
$pChart->setAxisName(0, "Kappalemäärä / postinumeroalue");
$pChart->setAxisUnit(0, "");
$pChartPicture = new pImage($width, $height, $pChart);
$Settings = array("R" => 255, "G" => 255, "B" => 255);
$pChartPicture->drawFilledRectangle(0, 0, 250, 470, $Settings);
$pChartPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 50, "G" => 50, "B" => 50, "Alpha" => 20));
$pChartPicture->setFontProperties(array("FontName" => "pChart/fonts/arial.ttf", "FontSize" => 14));
$TextSettings = array("Align" => TEXT_ALIGN_TOPMIDDLE, "R" => 0, "G" => 0, "B" => 0);
$pChartPicture->drawText($width / 2, 5, ucfirst($table) . " /", $TextSettings);
$pChartPicture->drawText($width / 2, 22, "postinumeroalue", $TextSettings);
$description_years = GetYearsDescription($years);
$description_sum = "(" . GetSeriesTotalSum($pChart) . " kpl)";
if (strlen($description) > 48) {
    $description = substr($description, strpos($description, "joissa"));
}
if (strlen($description_years) > 0) {
    $height_offset = 20;
} else {
    $height_offset = 0;
}
$pChartPicture->setFontProperties(array("FontSize" => 10));
$pChartPicture->drawText($width / 2, 45, $description, $TextSettings);
$pChartPicture->drawText($width / 2, 45 + $height_offset, $description_years, $TextSettings);
$pChartPicture->drawText($width / 2, 65 + $height_offset, $description_sum, $TextSettings);
$pChartPicture->setShadow(FALSE);
$pChartPicture->setGraphArea(35, 115 + $height_offset, $width - 15, $height - 10);