Timeline Chart has non linear scaling of X Axis

In the attached screenshot the X Axis of the Chart is really messed up. We are looking at a timespan of about 16 years, yet most of the space is taken up by about 6 months:



Here is my source code:

chart = new Chart();
chart.setSizeFull();
chart.setTimeline(true);
Configuration configuration = chart.getConfiguration();
configuration.setTitle("");
configuration.setLegend(new Legend(true));
configuration.setExporting(true);
RangeSelector rangeSelector = new RangeSelector(true);
rangeSelector.addButton(new RangeSelectorButton(RangeSelectorTimespan.WEEK, 1, "1 W"));
rangeSelector.addButton(new RangeSelectorButton(RangeSelectorTimespan.MONTH, 1, "1 M"));
rangeSelector.addButton(new RangeSelectorButton(RangeSelectorTimespan.YEAR, 1, "1 J"));
rangeSelector.addButton(new RangeSelectorButton(RangeSelectorTimespan.YEAR, 5, "5 J"));
rangeSelector.addButton(new RangeSelectorButton(RangeSelectorTimespan.ALL, 1, "Alles"));
rangeSelector.setSelected(5);

In my opinion this should not be this way, it should be a linear scaling and labeling of the axis.
29618.png

Hi Johannes,

Have you tried setting the xAxis ordinal to false?

         configuration.getxAxis().setOrdinal(false);

If this doesn’t help please include some data set to reproduce the issue.

BR,

Guille

Hi Guille,

No I haven’t set ordinal at all. I did set it to false which seems to cure this problem. But I’m still skeptical about the timeline mode of the chart. How can this variable have been changed like that? If I use a none timeline chart and set the axis to
AxisType.DATETIME it looks non ordinal. If I do the samething with timeline: timeline + AxisType.DATETIME it scales it ordinally. Seems odd…

Anyway thank you for helping that solves this issue for now for me.

I’m glad it worked. And I understand it’s not super clear, by definition a timeline chart always has datetime XAxis but can be ordinal or not, it’s mostly related to visualization of large data sets.

OK. It seems that this is somehow similar to a facebook timeline. Is this something you took into account when implementing the timeline mode? :slight_smile: