I also got this exception when the following conditions applied:
- I used BarChart base on Categories
- I set myself the setLowerMargin and setUpperMargin on the
CategoryAxis.
In CategoryAxis.java in method calculateCategorySize we have:
result = available * (1 - getLowerMargin() -
getUpperMargin() - getCategoryMargin());
If we don't specify categorymargin it will be 0.2 if we then
set lowermargin and uppermargin as such that lowermargin +
uppermargin > 0.8, then result will be negative.
This result will be used to call
TextBlock label = createLabel(category, l * r, edge, g2);
in refreshTicks method.
This will call: TextUtilities.createTextBlock and pass a
negative width
It'll go further down to TextUtilities.nextLineBreak:
while (measurer.getStringWidth(text, start, end) > width) {
this wile loop will keep on executing until end become
negative eventually. when end becomes -1 in the
getStringWidth method a substring on (start, -1) will
generate the above exception.
Hope this helps :-)
Wim
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Logged In: YES
user_id=623001
I also got this exception when the following conditions applied:
- I used BarChart base on Categories
- I set myself the setLowerMargin and setUpperMargin on the
CategoryAxis.
In CategoryAxis.java in method calculateCategorySize we have:
result = available * (1 - getLowerMargin() -
getUpperMargin() - getCategoryMargin());
If we don't specify categorymargin it will be 0.2 if we then
set lowermargin and uppermargin as such that lowermargin +
uppermargin > 0.8, then result will be negative.
This result will be used to call
TextBlock label = createLabel(category, l * r, edge, g2);
in refreshTicks method.
This will call: TextUtilities.createTextBlock and pass a
negative width
It'll go further down to TextUtilities.nextLineBreak:
while (measurer.getStringWidth(text, start, end) > width) {
this wile loop will keep on executing until end become
negative eventually. when end becomes -1 in the
getStringWidth method a substring on (start, -1) will
generate the above exception.
Hope this helps :-)
Wim