You could try dual pointers, each pointing to a different place in the spectrum. At least this way you'd end up with alternating colors.
private Color GetSeriesColor( int seriesIndex,
int seriesCount,
int steps ) {
return ColorHelper.FromHsv(
( 360.0 / steps ) * ( 1.0 * seriesIndex / seriesCount ) +
( ( seriesIndex % steps ) * ( 360.0 / steps ) ),
1, 1 );
}
Calling code:
GetSeriesColor( 5, 18, 2 );
This will create two "pointers". The first will start at position 0, the second at position 180. The function will alternate between the two pointers, giving a sort of "checkerboard" look to the graph.
If you don't like the effect, your best bet might be a color palette (stored in an array) with x number of predefined colors, looping when you've reached the end (or possible adding shading, such as darker colors to lighter colors).
EDIT
I'll add, though, that using color coding willy-nilly is often a poor design choice. You'd be better off using labels directly on the graph, if possible. Beyond about 8 colors the human eye begins to have trouble differentiating between them. See https://ux.stackexchange.com/questions/17964/how-many-visually-distinct-colors-can-accurately-be-associated-with-a-separate.