NI Measurement Studio Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
kvermeer

Fix color selection algorithm in plot generation

Status: New

If you generate multiple plots on a ScatterGraph in WindowsForms using the designer, they are automatically colored.  One of the colors is repeated.  

 

The list is as follows: 

 

1 . Lime
2 . Red
3 . Blue
4 . Cyan
5 . Yellow
6 . Fuchsia
7 . Gray
8 . DarkBlue
9 . Green
10 . Violet
11 . DarkGoldenrod
12 . DarkCyan
13 . DarkMagenta
14 . DarkOrange
15 . DeepPink
16 . DarkViolet
17 . DodgerBlue
18 . Chocolate
19 . MediumAquamarine
20 . SkyBlue
21 . IndianRed
22 . Plum
23 . Silver
24 . Gold
25 . Salmon
26 . Maroon
27 . YellowGreen
28 . IndianRed
29 . Tomato
30 . SteelBlue
31 . Bisque
32 . DarkKhaki

 

This selection has a length of 32 different colors before it begins repeating. It does a fairly good job of choosing colors which can be individually distinguished, except for our two techs who are colorblind...but that's another story, and I don't think there's a way to display 32 plots on one graph in a way that won't at least confuse even non-colorblind people.

 

However, on closer inspection, you'll note than plot 21 and plot 28 are both IndianRed.  These should be separate colors.  Perhaps 28 could be DimGray or LightGray?  There aren't many other options.

 

Here is an image for comparing the colors: 

 

Automatic Plot Color Comparison

 

Each line should be distinguishable. These are not: 

 

IndianRed repeated

 

And here is the code I used to generate it: 

 

int total_colors = 32;
scatterGraph1.Plots.Clear();
for (int i = 0; i <= total_colors - 1; i++) {
	scatterGraph1.Plots.Add(new NationalInstruments.UI.ScatterPlot { LineWidth = 6 });
	scatterGraph1.Plots[i].PlotXY(
        new double[]
        {
		    0,
		    5 + i * 2,
		    5 + total_colors + i * 2,
		    10 + 3 * total_colors
	    },
        new double[]
        {
		    total_colors - i,
		    total_colors - i,
		    -i,
		    -i
	    }
    );
}