New to Kendo UI for jQueryStart a free 30-day trial

Defines the gradient fill of the shape.

<div id="diagram"></div>
<script>
  $("#diagram").kendoDiagram({
    layout: "tree",
    shapeDefaults: {
      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
            }
          ]
        }
      }
    },
    shapes: [{
      id: "1",
      content: {
        text: "Monday"
      }
    }, {
      id: "2",
      content: {
        text: "Tuesday"
      }
    }, {
      id: "3",
      content: {
        text: "Wednesday"
      }
    }],
    connections: [{
      from: "1",
      to: "2"
    },{
      from: "2",
      to: "3"
    }],
    connectionDefaults: {
      endCap: "ArrowEnd"
    }
  });
</script>

The center of the radial gradient.

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

<div id="diagram"></div>
<script>
$("#diagram").kendoDiagram({
    shapeDefaults: {
        fill: {
            gradient: {
                type: "radial",
                center: [0.3, 0.3],
                stops: [
                    { offset: 0, color: "#ff6600" },
                    { offset: 1, color: "#cc0000" }
                ]
            }
        }
    },
    shapes: [{
        id: "1",
        content: { text: "Radial Gradient" },
        x: 100,
        y: 20
    }]
});
</script>

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.

<div id="diagram"></div>
<script>
$("#diagram").kendoDiagram({
    shapeDefaults: {
        fill: {
            gradient: {
                type: "linear",
                start: [0, 0],
                end: [0, 1],
                stops: [
                    { offset: 0, color: "#00cc66" },
                    { offset: 1, color: "#003322" }
                ]
            }
        }
    },
    shapes: [{
        id: "1",
        content: { text: "Vertical Gradient" },
        x: 100,
        y: 20
    }]
});
</script>

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

Default: 1

<div id="diagram"></div>
<script>
$("#diagram").kendoDiagram({
    shapeDefaults: {
        fill: {
            gradient: {
                type: "radial",
                center: [0.5, 0.5],
                radius: 0.8,
                stops: [
                    { offset: 0, color: "#0066cc" },
                    { offset: 1, color: "#003366" }
                ]
            }
        }
    },
    shapes: [{
        id: "1",
        content: { text: "Radial Gradient" },
        x: 100,
        y: 20
    }]
});
</script>

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.

<div id="diagram"></div>
<script>
$("#diagram").kendoDiagram({
    shapeDefaults: {
        fill: {
            gradient: {
                type: "linear",
                start: [0, 0],
                end: [1, 1],
                stops: [
                    { offset: 0, color: "#ff6600" },
                    { offset: 1, color: "#cc0000" }
                ]
            }
        }
    },
    shapes: [{
        id: "1",
        content: { text: "Linear Gradient" },
        x: 100,
        y: 20
    }]
});
</script>

The array of gradient color stops.

<div id="diagram"></div>
<script>
$("#diagram").kendoDiagram({
    shapeDefaults: {
        fill: {
            gradient: {
                type: "linear",
                start: [0, 0],
                end: [1, 0],
                stops: [
                    { offset: 0, color: "#ff0000", opacity: 0.8 },
                    { offset: 0.5, color: "#00ff00", opacity: 0.9 },
                    { offset: 1, color: "#0000ff", opacity: 1 }
                ]
            }
        }
    },
    shapes: [{
        id: "1",
        content: { text: "Multi-stop Gradient" },
        x: 100,
        y: 20
    }]
});
</script>

The type of the gradient. The supported values are:

  • linear
  • radial

Default: "linear"

<div id="diagram"></div>
<script>
$("#diagram").kendoDiagram({
    shapes: [
        {
            id: "1",
            content: {
                text: "Linear Gradient"
            },
            x: 50,
            y: 50
        },
        {
            id: "2",
            content: {
                text: "Radial Gradient"
            },
            x: 250,
            y: 50
        }
    ],
    shapeDefaults: {
        fill: {
            gradient: {
                type: "linear",
                start: [0, 0],
                end: [1, 1],
                stops: [
                    {
                        offset: 0,
                        color: "red"
                    },
                    {
                        offset: 1,
                        color: "blue"
                    }
                ]
            }
        }
    }
});
</script>