Exemple #1
0
        public void Draw_Bar()
        {

            StringFormat _SF = new StringFormat()
            {
                LineAlignment = StringAlignment.Center,
                Alignment = StringAlignment.Center
            };

            int Available_height = (H - 80) - (int)G.MeasureString(Title, Font).Height + 10;
            int Grid_Space = Available_height / (((int)(Math.Ceiling(ValueX.Max() / 5.0) * 5) + Interval(ValueX.Max() - ValueX.Min())) / Interval(ValueX.Max() - ValueX.Min()));
            int Y_Start_Point = (int)G.MeasureString(Title, Font).Height + 35 + ((int)G.MeasureString(ValueX.Max().ToString(), Font).Height) / 2;

            Available_height -= (int)G.MeasureString("0", Font).Height / 2;
            Available_height += 2;

            Y_Start_Point += Grid_Space;

            int validW = W - (int)G.MeasureString(ValueX.Max().ToString(), Font).Width - 30;
            int HSpace = (validW / ValueX.Count) - (ValueX.Count * 2);
            int X_Start_Point = 0 + (int)G.MeasureString(ValueX.Max().ToString(), Font).Width + 60;

            double Beta = (Available_height - (double)Grid_Space) / ValueX.Max();
            int preHeight = 0;
            foreach (int item in ValueX)
            {
                int Not_Height_OF_Bar = (Available_height - Grid_Space) - (int)(item * Beta);
                G.FillRectangle(new SolidBrush(Color.FromArgb(91, 155, 213)), new Rectangle(X_Start_Point, Y_Start_Point + Not_Height_OF_Bar, 20, (Available_height - Grid_Space) - Not_Height_OF_Bar - preHeight));
                G.DrawString(item.ToString(), Font, new SolidBrush(ForeColor), new Rectangle(X_Start_Point, H - 25, 20, (int)(G.MeasureString("0", Font).Height)), _SF);
                X_Start_Point += HSpace;
                preHeight = (Available_height - Grid_Space) - Not_Height_OF_Bar;
            }
        }
Exemple #2
0
        public void Draw_Grid()
        {
            StringFormat _SF = new StringFormat()
            {
                LineAlignment = StringAlignment.Far,
                Alignment     = StringAlignment.Far
            };

            int Max       = ValueX.Max();
            int Min       = ValueX.Min();
            int Grid_Step = Interval(Max - Min);
            int MaxPStep  = (int)(Math.Ceiling(Max / 5.0) * 5) + Grid_Step;

            int max_height = (H - 80) - (int)G.MeasureString(Title, Font).Height + 10;
            int space      = max_height / (MaxPStep / Grid_Step);
            int temp_y     = (int)G.MeasureString(Title, Font).Height + 35;

            for (int _ = MaxPStep; _ >= 0; _ -= Grid_Step)
            {
                G.DrawString(_.ToString(), Font, new SolidBrush(ForeColor), new Rectangle(0, temp_y, (int)G.MeasureString(Max.ToString(), Font).Width + 5, (int)G.MeasureString(_.ToString(), Font).Height), _SF);


                G.DrawLine(new Pen(Color.FromArgb(217, 217, 217), 1), (int)G.MeasureString(Max.ToString(), Font).Width + 10, temp_y + ((int)G.MeasureString(_.ToString(), Font).Height) / 2, W - 10, temp_y + ((int)G.MeasureString(_.ToString(), Font).Height) / 2);

                temp_y += space;
            }
        }
Exemple #3
0
        private void ClearValues()
        {
            ValueX.Clear();
            ValueY.Clear();
            ValueZ.Clear();

            AxisX.Text = string.Empty;
            AxisY.Text = string.Empty;
            AxisZ.Text = string.Empty;
        }
Exemple #4
0
        public void Draw_Grid()
        {
            int Y_Start_Point = (int)G.MeasureString(Title, Font).Height + 35;

            for (int _ = (int)(Math.Ceiling(ValueX.Max() / 5.0) * 5) + Interval(ValueX.Max() - ValueX.Min()); _ >= 0; _ -= Interval(ValueX.Max() - ValueX.Min()))
            {
                G.DrawString(_.ToString(), base.Font, new SolidBrush(base.ForeColor), new Rectangle(0, Y_Start_Point, (int)G.MeasureString(ValueX.Max().ToString(), base.Font).Width + 5, (int)G.MeasureString(_.ToString(), base.Font).Height), new StringFormat()
                {
                    LineAlignment = StringAlignment.Far,
                    Alignment     = StringAlignment.Far
                });
                G.DrawLine(new Pen(Color.FromArgb(217, 217, 217), 1), (int)G.MeasureString(ValueX.Max().ToString(), base.Font).Width + 10, Y_Start_Point + ((int)G.MeasureString(_.ToString(), base.Font).Height) / 2, W - 10, Y_Start_Point + ((int)G.MeasureString(_.ToString(), base.Font).Height) / 2);
                Y_Start_Point += ((H - 80) - (int)G.MeasureString(Title, base.Font).Height + 10) / (((int)(Math.Ceiling(ValueX.Max() / 5.0) * 5) + Interval(ValueX.Max() - ValueX.Min())) / Interval(ValueX.Max() - ValueX.Min()));
            }
        }
Exemple #5
0
        public void Draw_Bar()
        {
            StringFormat _SF = new StringFormat()
            {
                LineAlignment = StringAlignment.Center,
                Alignment     = StringAlignment.Center
            };

            //
            int max_height = (H - 80) - (int)G.MeasureString(Title, Font).Height + 10;
            int Max        = ValueX.Max();
            int Min        = ValueX.Min();
            int Grid_Step  = Interval(Max - Min);
            int MaxPStep   = (int)(Math.Ceiling(Max / 5.0) * 5) + Grid_Step;
            int space      = max_height / (MaxPStep / Grid_Step);
            int max_start  = (int)G.MeasureString(Title, Font).Height + 35 + ((int)G.MeasureString(ValueX.Max().ToString(), Font).Height) / 2;

            max_height  = max_height - (int)G.MeasureString("0", Font).Height / 2;
            max_height += 2;
            max_start  += space;

            int validW       = W - (int)G.MeasureString(ValueX.Max().ToString(), Font).Width - 30;
            int HSpace       = (validW / ValueX.Count) - (ValueX.Count * 2);
            int start_x_temp = 0 + (int)G.MeasureString(ValueX.Max().ToString(), Font).Width + 60;

            double beta = ((max_height - (double)space)) / Max;

            int xtempee = 0;
            int ytempee = 0;

            foreach (int item in ValueX)
            {
                int tempoftemp = (max_height - space) - (int)(item * (beta));
                //MessageBox.Show(tempoftemp.ToString());
                System.Drawing.Drawing2D.GraphicsPath c = new System.Drawing.Drawing2D.GraphicsPath();
                if (xtempee != 0)
                {
                    G.DrawLine(new Pen(Color.FromArgb(91, 155, 213), 4), xtempee, ytempee, start_x_temp, max_start + tempoftemp);
                }

                //G.FillPie(new SolidBrush(Color.FromArgb(91, 155, 213)), new Rectangle(start_x_temp, max_start + tempoftemp, 10, 10), 0, 360);
                //G.FillRectangle(new SolidBrush(Color.FromArgb(91, 155, 213)), new Rectangle(start_x_temp, max_start + tempoftemp, 20, (max_height - space) - tempoftemp));
                xtempee = start_x_temp;
                ytempee = max_start + tempoftemp;
                //G.DrawString(item.ToString(), Font, new SolidBrush(ForeColor), new Rectangle(start_x_temp, H - 25, 20, (int)(G.MeasureString("0", Font).Height)), _SF);
                start_x_temp += HSpace;
            }
        }
Exemple #6
0
        private void Pie_Paint(object sender, PaintEventArgs e)
        {
            Draw_Title();
            e.Graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
            e.Graphics.SmoothingMode      = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
            Random rnd        = new Random();
            double temp_start = 0;
            double sums       = ValueX.Sum();

            string[] colorlist = new string[5];
            colorlist[0] = "#FF4472C4";
            colorlist[1] = "#FF5B9BD5";
            colorlist[2] = "#FFED7D31";
            colorlist[3] = "#FFFFC000";
            colorlist[4] = "#FFA5A5A5";
            StringFormat _SF = new StringFormat()
            {
                LineAlignment = StringAlignment.Center,
                Alignment     = StringAlignment.Near
            };
            Font ff = new Font("Calibri", 8, FontStyle.Regular);

            int   n     = 0;
            int   lbi   = 0;
            float xstep = 3 * (Width / 10);
            int   space = Width / LableX.Count;

            foreach (int item in ValueX)
            {
                double val    = ((item / sums) * 360);
                Color  _color = ColorTranslator.FromHtml(colorlist[n]);

                e.Graphics.FillPie(new SolidBrush(_color), new Rectangle(3 * (Width / 10), 2 * (Height / 10), 4 * (Width / 10), 6 * (Height / 10)), (float)temp_start, (float)val);
                e.Graphics.DrawPie(new Pen(Color.White, 2), new Rectangle(3 * (Width / 10), 2 * (Height / 10), 4 * (Width / 10), 6 * (Height / 10)), (float)temp_start, (float)val);
                e.Graphics.DrawString(LableX[lbi], ff,
                                      new SolidBrush(_color),
                                      new Rectangle((int)xstep, 8 * (Height / 10), 4 * (Width / 10), 2 * (Height / 10))
                                      , _SF);
                xstep      += e.Graphics.MeasureString(LableX[lbi], Font).Width;
                temp_start += val; n++; lbi++;
                if (n == 5)
                {
                    n = 0;
                }
            }
        }
Exemple #7
0
        public void Draw_Bar()
        {
            StringFormat _SF = new StringFormat()
            {
                LineAlignment = StringAlignment.Center,
                Alignment     = StringAlignment.Center
            };

            //int Y_Start_Point = (int)G.MeasureString(Title, Font).Height + 35 + NumberHeight / 2;

            //int Available_height = H - 80 - NumberHeight / 2;
            //int Grid_Space = Available_height / (((int)(Math.Ceiling(ValueX.Max() / 5.0) * 5) + Interval(ValueX.Max() - ValueX.Min())) / Interval(ValueX.Max() - ValueX.Min()));
            //double Beta = ((Available_height - Grid_Space)) / ValueX.Max();
            //MessageBox.Show(Height.ToString() + "|" + Available_height.ToString() + "|" + Grid_Space.ToString() + "|" + Beta.ToString());

            //G.FillRectangle(Brushes.Black, 60, Y_Start_Point, 20, Available_height - (int)(ValueX[0] * 3.31));
            //G.FillRectangle(Brushes.Black, 80, Y_Start_Point, 20, Available_height - (int)(ValueX[1] * 3.31));
            //G.FillRectangle(Brushes.Black, 100, Y_Start_Point, 20, Available_height - (int)(ValueX[2] * 3.31));
            //
            int Available_height = (H - 80) - (int)G.MeasureString(Title, Font).Height + 10;
            int Grid_Space       = Available_height / (((int)(Math.Ceiling(ValueX.Max() / 5.0) * 5) + Interval(ValueX.Max() - ValueX.Min())) / Interval(ValueX.Max() - ValueX.Min()));
            int Y_Start_Point    = (int)G.MeasureString(Title, Font).Height + 35 + ((int)G.MeasureString(ValueX.Max().ToString(), Font).Height) / 2;

            Available_height -= (int)G.MeasureString("0", Font).Height / 2;
            Available_height += 2;

            Y_Start_Point += Grid_Space;

            int validW        = W - (int)G.MeasureString(ValueX.Max().ToString(), Font).Width - 30;
            int X_Start_Point = 0 + (int)G.MeasureString(ValueX.Max().ToString(), Font).Width + 60;

            int    HSpace = (validW / ValueX.Count) - (ValueX.Count * 2);
            double Beta   = (Available_height - (double)Grid_Space) / ValueX.Max();

            foreach (int item in ValueX)
            {
                int Not_Height_OF_Bar = (Available_height - Grid_Space) - (int)(item * Beta);
                G.FillRectangle(new SolidBrush(Color.FromArgb(91, 155, 213)), new Rectangle(X_Start_Point, Y_Start_Point + Not_Height_OF_Bar, 20, (Available_height - Grid_Space) - Not_Height_OF_Bar));
                G.DrawString(item.ToString(), Font, new SolidBrush(ForeColor), new Rectangle(X_Start_Point, H - 25, 20, (int)(G.MeasureString("0", Font).Height)), _SF);
                X_Start_Point += HSpace;
            }
        }
Exemple #8
0
        public void Draw_Bar()
        {
            StringFormat _SF = new StringFormat()
            {
                LineAlignment = StringAlignment.Center,
                Alignment     = StringAlignment.Center
            };

            //
            int max_height = (H - 80) - (int)G.MeasureString(Title, Font).Height + 10;
            int Max        = ValueX.Max();
            int Min        = ValueX.Min();
            int Grid_Step  = Interval(Max - Min);
            int MaxPStep   = (int)(Math.Ceiling(Max / 5.0) * 5) + Grid_Step;
            int space      = max_height / (MaxPStep / Grid_Step);
            int max_start  = (int)G.MeasureString(Title, Font).Height + 35 + ((int)G.MeasureString(ValueX.Max().ToString(), Font).Height) / 2;

            max_height  = max_height - (int)G.MeasureString("0", Font).Height / 2;
            max_height += 2;
            max_start  += space;

            int validW       = W - (int)G.MeasureString(ValueX.Max().ToString(), Font).Width - 30;
            int HSpace       = (validW / ValueX.Count) - (ValueX.Count * 2);
            int start_x_temp = 0 + (int)G.MeasureString(ValueX.Max().ToString(), Font).Width + 60;

            int    alpha = max_start / Max;
            double beta  = ((max_height - (double)space)) / Max;

            foreach (int item in ValueX)
            {
                int tempoftemp = (max_height - space) - (int)(item * (beta));
                G.FillPie(new SolidBrush(Color.FromArgb(91, 155, 213)), new Rectangle(start_x_temp, max_start + tempoftemp - (((int)G.MeasureString("0", Font).Height) / 2), 10, 10), 0, 360);
                //G.DrawString(item.ToString(), Font, new SolidBrush(ForeColor), new Rectangle(start_x_temp, H - 25, 20, (int)(G.MeasureString("0", Font).Height)), _SF);
                start_x_temp += HSpace;
            }
        }
Exemple #9
0
 private object CoerceDisplayText(object value)
 {
     return($"({ValueX.ToString("F3")}, {ValueY.ToString("F3")})");
 }
Exemple #10
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);
            }
        }