In order to develop new Axis like a DataAxis that dynamically change the label format of a value is necessary to provide a way to disable this part of code in the Axis class, method layoutChildren():
// find added
for(T newValue: newTickValues) {
boolean found = false;
for (TickMark<T> tick: tickMarks) {
if(tick.getValue().equals(newValue)) {
found = true;
break;
}
}
if(!found) added.add(newValue);
}
So if there is a value that it was already shown but other format it would be recalled and the format will be actualized.
For example.-
There is a range set to 1.Jan.2010 to 1.Jan.2012 and then is changed to 1.Jan.2010 to 1.Feb.2010 because of this lines if 1.Jan.2010 was shown but because of this range just years are needed we would like to have 2010 2011 and 2012 BUT in the other range we would have also the days 1-Jan-2010 15-Jan-2010 1-Feb-2010. The code won´t call getTickMarkLabel() and refresh the label.
// find added
for(T newValue: newTickValues) {
boolean found = false;
for (TickMark<T> tick: tickMarks) {
if(tick.getValue().equals(newValue)) {
found = true;
break;
}
}
if(!found) added.add(newValue);
}
So if there is a value that it was already shown but other format it would be recalled and the format will be actualized.
For example.-
There is a range set to 1.Jan.2010 to 1.Jan.2012 and then is changed to 1.Jan.2010 to 1.Feb.2010 because of this lines if 1.Jan.2010 was shown but because of this range just years are needed we would like to have 2010 2011 and 2012 BUT in the other range we would have also the days 1-Jan-2010 15-Jan-2010 1-Feb-2010. The code won´t call getTickMarkLabel() and refresh the label.
- relates to
-
JDK-8096582 Slider CSS properties are changed when NumberAxis properties are reset
- Resolved