I am developing a RangeBar chart that shows the timeline (date range) a medication was taken by a patient. I haven't been able to get the value axis to display dates or the bar to show at all. This is how the chart is built:
@(
Html.Kendo().Chart<ChartDetailDto>()
.Name("rangeChart_" + Model.ElementId)
.HtmlAttributes(new { @class = "w-100 rangeChart" })
.ChartArea(ca => ca.Background("var(--bs-body-bg)"))
.Legend(l => l.Visible(false))
.ToClientTemplate()
)
function loadRangeBarChart(patientId, medId, isMedClass, medName) {
abp.ajax({
url: abp.appPath + 'App/PatientFigures/GraphRangeChartData',
dataType: "json",
data: {
id: patientId,
medId: medId,
isMedClass: isMedClass
},
type: "GET",
traditional: true,
}).fail(function (e) {
console.log(e);
}).done(function (result) {
var data = result.map(m => ({
dose: m.dose,
startDate: new Date(m.startDate),
endDate: new Date(m.endDate)
}));
var chart = $("#rangeChart_" + medId).data("kendoChart");
chart.setOptions({
dataSource: {
data: data
},
series: [{
type: "rangeBar",
fromField: "startDate",
toField: "endDate",
categoryField: "dose",
name: medName,
color: "#48A103",
opacity: 0.5,
gap: 5
}],
valueAxis: {
type: "date",
field: "date",
baseUnit: "months",
labels: {
format: "{0:dd/MM/yyyy}",
rotation: 30
}
}
})
});
}
this is how it currently looks:
the category axis works fine.
Also, does the rangeBar chart allow zoom and pan?