Commit c8df5c9b authored by jose.ignacio.fagian's avatar jose.ignacio.fagian
Browse files

cambios leo email

parent 5b9a7f5e
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
"core-js": "^2.4.1", "core-js": "^2.4.1",
"d3": "^4.12.2", "d3": "^4.12.2",
"font-awesome": "^4.7.0", "font-awesome": "^4.7.0",
"function-plot": "git://github.com/diego-rey/function-plot.git#feature/integration-domain-shape", "function-plot": "git://github.com/diego-rey/function-plot.git#feature/mutigraf",
"graph3D": "git://github.com/ifagian/graph3D#master", "graph3D": "git://github.com/ifagian/graph3D#master",
"ionicons": "^3.0.0", "ionicons": "^3.0.0",
"jq-console": "^2.13.2", "jq-console": "^2.13.2",
......
...@@ -17,6 +17,14 @@ export class Graph2DComponent { ...@@ -17,6 +17,14 @@ export class Graph2DComponent {
private instance: null; private instance: null;
private funciones= [];
private boton = true;
private id = 0;
private conjunto= [];
animation: Animation = { animation: Animation = {
data: [], data: [],
timer: null, timer: null,
...@@ -39,7 +47,7 @@ export class Graph2DComponent { ...@@ -39,7 +47,7 @@ export class Graph2DComponent {
let fun = eval(this.generarFuncion(jsonCanvas)); let fun = eval(this.generarFuncion(jsonCanvas));
var conjs = this.obtenerConjunto(jsonCanvas.funs[0]); var conjs = this.obtenerConjunto(jsonCanvas.funs[0]);
var d = conjs + "}"; var d = conjs + "}"; //Leo
var obj = JSON.parse(d); var obj = JSON.parse(d);
//Para las funciones //Para las funciones
...@@ -83,19 +91,60 @@ export class Graph2DComponent { ...@@ -83,19 +91,60 @@ export class Graph2DComponent {
}else{ }else{
tipoGraf = 'polyline'; tipoGraf = 'polyline';
} }
this.instance = functionPlot({
target: '#graph2D-container', if(this.boton){
width: 620, if(this.conjunto.length == 1){
height: 450, this.id = 1;
conj:obj.conj, this.conjunto.unshift({radio: 2, dom:this.conjunto[0].baseDom, cod:this.conjunto[0].baseCod, baseCod:this.conjunto[0].baseCod, baseDom:this.conjunto[0].baseDom, sets:{fdom:this.conjunto[0].baseDom,fcod:this.conjunto[0].baseCod}});
data: [{ this.funciones[0].id = this.id;
}
if (this.conjunto.length != 0){
if (obj.conj.baseDom == 'R'){
this.conjunto[0].baseDom = 'R';
this.conjunto[0].dom = 'R';
this.conjunto[0].sets.fdom = 'R';
}
if (obj.conj.baseCod == 'R'){
this.conjunto[0].baseCod = 'R';
this.conjunto[0].cod = 'R';
this.conjunto[0].sets.fcod = 'R';
}
}
this.conjunto.push(obj.conj);
this.funciones.push({
id: this.funciones.length + this.id,
sampler: 'builtIn', sampler: 'builtIn',
fn: function(scope) { fn: function(scope) {
return fun(scope.x) return fun(scope.x)
}, },
graphType: tipoGraf, graphType: tipoGraf,
color: color color: color
}], });
}else{
this.conjunto = [];
this.conjunto.push(obj.conj);
this.id = 0;
this.funciones = [];
this.funciones.push({
id: this.funciones.length,
sampler: 'builtIn',
fn: function(scope) {
return fun(scope.x)
},
graphType: tipoGraf,
color: color
});
}
this.instance = functionPlot({
target: '#graph2D-container',
width: 620,
height: 450,
conj:this.conjunto,
data: this.funciones,
zoom:1000,
plugins: [ plugins: [
functionPlot.plugins.zoomBox() functionPlot.plugins.zoomBox()
] ]
...@@ -272,6 +321,9 @@ export class Graph2DComponent { ...@@ -272,6 +321,9 @@ export class Graph2DComponent {
if (this.animation.playing) { if (this.animation.playing) {
this.stopAnimation(); this.stopAnimation();
} else { } else {
this.funciones = [];
this.conjunto = [];
this.id = 0;
this.instance.removeAllGraphs(); this.instance.removeAllGraphs();
} }
} }
...@@ -677,8 +729,5 @@ export class Graph2DComponent { ...@@ -677,8 +729,5 @@ export class Graph2DComponent {
return funcionString; return funcionString;
} }
} }
import { Component, OnInit, ViewChild, ElementRef, NgZone } from '@angular/core'; import { Component, OnInit, ViewChild, ElementRef, NgZone, AfterViewInit } from '@angular/core';
import * as graph3DLib from 'graph3D'; import * as graph3DLib from 'graph3D';
import { GHCIService } from '../../../shared/services/ghci.service'; import { GHCIService } from '../../../shared/services/ghci.service';
import { formatJSON, AnimationProps, Zoom3DType, GraphProps, Default_GraphProps, debounce } from './graph3D.helper'; import { formatJSON, AnimationProps, Zoom3DType, GraphProps, Default_GraphProps, debounce } from './graph3D.helper';
...@@ -11,7 +11,7 @@ import { formatJSON, AnimationProps, Zoom3DType, GraphProps, Default_GraphProps, ...@@ -11,7 +11,7 @@ import { formatJSON, AnimationProps, Zoom3DType, GraphProps, Default_GraphProps,
'(window:resize)': 'onResize($event)' '(window:resize)': 'onResize($event)'
} }
}) })
export class Graph3DComponent { export class Graph3DComponent implements AfterViewInit {
private ghciServiceSub: any; private ghciServiceSub: any;
...@@ -55,7 +55,13 @@ export class Graph3DComponent { ...@@ -55,7 +55,13 @@ export class Graph3DComponent {
ngAfterViewInit() { ngAfterViewInit() {
// this.zone.runOutsideAngular(() => { // this.zone.runOutsideAngular(() => {
graph3DLib.initialize(this.graph3DRef.nativeElement); graph3DLib.initialize(this.graph3DRef.nativeElement, true);
(function render() {
console.info("ngAfterViewInit: ####### FIRED");
//requestAnimationFrame(render);
graph3DLib.forceUpdateRenderer();
}());
//}) //})
} }
......
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