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

Fill.gradient

configuration

Defines the gradient fill of the shape.

<div id="diagram"></div>
<script>
$("#diagram").kendoDiagram({
    shapes: [{
        type: "rectangle",
        x: 100,
        y: 100,
        width: 200,
        height: 100,
        fill: {
            gradient: {
                type: "linear",
                start: [0, 0],
                end: [1, 1],
                stops: [
                    { offset: 0, color: "#ff6358" },
                    { offset: 1, color: "#ffd246" }
                ]
            }
        }
    }]
});
</script>

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.

<div id="diagram"></div>
<script>
$("#diagram").kendoDiagram({
    shapes: [{
        type: "rectangle",
        x: 100,
        y: 100,
        width: 200,
        height: 100,
        fill: {
            gradient: {
                type: "radial",
                center: [0.3, 0.3],
                radius: 0.7,
                stops: [
                    { offset: 0, color: "#ff6358" },
                    { offset: 1, color: "#ffd246" }
                ]
            }
        }
    }]
});
</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({
    shapes: [{
        type: "rectangle",
        x: 100,
        y: 100,
        width: 200,
        height: 100,
        fill: {
            gradient: {
                type: "linear",
                start: [0, 0],
                end: [1, 0],
                stops: [
                    { offset: 0, color: "#ff6358" },
                    { offset: 1, color: "#ffd246" }
                ]
            }
        }
    }]
});
</script>

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

Default: 1

<div id="diagram"></div>
<script>
$("#diagram").kendoDiagram({
    shapes: [{
        type: "rectangle",
        x: 100,
        y: 100,
        width: 200,
        height: 100,
        fill: {
            gradient: {
                type: "radial",
                center: [0.5, 0.5],
                radius: 0.3,
                stops: [
                    { offset: 0, color: "#ff6358" },
                    { offset: 1, color: "#ffd246" }
                ]
            }
        }
    }]
});
</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({
    shapes: [{
        type: "rectangle",
        x: 100,
        y: 100,
        width: 200,
        height: 100,
        fill: {
            gradient: {
                type: "linear",
                start: [0, 0.5],
                end: [1, 0.5],
                stops: [
                    { offset: 0, color: "#ff6358" },
                    { offset: 1, color: "#ffd246" }
                ]
            }
        }
    }]
});
</script>

The array of gradient color stops.

<div id="diagram"></div>
<script>
$("#diagram").kendoDiagram({
    shapes: [{
        type: "rectangle",
        x: 100,
        y: 100,
        width: 200,
        height: 100,
        fill: {
            gradient: {
                type: "linear",
                start: [0, 0],
                end: [1, 1],
                stops: [
                    { offset: 0, color: "#ff6358", opacity: 1 },
                    { offset: 0.5, color: "#ffd246", opacity: 0.8 },
                    { offset: 1, color: "#28b4c8", opacity: 0.6 }
                ]
            }
        }
    }]
});
</script>

The type of the gradient. Supported values are:

  • linear
  • radial

Default: "linear"

<div id="diagram"></div>
<script>
$("#diagram").kendoDiagram({
    shapes: [{
        type: "rectangle",
        x: 100,
        y: 100,
        width: 200,
        height: 100,
        fill: {
            gradient: {
                type: "radial",
                center: [0.5, 0.5],
                radius: 0.8,
                stops: [
                    { offset: 0, color: "#ff6358" },
                    { offset: 1, color: "#ffd246" }
                ]
            }
        }
    }]
});
</script>