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.