series.labels.visual Function

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

  • text - the label text.
  • rect - the kendo.geometry.Rect that defines where the visual should be rendered.
  • options - the label options.
  • createVisual - a function that can be used to get the default visual.
  • sender - the chart instance (may be undefined).
  • value - The point value.
  • category - The point category.
  • stackValue - The cumulative point value on the stack. Available only for the stackable series.
  • dataItem - The point dataItem.
  • series - The point series.
  • percentage - The point value that is represented as a percentage value. Available only for the Donut, Pie, and 100% stacked charts.
  • runningTotal - The sum of point values from the last runningTotal summary point onwards. Available for the Waterfall series.
  • total - The sum of all previous series values. Available for the Waterfall series.

Example - using custom visual for the labels

<div id="chart"></div>
<script>
  $("#chart").kendoChart({
    series: [ {
      labels: {
        visible: true,
        visual: function(e) {
          var center = e.rect.center();
          return new kendo.drawing.Text(e.text, [center.x, e.rect.origin.y], {
            fill: {
              color: "red"
            }
          });
        }
      },
      data: [1, 2, 3]
    }]
  });
</script>
In this article