getAxis

Returns an axis with specific name.

Parameters

name String

The axis name.

Returns

kendo.dataviz.ChartAxis The chart axis.

Example - draw a line based on axis value

<div id="chart"></div>
<script>
  $("#chart").kendoChart({
    series: [{
      data: [1, 2]
    }],
    valueAxis: {
      name: "value"
    },
    categoryAxis: {
      name: "category"
    }
  });

  var chart = $("#chart").data("kendoChart");
  var valueAxis = chart.getAxis("value");
  var categoryAxis = chart.getAxis("category");
  var valueSlot = valueAxis.slot(1.5);
  var categoryRange = categoryAxis.range();
  var categorySlot = categoryAxis.slot(categoryRange.min, categoryRange.max);

  var path = new kendo.drawing.Path({
    stroke: {
      color: "red",
      width: 3
    }
  }).moveTo(categorySlot.origin.x, valueSlot.origin.y)
  .lineTo(categorySlot.bottomRight().x, valueSlot.origin.y);

  chart.surface.draw(path);
</script>
In this article