Ejemplo n.º 1
0
////////////////////////////////////////////////////////////////
// Average Values
//
/* get average Temperature value */
$temp = $MyData->getSerieAverage("Temperature");
/* format average to 3 decimal places */
$T_Average = number_format($temp, 1);
/* get average Humidity value */
$temp = $MyData->getSerieAverage("Humidity");
/* format average to 1 decimal places */
$H_Average = number_format($temp, 1);
////////////////////////////////////////////////////////////////
// Standard Deviation Values
//
/* get Standard Deviation Temperature Value */
$temp = $MyData->getStandardDeviation("Temperature");
/* Format SD to 3 decimal places */
$T_StandardDeviation = number_format($temp, 1);
/* get Standard Deviation Humidity Value */
$temp = $MyData->getStandardDeviation("Humidity");
/* Format SD to 1 decimal places */
$H_StandardDeviation = number_format($temp, 1);
////////////////////////////////////////////////////////////////
// Minimum Values
//
/* Get minimum Temperature value */
$temp = $MyData->getMin("Temperature");
/* Get minimum Temperature value */
$T_Minimum = number_format($temp, 1);
/* Get minimum Humidity value */
$temp = $MyData->getMin("Humidity");
/* Set the default font */
$myPicture->setFontProperties(array("FontName" => "../fonts/pf_arma_five.ttf", "FontSize" => 6));
/* Define the chart area */
$myPicture->setGraphArea(60, 50, 670, 200);
/* Draw the scale */
$scaleSettings = array("LabelSkip" => 9, "GridR" => 200, "GridG" => 200, "GridB" => 200, "DrawSubTicks" => TRUE, "CycleBackground" => TRUE);
$myPicture->drawScale($scaleSettings);
/* Turn on Antialiasing */
$myPicture->Antialias = TRUE;
$myPicture->setShadow(TRUE, array("X" => 1, "Y" => 1, "R" => 0, "G" => 0, "B" => 0, "Alpha" => 10));
/* Draw the line chart */
$myPicture->drawPlotChart(array("PlotSize" => 2));
/* Compute the serie average and standard deviation */
$Average = $MyData->getSerieAverage("Probe 1");
/* Compute the serie standard deviation */
$StandardDeviation = $MyData->getStandardDeviation("Probe 1");
/* Draw a threshold area */
$myPicture->setShadow(FALSE);
$myPicture->drawThresholdArea($Average - $StandardDeviation, $Average + $StandardDeviation, array("R" => 100, "G" => 100, "B" => 200, "Alpha" => 10));
$myPicture->setShadow(TRUE);
/* Draw the serie average */
$myPicture->drawThreshold($Average, array("WriteCaption" => TRUE, "Caption" => "Average value", "AxisID" => 0));
/* Draw the standard deviation boundaries */
$ThresholdSettings = array("WriteCaption" => TRUE, "CaptionAlign" => CAPTION_RIGHT_BOTTOM, "Caption" => "SD", "AxisID" => 0, "R" => 0, "G" => 0, "B" => 0);
$myPicture->drawThreshold($Average + $StandardDeviation, $ThresholdSettings);
$myPicture->drawThreshold($Average - $StandardDeviation, $ThresholdSettings);
/* Write the coefficient of variation */
$CoefficientOfVariation = round($MyData->getCoefficientOfVariation("Probe 1"), 1);
$myPicture->setFontProperties(array("FontName" => "../fonts/pf_arma_five.ttf", "FontSize" => 6));
$myPicture->drawText(610, 46, "coefficient of variation : " . $CoefficientOfVariation, array("Align" => TEXT_ALIGN_BOTTOMMIDDLE));
/* Render the picture (choose the best way) */
Ejemplo n.º 3
0
        $value2 = $row[0];
        $sql = "SELECT Nota FROM notas" . $curso . " WHERE N_Id_Escolar = '{$value2}' \n            AND id_asignatura = '{$asignatura}';";
        $result = mysqli_query($conn, $sql) or die("Error en el sql");
        $series[$value] = array();
        while ($row = mysqli_fetch_array($result, MYSQLI_NUM)) {
            $series[$value][] = $row[0];
        }
    }
    $myData = new pData();
    $html = "<table border='1'>\n      <tr>\n        <th>Alumno</th>\n        <th>Nota media</th>\n        <th>Desviación estándar</th>\n        <th>Mediana</th>\n        <th>Nota más alta</th>\n      </tr>";
    foreach ($series as $key => $value) {
        $myData->addPoints($value, $key);
        $media = round($myData->getSerieAverage($key), 2);
        $maxima = $myData->getMax($key);
        $mediana = $myData->getSerieMedian($key);
        $desviacion = round($myData->getStandardDeviation($key), 2);
        $html .= "<tr><td>{$key}</td><td>{$media}</td>" . "<td>{$desviacion}</td><td>{$mediana}</td>" . "<td>{$maxima}</td></tr>";
    }
    $html .= "</table>";
    echo $html;
}
?>
      </div>
              </div>
        </div>
    </div>


    <!-- Pie de página -->
    <div class="container-fluid bg-4 text-center" id='foot01'></div>
    <script src="script/script.js"></script>