diff --git a/graphScript.js b/graphScript.js new file mode 100644 index 0000000..2fd62d4 --- /dev/null +++ b/graphScript.js @@ -0,0 +1,61 @@ +const e=2.7182818; + +function fSat(alpha,gamma){ + function f(x){ + return x**alpha/(x**alpha+gamma**alpha); + } + return f; +} + +function fGeoAdStock(theta){ + function f(actual,previous){ + return actual + theta*previous; + } + return f; +} + +function fWeibullAdStock(shape,scale,type='pdf'){ + function pdf(t){ + return scale*shape*(scale*t)**(shape-1)*e**((-1)*(scale*t)**shape); + } + + function cdf(t){ + return 1-e**((-1)*(scale*t)**shape) + } + let funMap = { + 'pdf':pdf, + 'cdf':cdf + } + function f(actual,previous,t){ + return actual + funMap[type](t)*previous; + } + return f; +} + +function getChart(){ + return document.getElementById('Grafica'); +} + +function genXRange(min,max,step){ + let xValues = []; + for (let x=min; x<=max; x+=step){xValues.push(x);} + return xValues; +} + +function getGraphData(xValues,yFunc){ + let dataList = []; + let previous = 0; + for (let i=1; i + @@ -37,7 +38,7 @@
- +
@@ -135,7 +136,7 @@
Shape: - +
Scale: @@ -199,10 +200,19 @@

Gráfica de No seleccionado

+
- - +
+
+ Semilla de aleatoriedad: + +
+
+ Desfase: + +
+
diff --git a/script.js b/script.js index 5145c76..3ffc130 100644 --- a/script.js +++ b/script.js @@ -130,6 +130,7 @@ function addVarAdStock(vName){ shapeSpan.innerHTML = 'Shape:'; shapeInput = document.createElement('input'); shapeInput.type = 'number'; + shapeInput.min = "0.0001" shapeInput.classList.add('shapeParam'); scaleSpan = document.createElement('span'); @@ -293,4 +294,4 @@ function removeAllVarsParams(vName){ removeSaturation(vName); removeCampaign(vName); return undefined; -} \ No newline at end of file +} diff --git a/styles.css b/styles.css index 0a88f59..ecffdc2 100644 --- a/styles.css +++ b/styles.css @@ -45,6 +45,8 @@ header { grid-area: g; background-color: #d0fdca; color: #d0fdca; /*No funciona con el var, no se porque*/ + display: flex; + flex-direction: column; } .InnerBox header { background-color: var(--background-vars); @@ -52,10 +54,13 @@ header { } #Generate { grid-area: b; + color: #d0fdca; } #Generate button { width: 80px; height: 35px; + margin-left: 5%; + margin-top: 5%; } @@ -137,7 +142,11 @@ input { } .keyValue span { - min-width: 30%; + min-width: 40%; +} + +.keyValue input { + min-width: 40%; } /*parámetros de variables*/ @@ -180,7 +189,9 @@ input[type="radio"]:checked+label{ display:none; } #radioWeibull:checked ~ .divInputAdStockParam .keyValuePairs .weibullParam{ - display:block; + display: flex; + align-items: center; + padding-left: 5%; } input[type="number"]:out-of-range { @@ -188,3 +199,13 @@ input[type="number"]:out-of-range { box-shadow: 0px 0px 3px 3px red; } +/*Gráfica*/ + +canvas { + width: 50vh; + height: 50vh; + background-color: white; + margin: auto; + border-radius: 5px; +} +