Is it possible to adjust annotations on the condition?
For ex. If the plotted shape has dimensions:
1. above 100x100 then everything will be visible (like order id & on next line dimensions as 100x100).
2. 20x20 then everything will be hidden
3. 30x30 then only height or width will be visible(like 30)
4. 50x50 then only dimensions will be visible (like 30x30)
Right now annotations are getting out of the shape when the shape is small and annotations are big.
Below is my code
// shapes
GetRectangle() {
this.diagramConstraints=~(DiagramConstraints.UserInteraction);
var _me = this;
var num = 1;
_me.nodes=[];
this.dimensions.map(function (shapes) {
if (shapes.shape_type == "input") {
_me.bgcolor = 'yellow';
_me.bordercolor = 'green';
}
_me.nodes.push({
id: 'shape' + num,
offsetX: shapes.xaxis,
offsetY: shapes.yaxis,
width: shapes.length,
height: shapes.width,
style: {
fill: _me.bgcolor,
strokeColor: _me.bordercolor
},
pivot: {x:0,y:0}
});
num++;
})
this.orders.map(function (shapes) {
if (shapes.shape_type == "parts") {
_me.bgcolor = '#c0c0c0';
}
else if (shapes.shape_type == "remnant") {
_me.bgcolor = '#ffffff';
}
else if(shapes.shape_type=="scrap") {
_me.bgcolor = 'red';
}
_me.nodes.push({
id: 'shape' + num,
offsetX: shapes.xaxis,
offsetY: shapes.yaxis,
width: shapes.length,
height: shapes.width,
style: {
fill: _me.bgcolor
},
// Here you can store your JSON order Id
addInfo: [
{customer:shapes.customer},
{orderid: shapes.orderid},
{requested_delivery_date:shapes.requested_delivery_date},
{priority:shapes.priority}
],
annotations: [
{
content: (shapes.orderid).toString(),
margin:
{
bottom:20
},
style:
{
textWrapping:"Wrap",
textOverflow:"Ellipsis"
}
},
{
content: (shapes.length).toString() + '*' + (shapes.width).toString()
}
],
pivot: {x:0,y:0}
});
num++;
})
}