#6 NumberFormatException on chco="ff0000|00ff00|0000ff"

closed
David Gilbert
None
5
2008-07-18
2008-06-24
Niklas Therning
No

Here's a "fix" for this problem:

private static Color[] parseColors(String text) {
if (text == null) {
throw new IllegalArgumentException(
"Null 'text' argument (in parseColors(String)).");
}
String[] codes = breakString(text, ',');
Color[] result = new Color[codes.length];
for (int i = 0; i < codes.length; i++) {
if (codes[i].length() > 0) {
String code = breakString(codes[i], '|')[0];
result[i] = Color.decode("0x" + code);
}
else {
result[i] = Color.black;
}
}
return result;
}

This, of course, won't add support for differently colored data points. But the chart will at least render (using the first color for all data points).

Discussion

  • David Gilbert
    David Gilbert
    2008-07-18

    Logged In: YES
    user_id=112975
    Originator: NO

    Thanks for the report. I applied your workaround to Subversion for inclusion in the 1.1.0 release.

    Regards,

    Dave

     
  • David Gilbert
    David Gilbert
    2008-07-18

    • assigned_to: nobody --> mungady
    • status: open --> closed