<canvas id="canvas"></canvas>
canvas {
border: 1px solid red;
}
console.clear();
(function() {
let data = getData();
let canvas = document.getElementById('canvas');
let ctx = canvas.getContext('2d');
window.onresize = draw;
draw();
function draw() {
let vw = canvas.width = window.innerWidth - 30;
let vh = canvas.height = window.innerHeight - 20;
real_data();
attempt();
function real_data() {
ctx.fillStyle = "black";
data.forEach(function(p) {
let cx = vw * p[0] / 100;
let cy = vh - vh * (p[1] - 1061184077) / (1072693248 - 1061184077);
point(cx, cy, 5);
});
}
function attempt() {
ctx.fillStyle = "orange";
data.forEach(function(p) {
let cx = vw * p[0] / 100;
let percent = p[0] //Процент
let y; // Число
let err = (100-percent)*1.5 ;//погрешность
let err_2 = (49.9-percent)*1.5 ;//погрешность
let err_3 = 0 ;//погрешность
let err_4 = Math.floor(0) ;//погрешность
if(percent <= 5){
err_4 = Math.floor(0) ;//погрешность
} let err_5 = Math.floor(0)
let err_6;//погрешность
if(percent >= 12.5){
err_3 = (24.7-percent)*6.9 ;//погрешность
} else if(percent >= 5.1){
err_3 = (87.5-(125-percent*10))*1.05;//погрешность
} else {
err_3 = 0-((50-percent*10)*1.6);
}
//let err = Math.floor((100-percent)*1.5) ;//погрешность
//let err_2 = Math.floor((49.9-percent)*1.5) ;//погрешность
//let err_3 = Math.floor((24.6-percent)*6.7) ;//погрешность
//let err_4 = Math.floor(0) ;//погрешность
//let err_5 = Math.floor((24.9-percent)+28) ;//погрешность
//let err_5 = Math.floor(((124-percent*10)*1.5)-1) ;//погрешность 12.5
console.log(p[1])
let max = 1072693248
let min = 1061184077
let hund = 100
let if_val_1 = hund-0.1; // 99.9
let if_val_2 = (hund/Math.pow(2, 1)) // "50.0"
let if_val_3 = if_val_2-0.1 // 49.9
let if_val_4 = (hund/Math.pow(2, 2)) //"25.0"
let if_val_5 = if_val_4-0.1 //24.9
let if_val_6 = (hund/Math.pow(2, 3)) //"12.5"
let if_val_7 = if_val_6-0.1 //12.4
let if_val_8 = (hund/Math.pow(2, 4)) //"6.3"
let if_val_9 = if_val_8-0.1 // 6.2
let if_val_10 = (hund/Math.pow(2, 5)) //"3.1"
let if_val_11 = if_val_10-0.1 //3
let if_val_12 = (hund/Math.pow(2, 6)) //"1.6"
let if_val_13 = if_val_12-0.1 // 1.5
let if_val_14 = (hund/Math.pow(2, 7)) //0.8"
let if_val_15 = if_val_14-0.1 //0.7
let if_val_16 = (hund/Math.pow(2, 8)) //"0.4"
let half_1 = 1050
let starto = 2097
let sum_1 = max - err - half_1
let col_2 = 999 - 10 * (percent )
let sum_2 = sum_1 - starto * col_2
let sum_3 = sum_1 - starto * (999-10*(if_val_3+0.1)) - Math.round(starto*1.5)
let col_4 = 999 - 10 * (percent + if_val_3 + 0.1 )
let sarto_4 = starto * Math.pow(2, 1)
let sum_4 = sum_3 - err_2 - sarto_4*col_4
let col_4_5 = 999 - 10 * (if_val_5 + if_val_3 + 0.2 )
let sarto_4_5 = starto * Math.pow(2, 1)
let sum_4_5 = sum_3 - err_2 - sarto_4_5*col_4_5
let sarto_5 = Math.round(sarto_4_5*1.5);
let sum_5 = sum_4_5 - sarto_5;
let col_6 = 999 - 10 * (percent + if_val_3 + if_val_5 + 0.2 )
let sarto_6 = starto * Math.pow(2, 2) + 1
let sum_6 = sum_5 +err_3 - sarto_6*col_6
let col_6_7 = 999 - 10 * (if_val_7 + if_val_3 + if_val_5 + 0.3 )
let sarto_6_7 = starto * Math.pow(2, 2) + 1
let sum_6_7 = sum_5+ err_3 - sarto_6_7*col_6_7
let sum_7 = sum_6_7 - Math.round(sarto_6_7*1.5)
let col_8 = 999 - 10 * (percent + if_val_3 + if_val_5 + if_val_7 + 0.3 )
let sarto_8 = starto * Math.pow(2, 3)
let sum_8 = sum_7 - err_4 - sarto_8*col_8
let col_8_9 = 999 - 10 * (if_val_9 + if_val_3 + if_val_5 + if_val_7 + 0.4 )
let sarto_8_9 = starto * Math.pow(2, 3)
let sum_8_9 = sum_7 - err_4 - sarto_8_9*col_8_9
let sum_9 = sum_8_9 - Math.round(sarto_8_9*1.5)
let col_10 = 999 - 10 * (percent + if_val_3 + if_val_5 + if_val_7 +if_val_9 + 0.4 )
let sarto_10 = starto * Math.pow(2, 4)
let sum_10 = sum_9 - sarto_10*col_10
let col_10_11 = 999 - 10 * (if_val_11 + if_val_3 + if_val_5 + if_val_7 +if_val_9 + 0.5 )
let sarto_10_11 = starto * Math.pow(2, 4)
let sum_10_11 = sum_9 - err_5 - sarto_10_11*col_10_11
let sum_11 = sum_10_11 - Math.round(sarto_10_11*1.5)
let col_12 = 999 - 10 * (percent + if_val_3 + if_val_5 + if_val_7 +if_val_9 + if_val_11 + 0.5 )
let sarto_12 = starto * Math.pow(2, 5)
let sum_12 = sum_11 - sarto_12*col_12
let col_12_13 = 999 - 10 * (if_val_13 + if_val_3 + if_val_5 + if_val_7 +if_val_9 + if_val_11 + 0.6 )
let sarto_12_13 = starto * Math.pow(2, 5)
let sum_12_13 = sum_11 - sarto_12_13*col_12_13
let sum_13 = sum_12_13 - Math.round(sarto_12_13*1.5)
let col_14 = 999 - 10 * (percent + if_val_3 + if_val_5 + if_val_7 +if_val_9 + if_val_11 + if_val_13+0.6 )
let sarto_14 = starto * Math.pow(2, 6)
let sum_14 = sum_13 - sarto_14*col_14
let col_14_15 = 999 - 10 * (if_val_15 + if_val_3 + if_val_5 + if_val_7 +if_val_9 + if_val_11 + if_val_13+0.7 )
let sarto_14_15 = starto * Math.pow(2, 6)
let sum_14_15 = sum_13 - sarto_14_15*col_14_15
let sum_15 = sum_14_15 - Math.round(sarto_14_15*1.5)
let col_16 = 999 - 10 * (percent + if_val_3 + if_val_5 + if_val_7 +if_val_9 + if_val_11 + if_val_13+if_val_15+0.7 )
let sarto_16 = starto * Math.pow(2, 7)
let sum_16 = sum_15 - sarto_16*col_16
let color19 = '#7d7d7d' // gray
let color1 = '#ffa200' // orange
let color2 = '#8f5b00'
let color3 = '#fffb00' // yellow
let color4 = '#7d7b00'
let color5 = '#bfff00'
let color6 = '#6d9100'
let color7 = '#15ff00' // green
let color8 = '#0a7d00'
let color9 = '#02f28a'
let color10 = '#008a4e'
let color11 = '#00fbff' // sky
let color12 = '#008587'
let color13 = '#0000ff' // blue
let color14 = '#00009c'
let color15 = '#dd00ff' // purple
let color16 = '#5d006b'
let color17 = '#ff00cc' // ping
let color18 = '#9c007c'
if (percent == hund) {
y = max
ctx.fillStyle = color1;
}
else if (percent == if_val_1) {
y = sum_1
ctx.fillStyle = color2;
}
else if (percent >= if_val_2) {
y = sum_2
ctx.fillStyle = color3;
}
else if (percent == if_val_3) {
ctx.fillStyle = color4;
y = sum_3
}
else if (percent >= if_val_4) {
ctx.fillStyle = color5;
y = sum_4
}
else if (percent == if_val_5) {
y = sum_5
ctx.fillStyle = color6;
}
else if (percent >= if_val_6) {
y = sum_6
ctx.fillStyle = color7;
}
else if (percent == if_val_7) {
y = sum_7
ctx.fillStyle = color8;
}
else if (percent >= if_val_8) {
y = sum_8
ctx.fillStyle = color9;
}
else if (percent == if_val_9) {
y = sum_9
ctx.fillStyle = color10;
}
else if (percent >= if_val_10) {
y = sum_10
ctx.fillStyle = color11;
}
else if (percent == if_val_11) {
y = sum_11
ctx.fillStyle = color12;
}
else {
y = p[1]
ctx.fillStyle = color13;
}
tef = 1
ter = 5
if (1 == tef){
if (y-p[1] >= ter){
ctx.fillStyle = "red";
console.log(['red',p[0],y-p[1]])
}
else if (y-p[1] <= -ter){
ctx.fillStyle = "brown";
console.log(['brown',p[0],y-p[1]])
}
}
let cy = vh - vh * (y - min) / (max - min);
point(cx, cy, 3);
});
}
}
function point(cx, cy, r = 2) {
ctx.beginPath();
ctx.arc(cx, cy, r, 0, 2 * Math.PI);
ctx.fill();
}
function getData() {
return [
[100 , 1072693248 ],[
99.9 , 1072692198 ],[ // 100 - 99.9 , 1050
99.8 , 1072690101 ],[ // 99.9 - 99.8 , 2097
99.7 , 1072688004 ],[ // 99.8 - 99.7 , 2097
99.6 , 1072685906 ],[ // 99.7 - 99.6 , 2098
99.5 , 1072683810 ],[
99.4 , 1072681713 ],[
99.3 , 1072679616 ],[
99.2 , 1072677519 ],[
99.1 , 1072675421 ],[
99.0 , 1072673324 ],[
98.9 , 1072671227 ],[
98.8 , 1072669130 ],[
98.7 , 1072667032 ],[
98.6 , 1072664935 ],[
98.5 , 1072662838 ],[
98.4 , 1072660741 ],[
98.3 , 1072658644 ],[
98.2 , 1072656547 ],[
98.1 , 1072654450 ],[
98.0 , 1072652353 ],[
97.9 , 1072650256 ],[
97.8 , 1072648159 ],[
97.7 , 1072646062 ],[
97.6 , 1072643964 ],[
97.5 , 1072641867 ],[
97.4 , 1072639770 ],[
97.3 , 1072637673 ],[
97.2 , 1072635576 ],[
97.1 , 1072633479 ],[
97.0 , 1072631381 ],[
90.0 , 1072484580 ],[
89.9 , 1072482483 ],[
75.0 , 1072170008 ],[
74.9 , 1072167911 ],[ // 75.0 - 74.9 ,2097
70.0 , 1072065150 ],[
69.9 , 1072063052 ],[ // 70.0 - 69.9 ,2098
65.0 , 1071960292 ],[
64.9 , 1071958195 ],[ // 65.0 - 65.0 ,2097
60.0 , 1071855435 ],[
59.9 , 1071853337 ],[ // 60.0 - 59.9 ,2098
55.0 , 1071750577 ],[
54.9 , 1071748480 ],[ // 55.0 - 55.0 ,2097
51.1 , 1071668788 ],[ //
51.0 , 1071666691 ],[ // 51.1 - 51.0 , 2097
50.1 , 1071647816 ],[
50.0 , 1071645720 ],[ // 50.1 - 50.0 , 2096
49.9 , 1071642574 ],[ // 50.0 - 49.9 , 3146
49.8 , 1071638380 ],[ // 49.9 - 49.8 , 4194
45.0 , 1071437053 ],[
44.9 , 1071432859 ],[ // 45.0 - 44.9 ,4194
40.0 , 1071227338 ],[
39.9 , 1071223143 ],[ // 40.0 - 39.9 ,4195
35.0 , 1071017623 ],[
34.9 , 1071013428 ],[ // 35.0 - 34.9 ,4195
30.0 , 1070807907 ],[
29.9 , 1070803713 ],[ // 30.0 - 29.9 ,4194
25.0 , 1070598192 ],[
24.9 , 1070591901 ],[ // 25.0- 24.9 , 6291
20.0 , 1070180859 ],[
19.9 , 1070172470 ],[ // 20.0 -19.9 , 8389
19.0 , 1070096973 ],[
18.5 , 1070055030 ],[
18.0 , 1070013087 ],[
17.5 , 1069971144 ],[
17.0 , 1069929201 ],[
16.5 , 1069887258 ],[
16.0 , 1069845315 ],[
15.5 , 1069803371 ],[
15.0 , 1069761429 ],[
14.9 , 1069753039 ],[ // 15.0 -14.9 , 8390
14.5 , 1069719485 ],[
14.0 , 1069677542 ],[
13.5 , 1069635599 ],[
13.0 , 1069593657 ],[
12.5 , 1069551713 ],[
12.0 , 1069472022 ],[
11.5 , 1069388135 ],[
11.0 , 1069304249 ],[
10.5 , 1069220363 ],[
10.0 , 1069136477 ],[
9.9 , 1069119700 ],[ // 10.0 - 9.9 , 16777
9.8 , 1069102923 ],[ // 9.9 - 9.8 , 16777
9.7 , 1069086146 ],[ // 9.8 - 9.7 , 16777
9.6 , 1069069369 ],[ // 9.7 - 9.6 , 16777
9.5 , 1069052591 ],[ // 9.6 - 9.5 , 16778
9.4 , 1069035814 ],[ // 9.5 - 9.4 , 16777
9.3 , 1069019037 ],[ // 9.4 - 9.3 , 16777
9.2 , 1069002260 ],[ // 9.3 - 9.2 , 16777
9.1 , 1068985482 ],[ // 9.2 - 9.1 , 16778
9.0 , 1068968705 ],[ // 9.1 - 9.0 , 16777
8.5 , 1068884819 ],[
8.4 , 1068868041 ],[ // 16778
5.0 , 1068096289 ],[
4.9 , 1068062735 ],[ // 5.0 - 4.9 , 33554
4.8 , 1068029181 ],[ // 4.9 - 4.8 , 33554
4.7 , 1067995627 ],[ // 4.8 - 4.7 , 33554
4.6 , 1067962072 ],[ // 4.7 - 4.6 , 33555
4.5 , 1067928518 ],[ // 4.6 - 4.5 , 33554
4.4 , 1067894963 ],[ // 4.5 - 4.4 , 33555
4.3 , 1067861409 ],[ // 4.4 - 4.3 , 33554
4.2 , 1067827855 ],[ // 4.3 - 4.2 , 33554
4.1 , 1067794300 ],[ // 4.2 - 4.1 , 33555
4.0 , 1067760746 ],[ // 4.1 - 4.0 , 33554
3.5 , 1067592974 ],[
3.4 , 1067559419 ],[ // 3.5 - 3.4 , 33555
3.1 , 1067458756 ],[
3.0 , 1067400035 ],[
2.9 , 1067332926 ],[ // 3.0 - 2.9 , 67109
2.8 , 1067265817 ],[
2.7 , 1067198709 ],[
2.6 , 1067131600 ],[
2.5 , 1067064491 ],[
2.4 , 1066997382 ],[ // 2.5 - 2.4 , 67109
2.3 , 1066930273 ],[
2.2 , 1066863165 ],[
2.1 , 1066796056 ],[
2.0 , 1066728947 ],[
1.9 , 1066661838 ],[ // 2.0 - 1.9 , 67109
1.8 , 1066594729 ],[
1.7 , 1066527621 ],[
1.6 , 1066460512 ],[
1.5 , 1066385013 ],[
1.4 , 1066250796 ],[ // 1.5 - 1. 4, 134217
1.3 , 1066116578 ],[
1.2 , 1065982361 ],[
1.1 , 1065848143 ],[
1.0 , 1065713925 ],[
0.9 , 1065579708 ],[ // 1.0 - 0.9 , 134217
0.8 , 1065445489 ],[ // 0.9 - 0.8 , 134219
0.7 , 1065269329 ],[ // 0.8 - 0.7 , 176160
0.6 , 1065000893 ],[ // 0.7 - 0.6 , 268436
0.5 , 1064732458 ],[ // 0.6 - 0.5 , 268435
0.4 , 1064464023 ],[ // 0.5 - 0.4 , 268435
0.3 , 1064086535 ],[ // 0.4 - 0.3 , 377488
0.2 , 1063549664 ],[ // 0.3 - 0.2 , 536871
0.1 , 1062769523 ],[ // 0.2 - 0.1 , 780141
0.0 , 1061184077 ] // 0.1 - 0.0 , 1585446
];
}
})();
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.