Commit c39e6782 authored by  Leonel Rosano Montero's avatar Leonel Rosano Montero
Browse files

Agrega la funcionalidad de Enmuerados

parent 785f5e5c
...@@ -53,7 +53,7 @@ export class Graph2DComponent { ...@@ -53,7 +53,7 @@ export class Graph2DComponent {
public setZoom = () => { public setZoom = () => {
this.animation.zoo = this.animation.zoo ; this.animation.zoo = this.animation.zoo ;
} }
public multiGraf = () => { public multiGraf = () => {
this.animation.boton = !this.animation.boton; this.animation.boton = !this.animation.boton;
...@@ -68,7 +68,6 @@ export class Graph2DComponent { ...@@ -68,7 +68,6 @@ export class Graph2DComponent {
switch(canvas.tipo) { switch(canvas.tipo) {
case 'graph': { case 'graph': {
var jsonCanvas = JSON.parse(canvas.resultado); var jsonCanvas = JSON.parse(canvas.resultado);
let fun = eval(this.generarFuncion(jsonCanvas));
var conjs = this.obtenerConjunto(jsonCanvas.funs[0]); var conjs = this.obtenerConjunto(jsonCanvas.funs[0]);
var d = conjs + "}"; //Leo var d = conjs + "}"; //Leo
...@@ -85,26 +84,31 @@ export class Graph2DComponent { ...@@ -85,26 +84,31 @@ export class Graph2DComponent {
var elemento2 = this.recursionfuncion(jsonCanvas.funs[0].sets, nom); var elemento2 = this.recursionfuncion(jsonCanvas.funs[0].sets, nom);
obj.conj.sets.fcod = function (x) { return (eval(elemento2)) } obj.conj.sets.fcod = function (x) { return (eval(elemento2)) }
} }
var funcionGenerada = this.generarFuncion(jsonCanvas);
console.log(obj)
//para Enumerados //para Enumerados
if (obj.conj.dom == 'Numer') { if (obj.conj.dom == 'Numer') {
var cantElementos = obj.conj.sets.fdom.length;
var j = 0; var j = 0;
for (var fun of obj.conj.sets.fdom) { for (var f of obj.conj.sets.fdom) {
//var newstr = nuevo2.replace(fun, j); var expresionDom = new RegExp('( '+f+' )', 'g');
j = j + 1; funcionGenerada = funcionGenerada.replace(expresionDom, j.toString());
j += 1;
} }
} }
if (obj.conj.cod == 'Numer') { if (obj.conj.cod == 'Numer') {
var cantElementos = obj.conj.sets.fcod.length; var j2 = 0;
var j = 0; for (var f2 of obj.conj.sets.fcod) {
for (var fun of obj.conj.sets.fcod) { var expresionCod = new RegExp(f2, 'g');
//var newstr = nuevo2.replace(fun, j); funcionGenerada = funcionGenerada.replace(expresionCod, j2.toString());
j = j + 1; j2 += 1;
} }
} }
let fun = eval(funcionGenerada);
var colores = ['pink', 'red', 'blue', 'orange', 'green'] var colores = ['pink', 'red', 'blue', 'orange', 'green']
var num = this.getRandomArbitrary(0, 4); var num = this.getRandomArbitrary(0, 4);
var color = colores[num]; var color = colores[num];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment