New to Kendo UI for jQuery? Start a free 30-day trial

Legend.item.markers

configuration

The configuration of the Chart legend item markers.

By default, the marker configuration will be the same as the series.markers settings of the displayed series.

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  series: [{
    type: "line",
    markers: {
      visible: true,
      background: "green"
    },
    data: [1, 2, 3]
  }],
  legend: {
    item: {
      markers: {
        visible: false
      }
    }
  }
});
</script>

The background color of the legend item markers.

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  legend: {
    item: {
      markers: {
        background: "orange"
      }
    }
  },
  series: [
    { name: "Series 1", data: [1, 2, 3] },
    { name: "Series 2", data: [4, 5, 6] }
  ]
});
</script>

The border of the markers.

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  legend: {
    item: {
      markers: {
        border: {
          color: "red",
          width: 2,
          dashType: "solid"
        }
      }
    }
  },
  series: [
    { name: "Series 1", data: [1, 2, 3] },
    { name: "Series 2", data: [4, 5, 6] }
  ]
});
</script>

The border radius in pixels when type is set to "roundedRect".

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  legend: {
    item: {
      markers: {
        type: "roundedRect",
        borderRadius: 8,
        background: "lightblue"
      }
    }
  },
  series: [
    { name: "Series 1", data: [1, 2, 3] },
    { name: "Series 2", data: [4, 5, 6] }
  ]
});
</script>

The markers shape.

The supported values are:

  • "circle" - the marker shape is circle.
  • "square" - the marker shape is square.
  • "triangle" - the marker shape is triangle.
  • "cross" - the marker shape is cross.
  • "rect" - alias for "square".
  • "roundedRect" - the marker shape is a rounded rectangle.
<div id="chart"></div>
<script>
$("#chart").kendoChart({
  legend: {
    item: {
      markers: {
        type: "triangle",
        background: "yellow"
      }
    }
  },
  series: [
    { name: "Series 1", data: [1, 2, 3] },
    { name: "Series 2", data: [4, 5, 6] }
  ]
});
</script>

If set to true the chart will display the legend item markers. Defaults to the series options.

<div id="chart"></div>
<script>
$("#chart").kendoChart({
  legend: {
    item: {
      markers: {
        visible: false
      }
    }
  },
  series: [
    { name: "Series 1", data: [1, 2, 3] },
    { name: "Series 2", data: [4, 5, 6] }
  ]
});
</script>

A function that can be used to create a custom visual for the markers. The available argument fields are:

  • rect - the kendo.geometry.Rect that defines where the visual should be rendered.
  • options - the marker options.
  • createVisual - a function that can be used to get the default visual.
  • category - the category of the marker point.
  • dataItem - the dataItem of the marker point.
  • value - the value of the marker point.
  • sender - the chart instance.
  • series - the series of the marker point.
<div id="chart"></div>
<script>
  $("#chart").kendoChart({
    series: [{
      type: "line",
      name: "Series A",
      data: [1, 2, 3]
    }],
    legend: {
      position: "bottom",
      item: {
        markers: {
          visual: function (e) {
            var origin = e.rect.origin;
            var center = e.rect.center();
            var bottomRight = e.rect.bottomRight();

            var path = new kendo.drawing.Path({
              fill: {
                color: e.options.border.color
              }
            })
            .moveTo(origin.x, bottomRight.y)
            .lineTo(bottomRight.x, bottomRight.y)
            .lineTo(center.x, origin.y)
            .close();

            return path;
          }
        }
      }
    }
  });
</script>