Hi,
I have a line chart with a x-axis based on time. Since there are multiple measures for each month, I'm just showing the label for the first day of each month. But I'm having trouble with the majorGridLines property. If I set it to true, all the lines are shown (attached figure 1). Another possibility is to show the grid lines in steps of 30, but of course, since each month has a different number of days, some values are shown in the wrong x-axis label...
Is there a way to align the majorGridLines with the custom labels?
Here is my code:
samples.forEach((s:any) => s.date = s.date.toDate());
this.panes.push({
clip: false,
name: 'samples'
});
this.categoryAxis.push({
name: 'samples',
pane: 'samples',
labels: {
visible: true,
template: "#= value.getDate() == 1 ? kendo.toString(value, 'MMMM') : '' #",
step: 1
},
majorGridLines: {
visible: true,
//step: 30
},
majorTicks: {
visible: false
},
minorGridLines: {
visible: false
},
justified: true,
baseUnit: 'days'
});
this.valueAxis.push({
name: 'samples',
pane: 'samples',
visible: true
});
let variables = Helpers.distinctInArray(samples, (i: MonitorSample) => i.variable);
variables.forEach(v => {
let filteredSamples = samples.filter(s => s.variable == v);
this.series.push({
name: v,
type: 'line',
line: {
style: 'smooth'
},
field: 'value',
categoryField: 'date',
axis: 'samples',
categoryAxis: 'samples',
data: filteredSamples,
tooltip: {
visible: true,
template: '#=value# #=category#'
}
})
});