setShape

defines styles for a specified shape

void setShape(string id,object obj);
idstringshape ID
objobjectshape configuration

Example

// set styles for each block with type "rrect"
$$("diagram1").setShape("rrect", {
  backgroundColor: "#D1C4E9", 
  lineColor: "#D1C4E9"
});

Related samples

Details

The configuration object can include the following fields:

  • angle (string, number) - angle of the shape rotation. The rotation origin is center
  • name (string) - name displayed in the tooltip when the correspodning shape is hovered over in the editor
  • fillOpacity (string, number) - opacity of the fill color inside the shape. Ranges from 0.0 to 1 or percentage from "0%" to "100%"
  • lineWidth (string, number) - width of the shape outline
  • lineColor (string, number) - color of the shape outline. "#ccd7e6" be default
  • lineStyle (string, number) - stroke-dasharray for outline. Possible values are
    • "dotted"
    • "dashed"
    • numeric value The higher value is, the more space is in between dashes.
  • backgroundColor (string) - background color (color name or HEX value). "#f4f5f9" by default
  • altBackgroudColor (string) - alternative background. "#ccd7e6" by default. The property is only applicable to the "dots" type and custom shapes.
See also
Back to top
Join Our Forum
We've retired comments here. Visit our forum for faster technical support, connect with other developers, and share your feedback there.