V
V
Viktor Yanyshev2018-02-12 17:49:15
JavaScript
Viktor Yanyshev, 2018-02-12 17:49:15

How can I display the size range?

The input is an array with dimensions (

width
[3, 6, 18, 22.5, 30, 34, 35, 38, 40, 45, 46, 50, 52, 53, 54, 55, 57, 59, 60, 67, 70, 76, 90, 99, 104, 110, 118, 160]

) for each product category. Based on these dimensions, you need to derive a range for the filter. How can I get such ranges of sizes as:
  • up to 50
  • from 50 to 100
  • from 100 to 150
  • over 150

The value of the minimum size can be greater than 100+ and the maximum value greater than 500+, always in different ways. As a maximum, it is necessary that there be no more than 4 groups of ranges, but less than 4 groups is acceptable.
What approach will allow to implement a flexible output of ranges for the filter?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Griboks, 2018-02-12
@villiwalla

1) Divide into fixed ranges. Do not display empty ones.
2) Divide by equal amount.
3) Divide into multiples (tens, hundreds, etc.) ranges.
4) Divide into relative ranges (if W(n) > W(n-1) +15, then the next level starts).
5) Divide into statistical ranges (unequal fixed ranges based on probability of values).
6) Divide into equal logarithmic ranges.
7) Divide the ranges with respect to the mean.
8) Divide into ranges relative to the mathematical expectation.
9) Divide into ranges by dispersion.
Few? Well, I can still fantasize)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question