Here some example code...
int runListColorIndex = startingIndex;
int bikeListColorIndex = startingIndex;
int swimListColorIndex = startingIndex;
foreach (DataPoint p in series.Points)
{
ChartHatchStyle hatchStyle = ChartHatchStyle.None;
Color colorToUse = Color.ForestGreen;
switch (p.AxisLabel[0])
{
case 'R':
colorToUse = myCurrentFilterOptions.RunColor;
hatchStyle = HatchArray[runListColorIndex];
runListColorIndex++;
runListColorIndex %= HatchArray.Count;
break;
case 'B':
colorToUse = myCurrentFilterOptions.BikeColor;
hatchStyle = HatchArray[bikeListColorIndex];
bikeListColorIndex++;
bikeListColorIndex %= HatchArray.Count;
break;
case 'S':
colorToUse = myCurrentFilterOptions.SwimColor;
hatchStyle = HatchArray[swimListColorIndex];
swimListColorIndex++;
swimListColorIndex %= HatchArray.Count;
break;
}
p.Color = colorToUse;
p.BackHatchStyle = hatchStyle;
}
No comments:
Post a Comment