fillString|Object

Defines the fill options of the shape.

Example - customizing shape background

<div id="diagram"></div>
<script>
  var Shape = kendo.dataviz.diagram.Shape;
  $("#diagram").kendoDiagram();
  var diagram = $("#diagram").data("kendoDiagram");

  var shape = new Shape({
    id: 1,
    x: 20,
    y: 20,
    fill: {
      color: "#0000ff",
      opacity: 0.5
    },
    width: 200
  });
  diagram.addShape(shape);
</script>

fill.colorString

Defines the fill color of the shape.

fill.opacityNumber(default: 1)

Defines the fill opacity of the shape.

fill.gradientObject

Defines the gradient fill of the shape.

Example - Creating a shape with gradient background

<div id="diagram"></div>
<script>
  var Shape = kendo.dataviz.diagram.Shape;
  $("#diagram").kendoDiagram();
  var diagram = $("#diagram").data("kendoDiagram");

  var shape = new Shape({
    id: 1,
    x: 20,
    y: 20,
    fill: {
      gradient: {
        type: "radial",
        center: [0.5, 0.5],
        radius: 0.9,
        stops: [
          {
            offset: 0,
            color: "lightblue",
            opacity: 0.5
          }, {
            offset: 0.5,
            color: "purple",
            opacity: 0.8
          }
        ]
      }
    }
  });
  diagram.addShape(shape);
</script>

fill.gradient.typeString(default: "linear")

The type of the gradient. Supported values are:

  • linear
  • radial

fill.gradient.centerArray

The center of the radial gradient.

Coordinates are relative to the shape bounding box. For example [0, 0] is top left and [1, 1] is bottom right.

fill.gradient.radiusNumber(default: 1)

The radius of the radial gradient relative to the shape bounding box.

fill.gradient.startArray

The start point of the linear gradient.

Coordinates are relative to the shape bounding box. For example [0, 0] is top left and [1, 1] is bottom right.

fill.gradient.endArray

The end point of the linear gradient.

Coordinates are relative to the shape bounding box. For example [0, 0] is top left and [1, 1] is bottom right.

fill.gradient.stopsArray

The array of gradient color stops.

fill.gradient.stops.offsetNumber

The stop offset from the start of the element. Ranges from 0 (start of gradient) to 1 (end of gradient).

fill.gradient.stops.colorString

The color in any of the following formats.

| Format | Description | --- | --- | --- | red | Basic or Extended CSS Color name | #ff0000 | Hex RGB value | rgb(255, 0, 0) | RGB value

Specifying 'none', 'transparent' or '' (empty string) will clear the fill.

fill.gradient.stops.opacityNumber

The fill opacity. Ranges from 0 (completely transparent) to 1 (completely opaque).