示例#1
2
        public void ReturnMaxColorForMaxValue()
        {
            var minVectorStyle = new VectorStyle { Fill = new SolidBrush(Color.Red) };
            var maxVectorStyle = new VectorStyle { Fill = new SolidBrush(Color.Blue) };

            var theme = new GradientTheme("red to blue", 10.0, 100.123, minVectorStyle, maxVectorStyle, null, null, null);

            var color = theme.GetFillColor(100.123);

            AssertColor(Color.Blue, color);
        }
示例#2
0
        public void GenerateThemeWithMaxDoubleAndMinDoubleValue()
        {
            var minVectorStyle = new VectorStyle { Fill = new SolidBrush(Color.Red) };
            var maxVectorStyle = new VectorStyle { Fill = new SolidBrush(Color.Blue) };

            var theme = new GradientTheme("red to blue", double.MinValue, double.MaxValue, minVectorStyle, maxVectorStyle, null, null, null);

            var color = theme.GetFillColor(100);

            AssertColor(Color.FromArgb(255, 127, 0, 127), color);
        }
示例#3
0
        public void GradientThemeScaleToTest()
        {
            var minStyle = new VectorStyle { Fill = new SolidBrush(Color.Red) };
            var maxStyle = new VectorStyle { Fill = new SolidBrush(Color.Blue) };

            var theme = new GradientTheme("NotLinkedToVariable", 0.0, 10.0, minStyle, maxStyle, null, null, null, 3);
            var colorMid = theme.GetFillColor(5.0);

            theme.ScaleTo(-10.0, 30.0);

            Assert.AreEqual(-10.0, theme.Min);
            Assert.AreEqual(30.0, theme.Max);
            Assert.AreEqual(3, theme.NumberOfClasses);
            Assert.AreEqual(3, theme.ThemeItems.Count);
            Assert.IsNull(theme.TextColorBlend);
            Assert.IsNull(theme.LineColorBlend);
            Assert.IsNull(theme.FillColorBlend);

            AssertColor(Color.Red, theme.GetFillColor(-10.0));
            AssertColor(colorMid, theme.GetFillColor(10.0));
            AssertColor(Color.Blue, theme.GetFillColor(30.0));

            theme.ScaleTo(-12.3, -12.3);

            Assert.AreEqual(-12.3, theme.Min);
            Assert.AreEqual(-12.3, theme.Max);
            Assert.AreEqual(3, theme.NumberOfClasses);
            Assert.AreEqual(2, theme.ThemeItems.Count); // Because max == min, only these values are defined and therefore < NumberOfClasses
            Assert.IsNull(theme.TextColorBlend);
            Assert.IsNull(theme.LineColorBlend);
            Assert.IsNull(theme.FillColorBlend);

            AssertColor(Color.Red, theme.GetFillColor(-12.3));
        }