Formula for popularity in the afternoon?

I have an application, which is basically a calendar, users can enter events for every day. Now I have to find the best way to show the calendar for a full month, highlighting the busiest days.

Obviously color is a choice, but I wonder how you guys will do it. I have a brainstorm:

  • Get events maxthroughout the day and from there, divide it by the number of colors available. Therefore, if there were 30 events on one day, and we have 3 colors, the first of them will be from 0 to 9, from 10 to 19 and the last from 20 to.
  • Find averageand divide it by colors/2, so if the average is 10 events and we have 3 colors, the math will be 10 / 1.5 = 6.66, which means that the first color range will be from 0 to 6.66, the second - from 6.67 to 13.32, and the latter from 13.33 inches.

However, I'm not sure if this is the best way to solve this problem. Both are linear, and the former can spoil things a little, if our average is about 20 and the maximum is 100 events, only two colors will be displayed.

I am not static, but I think this problem can be solved with percentiles and quartiles, but I'm not sure how to implement it.

Thank.

+3
source share
2 answers

, . - , - .

PHP Python ( ) . :

$tags = array(
    array('tag'   => 1,
          'count' => 10),
    array('tag'   => 2,
          'count' => 30),
    array('tag'   => 3,
          'count' => 5),
    array('tag'   => 4,
          'count' => 5));
$colours = array('green', 'yellow', 'red');
foreach(tagcloud($tags, 0, count($colours) - 1, 0) as $d) {
  echo  '<div style="background-color:' . $colours[floor($d['size'])] . '">Day: '.$d['tag'].' Events: '.$d['count'].'</div>';
}
+1

:

0

Source: https://habr.com/ru/post/1789348/


All Articles