Commit 3666bb6f authored by Diego Rey's avatar Diego Rey
Browse files

Added polygon and line shapes

parent 8ea56b3d
......@@ -4139,7 +4139,7 @@
"dev": true
},
"function-plot": {
"version": "git://github.com/diego-rey/function-plot.git#81713c85f1fb90ff0f41a3dade1bcd831e80b6fa",
"version": "git://github.com/diego-rey/function-plot.git#ecc44bb412db00356cb3dda42ea4c981eaad7bd6",
"from": "git://github.com/diego-rey/function-plot.git#feature/integration-multigraf-shape",
"requires": {
"array-range": "^1.0.1",
......
......@@ -163,7 +163,6 @@ export class Graph2DComponent {
});
}
let bounding = this.getBounding();
console.log(bounding);
this.instance = functionPlot({
target: '#graph2D-container',
width: bounding.width,
......@@ -274,10 +273,6 @@ export class Graph2DComponent {
}
}
onClickMe(event) {
console.log('click');
}
/**
* @name getBounding
* @desc get the measures of the container of the graph
......@@ -562,43 +557,42 @@ export class Graph2DComponent {
* @param {Object} lineData Data of Line to be normalized
* @returns {Object}
*/
// public normalizeLineData = function ($lineData) {
// var $lineNormalized:any = {};
// var $points = []
// for (var p of $lineData.pts) {
// $points.push([p[0],p[1]]);
// }
// $lineNormalized.points = $points;
// $lineNormalized.color = $lineData.color;
// $lineNormalized.rotation = $lineData.rot;
// $lineNormalized.fnType = 'points';
// $lineNormalized.polylineType = 'line';
// $lineNormalized.graphType = 'polyline';
public normalizeLineData = function ($lineData) {
var $lineNormalized:any = {};
var $points = []
for (var p of $lineData.pts) {
$points.push([p[0],p[1]]);
}
$lineNormalized.points = $points;
$lineNormalized.stroke = $lineData.color;
$lineNormalized.rotation = $lineData.rot;
$lineNormalized.fnType = 'points';
$lineNormalized.polylineType = 'line';
$lineNormalized.graphType = 'polyline';
// return $lineNormalized;
// }
return $lineNormalized;
}
/**
* @name normalizePolygonData
* @desc Normalize Polygon data for Function Plot Library
* @param {Object} textData Data of Polygon to be normalized
* @returns {Object}
*/
// public normalizePolygonData = function ($textData) {
// var $PoligonNormalized:any = {};
// var $shape:any = {};
// $shape.text = $textData.text;
// $shape.size = $textData.size;
// $shape.x = $textData.x;
// $shape.y = $textData.y;
// $textData.color && ($shape.fill = $textData.color);
// $textData.rot !== 'undefined' && ($shape.rotation = $textData.rot);
// $textNormalized.shape = $shape;
// $textNormalized.graphType = 'shape';
// $textNormalized.shapeType = 'text';
public normalizePolygonData = function ($polygonData) {
var $polygonNormalized:any = {};
var $points = []
for (var p of $polygonData.pts) {
$points.push([p[0],p[1]]);
}
$polygonNormalized.points = $points;
$polygonNormalized.fill = $polygonData.color;
$polygonNormalized.rotation = $polygonData.rot;
$polygonNormalized.fnType = 'points';
$polygonNormalized.polylineType = 'polygon';
$polygonNormalized.graphType = 'polyline';
// return $textNormalized;
// }
return $polygonNormalized;
}
/**
* @name normalizeShapesData
......@@ -622,14 +616,14 @@ export class Graph2DComponent {
normalized.push(this.normalizeTextData(shape));
break;
}
// case 'line': {
// normalized.push(this.normalizeLineData(shape));
// break;
// }
// case 'polygon': {
// normalized.push(this.normalizePolygonData(shape));
// break;
// }
case 'line': {
normalized.push(this.normalizeLineData(shape));
break;
}
case 'poly': {
normalized.push(this.normalizePolygonData(shape));
break;
}
}
}
return normalized;
......
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