Beispiel #1
0
        private static ITheme CreateCategorialTheme(Legend legend, Ranges <int> ranges)
        {
            int numberOfClasses = ranges.ranges.Count; //legend.ranges.Count;

            Color[]            colors       = new Color[numberOfClasses];
            float[]            positions    = new float[numberOfClasses];
            List <IComparable> values       = new List <IComparable>();
            string             attribute    = legend.columnName;
            VectorStyle        defaultStyle = null;
            List <string>      categories   = new List <string>();

            int i = 0;

            foreach (Range <int> range in ranges.ranges)
            {
                categories.Add(range.description);
                colors[i]    = range.color;
                positions[i] = ((float)i) / (numberOfClasses - 1);
                values.Add(range.intMaxValue);
                i++;
            }
            ColorBlend      blend = new ColorBlend(colors, positions);
            CategorialTheme theme = ThemeFactory.CreateCategorialTheme(attribute, defaultStyle, blend, numberOfClasses,
                                                                       values, categories);

            return(theme);
        }