本文整理汇总了PHP中pData::getStandardDeviation方法的典型用法代码示例。如果您正苦于以下问题:PHP pData::getStandardDeviation方法的具体用法?PHP pData::getStandardDeviation怎么用?PHP pData::getStandardDeviation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pData
的用法示例。
在下文中一共展示了pData::getStandardDeviation方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
////////////////////////////////////////////////////////////////
// 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");
示例2: array
/* 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) */
示例3: die
$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>