그래서 이것은 PHP보다 수학 문제가 더 많을 것이라고 생각하지만 어디로 갈지는 모르겠습니다. 그래서 모든 사용자의 등급 분포를 보여주는 TV 쇼 웹 사이트가 있습니다. 여기에 두 개의 예가 표시됩니다 http://broadcasted.tv/user/2/albertmarch/ 및 여기 http://broadcasted.tv/user/21/freshprincelive/입니다. 여기 내가 순간 바의 각각을 계산하는데 사용하는 수식이다막대 그래프 높이 PHP
$division = $scores[$i][1]/$countvotestotal;
//we divide the number of scores for each score (1 to 10) by the total number of score
$percentage = $division * 100;
$pixels = 180;
//max number of pixels
$pixelsactual = ($percentage/100) * $pixels;
$addthat = $percentage * 3.4;
//add some pixels to give more relief to the charts (otherwise, with many ratings, you end having bars between 10px and 20px)
$finalpixels = $pixelsactual + $addthat;
if ($finalpixels > 130) {
$finalpixels = 130;
}
//and this is a fix that I use, basically, if there is only one rating the biggest bar is gonna be huge (especially because of the $addthat var which add some px with a ratio to the final pixels value)
문제 일부 차트 (제 프로필 등) 똥 보는 것이거나 서로 다른 값이 같은 동일 바의 크기를 갖는다 http://broadcasted.tv/user/98/armchairtv/
모든 권장 사항은 정말 감사하겠습니다. 감사합니다
나는 그걸 확인해 보았습니다. 내 현재 차트가 엉덩이에 엄청난 고통을 줄 것 같은 모양으로 보이도록 사용자 정의했습니다. 하지만 막대의 높이가 좋으므로 어떻게 얻을 수 있는지 알아 내려고 노력할 것입니다. – Callombert