Kendo Bar chart data labels cropped
Demonstrates problem with missing topmost grid line
by Demoit
HTML
<script src="http://cdn.kendostatic.com/2014.1.318/js/kendo.all.min.js"></script>
<link rel="stylesheet" href="http://cdn.kendostatic.com/2014.1.318/styles/kendo.common.min.css">
<link rel="stylesheet" href="http://cdn.kendostatic.com/2014.1.318/styles/kendo.default.min.css">
<div id="chart"></div>
CSS
#chart .k-tooltip {
border-width: 1px;
}
.it-tooltip-content {
margin: 5px;
text-align: left;
}
.align-client10 {
padding: 10px;
height: calc(100% - 20px);
width: calc(100% - 20px);
}
JavaScript
var redrawing = false;
var chartAxisMax = 0;
var chartAxisMajorUnit = 0;
function resizeChart() {
if (!redrawing) {
redrawing = true;
window.setTimeout(function () {
var kchart = $("#chart").data("kendoChart");
if (kchart) {
// force resize
$("#chart").height($("#chart").parent().height() - 20);
// adapt labels layout depending on available space
if ($("#chart").width() < 1230) {
kchart.options.categoryAxis.labels.rotation = 15;
}
else {
kchart.options.categoryAxis.labels.rotation = 0;
}
// expand axis height
calculateMajorUnit(0, chartAxisMax);
valueAxis = [{
name: "volumeAxis",
title: { text: "Batch count", font: "16px Segoe UI, Arial", color: "#6f6f6e" },
labels: { format: "{0}", skip: 2, step: 2, opacity: 1 },
color: '#adadad',
max: chartAxisMax + chartAxisMajorUnit*2,
pane: "volumePane",
majorGridLines: {
dashType: "solid",
}
}, {
name: "time",
visible: false,
min: 1,
max: 1,
pane: "topPane",
majorGridLines: {
visible: false
}
}];
kchart.setOptions({ valueAxis: valueAxis });
// now redraw chart
kchart.redraw();
// add name property for testcomplete
$("#chart svg text").attr("name", function (i, val)...