Graph: spotting the products


Spotting (x, y) coordinates in the graph

(x, y) axes of the graph range respectively from 0.5 to 1 (50%-100% similarity with product reference), and from 0 to 5 (worst to best nutrition score).

x coordinate

The computation of the x coordinate is complex and we just provide here a brief description of it by working with 2 examples:
Let P be the product reference shown as an ellipse, and C its number of categories used for computing the similarities between products (more details...).
Let C = 10, we divide the graph vertically into 10 stripes (N) of equal sizes; hence the right-most stripe ranges with x=]0.9; 1]. By the way, this is also the width of the ellipse showing our product reference. So in this stripe are shown all products with a similarity to the product reference of 100%.

That being said, a product with a similarity of S=60% will be randomly located in the stripe ]N-1; N] where N = Math.Ceiling(S / (100 / C) = S*C/100
E.g. 1:
Let C=10, S=60% => N=Math.Ceiling(60*10/100)=6, so the product will be located in stripes ]5; 6].
In order to find the x coordinate, we multiply this number by 1/C, in other words we divide by C. So x=]0.5; 0.6].

E.g. 2:
Let C=5, S=75% => N=Math.Ceiling(75*5/100)=Math.Ceiling(3,75)=4, so the product will be located in the 4th stripe.
In this case x=]0.6; 0.8].
NOTE: keep in mind that the starting value of x in the graph is 0.5.

y coordinate

Products with a Nutrition score of 5 (bad quality, red colour) are shown in the bottom banner ranging y=[0; 1[.
...
Products with a Nutrition score of 1 (best quality, dark-green colour) are shown in the upper banner ranging from y=[4; 5[.
A random number is generated by the server in the y range.
E.g.: with a nutrition score of 2, a product will be spotted in the graph in a y coordinate between [3; 4[.

Comments