I am trying to change the border of the overview box from the default magenta. I tried using the directions given in a previous post in 2014, but stroke is no longer an option.
myOverview.box.elt(0).stroke
There are other options, such as areaBackground.
I am working in Angular and this was my last try:
const myOverview = (go.Overview, 'myOverviewDiv', // the HTML DIV element for the Overview
{ observed: myDiagram, contentAlignment: go.Spot.Center }); // tell it which Diagram to show and pan
myOverview.box.elt(0).areaBackground = (go.Brush, go.Brush.Linear, {color: ‘orange’});
}
Can someone please point me in the right direction?
const myOverview =
$(go.Overview, ‘myOverviewDiv’, // the HTML DIV element for the Overview
{ observed: myDiagram, contentAlignment: go.Spot.Center }); // tell it which Diagram to show and pan
const box = new go.Part();
const s = new go.Shape();
s.stroke = ‘orange’;
s.strokeWidth = 2;
s.fill = ‘transparent’;
s.name = ‘BOXSHAPE’;
box.selectable = true;
box.selectionObjectName = ‘BOXSHAPE’;
box.locationObjectName = ‘BOXSHAPE’;
box.resizeObjectName = ‘BOXSHAPE’;
box.cursor = ‘move’;
box.selectionAdorned = false;
box.add(s);
myOverview.box = box;
}
You didn’t give any hints that you were using TypeScript and that the error was a compile-time error, not a run-time error. I bet my code works correctly.
Panel.elt is declared to return a GraphObject, not a Shape, so you’ll need to cast it to a Shape.