Hi Brian,
For the colors, you may consider to specify your own automatic color.
The default automatic color is defined as an array of colors accessible as
Chart.defaultPalette. ChartDirector picks the data color from the array sequentially, and if
it reaches the end of the array, it will start from the beginning. For your information, the
default data color lists are:
0xff3333, 0x33ff33, 0x6666ff, 0xffff00,
0xff66ff, 0x99ffff, 0xffcc33, 0xcccccc,
0xcc9999, 0x339966, 0x999900, 0xcc3300,
0x669999, 0x993333, 0x006600, 0x990099,
0xff9966, 0x99ff99, 0x9999ff, 0xcc6600,
0x33cc33, 0xcc99ff, 0xff6666, 0x99cc66,
0x009999, 0xcc3333, 0x9933ff, 0xff0000,
0x0000ff, 0x00ff00, 0xffcc99, 0x999999,
For your case, you can create a new array by removing certain colors from the above
array. For example, in Java, it is like:
int[] myColors = {0xff3333, 0x6666ff, 0xffff00,
0xff66ff, 0x99ffff, 0xcccccc,
0xcc9999, 0x339966, 0x999900, 0xcc3300,
0x669999, 0x993333, 0x006600, 0x990099,
0xff9966, 0x99ff99, 0x9999ff, 0xcc6600,
0x33cc33, 0xcc99ff, 0xff6666, 0x99cc66,
0x009999, 0xcc3333, 0x9933ff, 0xff0000,
0x0000ff, 0x00ff00, 0xffcc99, 0x999999};
// Use the above list as the automatic data colors
c.setColors(Chart.DataColor, myColors);
For the line overlapping problem, if two or more lines are using exactly the same data (or
so close together that graphically they can be treated as the same), it is normal that
they will exactly overlap. One method to address the issue is to add symbols to certain
points on the line.
I am not sure the exact x-coordinate you are using. Suppose your code is using a label
based x-axis, that is, the x-axis is configured using Axis.setLabels, and there is no x-
coordinate provided to the line layers (no Layer.setXData). In this case, the x-
coordinates of the data points are just the array index.
Now you can add an extra scatter layer with data points at x = 0, 3, 6, 9, .... using a
small pink symbol (may be a pink circle). For another line, you can use x = 1, 4, 7, .....
So each line will have some symbols at some positions. The symbols will not overlap
because they are at different x-coordinates. The symbols can be added behind the lines
and are larger than the line width so they will not be completely blocked by the line and
so are always visible. You can even at symbols at fractional positions like at x = 0.5, 3.5,
6.5, ...., but you would need to determine the y-coordinates at those positions by
interpolation. With this method, all symbols will be visible. The drawback is that the user
may be confused on what those symbols mean.
Regards
Peter Kwan |