$data = array(); for ($i = 0; $i < 6.2; $i += 0.2) { $tmp = sin($i) * 1.9; $data[] = $tmp; } require_once 'OFC/OFC_Chart.php'; $chart = new OFC_Chart(); $chart->set_title(new OFC_Elements_Title('Area Chart')); // // Make our area chart: // $area = new OFC_Charts_Area_Hollow(); // set the circle line width: $area->set_width(1); $area->set_values($data); // add the area object to the chart: $chart->add_element($area); $y_axis = new OFC_Elements_Axis_Y(); $y_axis->set_range(-2, 2, 2); $y_axis->labels = null; $y_axis->set_offset(false); $x_axis = new OFC_Elements_Axis_X(); $x_axis->labels = $data; $x_axis->set_steps(2); $x_labels = new OFC_Elements_Axis_X_Label_Set(); $x_labels->set_steps(4); $x_labels->set_vertical(); // Add the X Axis Labels to the X Axis $x_axis->set_labels($x_labels); $chart->add_y_axis($y_axis);
private function createGraph(Gpf_Chart_DataRecordSet $data) { if ($this->chartType == Gpf_Rpc_Chart::CHART_TYPE_LINE_DOT && $this->data1->getSize() > 150) { $this->chartType = Gpf_Rpc_Chart::CHART_TYPE_LINE; } switch ($this->chartType) { case Gpf_Rpc_Chart::CHART_TYPE_AREA: if ($data->getSize() > 40) { $areaGraph = new OFC_Charts_Area_Line(); } else { $areaGraph = new OFC_Charts_Area_Hollow(); } $areaGraph->set_width(3); $areaGraph->set_dot_size(3); $areaGraph->set_colour($data->getColor()); $areaGraph->set_key($data->getName(), 10); $areaGraph->set_values($data->getValues()); $areaGraph->set_tooltip($data->getTooltip()); return $areaGraph; case Gpf_Rpc_Chart::CHART_TYPE_BAR_OUTLINE: $barGraph = new OFC_Charts_Bar(); $barGraph->set_alpha(50); $barGraph->set_colour($data->getColor()); $barGraph->set_key($data->getName(), 10); $barGraph->set_values($data->getValues()); $barGraph->set_tooltip($data->getTooltip()); return $barGraph; case Gpf_Rpc_Chart::CHART_TYPE_LINE_DOT: $lineDotGraph = new OFC_Charts_Line_Dot(); $lineDotGraph->set_width(3); $lineDotGraph->set_dot_size(3); $lineDotGraph->set_colour($data->getColor()); $lineDotGraph->set_key($data->getName(), 10); $lineDotGraph->set_values($data->getValues()); $lineDotGraph->set_tooltip($data->getTooltip()); return $lineDotGraph; default: $lineGraph = new OFC_Charts_Line(); $lineGraph->set_width(3); $lineGraph->set_dot_size(3); $lineGraph->set_colour($data->getColor()); $lineGraph->set_key($data->getName(), 10); $lineGraph->set_values($data->getValues()); $lineGraph->set_tooltip($data->getTooltip()); return $lineGraph; } }