示例#1
0
        static void Main(string[] args)
        {
            //The first method that you will need to create is to calculate the y value of a line,
            //given by the slope(m), the x value (x) and the y intercept (b).
            //Your method should be named LineValueForY with a return type of double.
            //Y.  Your method should accept 3 parameters, all of type double.
            //The first parameter will be the slope of the line (name this parameter m),
            //the second parameter should be the x value (name this parameter x)
            //and the last parameter should be the y intercept (name this parameter b).
            //The formula to calculate the Y value is Y = mx + b

            double m = 0, x = 0, b = 0, y = 0;

            ValueY calc = new ValueY();

            Console.Write("Enter the slope (m): ");
            m = Convert.ToDouble(Console.ReadLine());
            Console.Write("Enter the X Value (x): ");
            x = Convert.ToDouble(Console.ReadLine());
            Console.Write("Enter the Y Intercept (b): ");
            b = Convert.ToDouble(Console.ReadLine());

            y = calc.value(m, x, b);

            Console.WriteLine($"Y Value: {y}");
            Console.ReadKey();
        }
示例#2
0
        private void ClearValues()
        {
            ValueX.Clear();
            ValueY.Clear();
            ValueZ.Clear();

            AxisX.Text = string.Empty;
            AxisY.Text = string.Empty;
            AxisZ.Text = string.Empty;
        }
        static public void SetChart(Chart chart, int percentage, Color overcolor, Color belowcolor)
        {
            chart.ChartAreas["ChartArea1"].Area3DStyle.Enable3D    = true;
            chart.ChartAreas["ChartArea1"].Area3DStyle.LightStyle  = LightStyle.None;
            chart.ChartAreas["ChartArea1"].Area3DStyle.Inclination = 0;
            chart.ChartAreas["ChartArea1"].Area3DStyle.Perspective = 10;
            chart.ChartAreas["ChartArea1"].BackColor              = Color.FromArgb(255, 255, 255);
            chart.ChartAreas["ChartArea1"].AxisX.Enabled          = AxisEnabled.False;
            chart.ChartAreas["ChartArea1"].AxisY.Enabled          = AxisEnabled.False;
            chart.ChartAreas["ChartArea1"].Area3DStyle.WallWidth  = 0;
            chart.ChartAreas["ChartArea1"].Area3DStyle.PointDepth = 1000;

            Series serbelow = new Series("below");

            serbelow.IsVisibleInLegend = false;
            serbelow.ChartType         = SeriesChartType.Area;
            serbelow.BorderWidth       = 0;
            serbelow.ShadowOffset      = 3;
            serbelow.Color             = belowcolor;

            Series serover = new Series("over");

            serover.IsVisibleInLegend = false;
            serover.ChartType         = SeriesChartType.Area;
            serover.BorderWidth       = 0;
            serover.ShadowOffset      = 3;
            serover.Color             = overcolor;

            int stepCount = 100;

            float sdRange    = (float)2.58 * 2;
            float step       = sdRange / stepCount;
            float startPoint = (float)-2.58;

            for (int i = 0; i < stepCount; i++)
            {
                float x = startPoint + i * step;
                if (i < percentage)
                {
                    serover.Points.AddXY(x, (float)ValueY.GetValue(0, 1, x));
                }
                else
                {
                    serbelow.Points.AddXY(x, (float)ValueY.GetValue(0, 1, x));
                }
            }

            chart.Series.Clear();
            chart.Series.Add(serbelow);
            chart.Series.Add(serover);
        }
示例#4
0
 private object CoerceDisplayText(object value)
 {
     return($"({ValueX.ToString("F3")}, {ValueY.ToString("F3")})");
 }
示例#5
0
        /// <summary>
        /// 속성들을 Xml Attribute로 생성합니다.
        /// </summary>
        /// <param name="writer">Attribute를 쓸 Writer</param>
        public override void GenerateXmlAttributes(System.Xml.XmlWriter writer)
        {
            base.GenerateXmlAttributes(writer);

            if (Id.IsNotWhiteSpace())
            {
                writer.WriteAttributeString("Id", Id);
            }
            if (Value.HasValue)
            {
                writer.WriteAttributeString("Value", Value.ToString());
            }

            if (ShowValue.HasValue)
            {
                writer.WriteAttributeString("ShowValue", ShowValue.GetHashCode().ToString());
            }
            if (ValueX.HasValue)
            {
                writer.WriteAttributeString("ValueX", ValueX.ToString());
            }
            if (ValueY.HasValue)
            {
                writer.WriteAttributeString("ValueY", ValueY.ToString());
            }
            if (EditMode.HasValue)
            {
                writer.WriteAttributeString("EditMode", EditMode.GetHashCode().ToString());
            }

            if (_border != null)
            {
                _border.GenerateXmlAttributes(writer);
            }

            if (BgColor.IsNotWhiteSpace())
            {
                writer.WriteAttributeString("BgColor", BgColor);
            }
            if (Radius.HasValue)
            {
                writer.WriteAttributeString("Radius", Radius.ToString());
            }
            if (BaseWidth.HasValue)
            {
                writer.WriteAttributeString("BaseWidth", BaseWidth.ToString());
            }
            if (TopWidth.HasValue)
            {
                writer.WriteAttributeString("TopWidth", TopWidth.ToString());
            }
            if (RearExtension.HasValue)
            {
                writer.WriteAttributeString("RearExtension", RearExtension.ToString());
            }
            if (ToolText.IsNotWhiteSpace())
            {
                writer.WriteAttributeString("ToolText", ToolText);
            }

            if (_link != null)
            {
                _link.GenerateXmlAttributes(writer);
            }
        }