Getting multiple charts to display the same interval


I have multiple charts side by side. I’m trying to get them to display the same interval. I’ve computed a Range that would cover all of them (basically a union of all their data ranges). However, I’m having a hard time figuring out what I need to set to make this work.

I tried setting the default range but that doesn’t seem to be doing anything. Then I tried setting default range and requesting current range to the default range, that doesn’t work either. 

For example, let’s say I have two charts going from 2 to 5 and from 3 to 6 respectively on the Y axis. I’d like both of them to display the 2 to 6 span on the y axis, and the first one to be empty from 5 to 6 and the second one to be empty from 2 to 3. I hope this makes sense.




I’ve narrowed this down, and it’s an issue with DateTimeAxis. The same code works fine for NumberAxis.


Hello Radu,

Thank you for getting in touch.

We are not aware of any issue with our DateTimeAxis. Thank you for bringing this to our attention. We will investigate this matter further and let you know what we find in due course.

In the meantime if you need any further help please get back in touch.

Thanks again,



Hi Radu,

I’ve taken a look into this issue but couldn’t seem to recreate your problem.

Are you setting the default range on the axes before adding your data to the chart? If not, and depending on the settings on the axes (e.g. whether panning out of the default range is allowed etc.), you may not see any difference (as the axes are behaving as they should).

I am interested, however, in the fact you’ve seen a difference between DateTime and Number axes. Would it be possible to send in a simple, cut down example project with this problem occuring? If you could send it to that would be great.

Kind regards,



Hi Patrick,

Here’s what the app is supposed to be doing:

I have say 6 different charts. They all display data from roughly the same Y axis values, but not exaclty the same. These charts get continually updated (every 10 seconds or so). I need them to be synced at all times, that mean if I were to draw a horizontal line it would correspond to the same Y axis values on all charts.

I’m a bit puzzled by your answer - what would be a good sequence of calls and settings that would allow me to achieve what I’m looking for? Are you saying that setting the default range would only work if called before adding the data?

Basically what I’m looking for is to allow (and restrict) all my six charts to displaying data in a range from the global minimum and global maximum (across all six charts). Let’s say they display data from the following ranges: [1,5], [2,4],[3,6] I would need them all to have the range as [1,6]. I hope this makes sense. Would that be possible? 




Also, I’m running into a related issue where having a chart with no data doesn’t seem to be responding correctly to requestCurrentDisplayedRange (it’s basically ignoring it).


Hello Radu,

Thanks for getting in touch.

In terms of setting a default range it can be set before or after the data is loaded to the chart, depending upon what you are trying to achieve with it. Based on your requirements we believe it would be beneficial for you to set the default range before your data is loaded to the chart. The reason for this is that if you set the default range after the data has been loaded, the displayed range will only change if the currently displayed range has been deemed invalid, by the setting of the default range. 

Similarly, if you use the command requestCurrentDisplayedRange, the requested range will only be displayed if doing so will not be deemed invalid. I will try to illustrate what I mean by this: if you do not allow panning outside of the max range (this is a union of the default range and the data range) by calling allowPanningOutOfMaxRange(false), but then request a broader displayedRange (than the max range) the displayed range will only move out to the limits of the max range. This is because moving beyond this range would result in an invalid data range being displayed, because you have specifically set the library to not allow panning outside of the max range. 

To recap the Java docs for the Axis class:

allowPanningOutOfDefaultRange - Sets whether or not the user is permitted to pan outside of the user-set default range. If the default range is not set, the range of this axis’ data is used instead and allowPanningOutOfMaxRange(boolean) should be used instead.

allowPanningOutOfMaxRange - Sets whether or not the user is permitted to pan outside of the max range for this axis, where the max range is the union of this axis’ data range and its default range. Even if this is set to true panning will still be restricted to this axis’ default range if isPanningOutOfDefaultRangeAllowed() is false.

I also notice that your application refreshes its data every 10 seconds. There is also the option of calling setCurrentDisplayedRangePreservedOnUpdate(true). This will ensure that the displayed ranges do not change as the data changes. However, setting the default range before the data is loaded should suffice.

For reference please see the api docs for the Axis class at the link below:

Regarding your other related issue regarding an empty chart, we will investigate this matter and come back to you soon.

I hope that you find this information helpful, if you need any further assistance please do not hesitate to get in touch.




I don’t have the time to trim down my project again just to recreate this issue, but I believe it’s related to scrolling. Setting the default range on my X axis works fine - I use it to add a bit of padding on the sides.

However, on the Y axis, when scrolling and zooming is enabled, it doesn’t seem to work properly. I have allowPanningOutOfDefaultRange set to true, and allowPanningOutOfMaxRange set to false (though I did try with true as well but still ran into the same problem). Also note that the same code works fine for a Number axis. I’m setting the default range repeatedly based on the global min and max values.

I’ll attempt a different approach to this whole problem by using a single chart and messing with the X ranges so as to simulate multiple “lanes”, but I believe there are still some issues lurking in the default range piece.

If you still have the sample project where you tried to replicate this issue but could reproduce it, maybe you could send that to me to see what am I doing differently?




Hello Radu,

Just to let you know that I have sent you an email explaining things a little further.