コード例 #1
0
 public static void DundasChartBase(Chart chart
                                    , ChartImageType chartImageType
                                    , int width
                                    , int height
                                    , BorderSkinStyle borderSkinStyle
                                    , Color borderLineColor
                                    , int borderLineWidth
                                    , Color backColor
                                    , Color backGradientEndColor
                                    , Color borderColor
                                    , ChartDashStyle borderStyle
                                    , int borderWidth
                                    , AntiAliasing antiAliasing
                                    )
 {
     DundasChartBase(chart
                     , chartImageType
                     , width
                     , height
                     , borderSkinStyle, borderLineColor, borderLineWidth
                     , backColor, backGradientEndColor
                     , borderColor, borderStyle, borderWidth
                     , ChartHatchStyle.None
                     , GradientType.None
                     , antiAliasing
                     , null
                     , ChartImageWrapMode.Unscaled
                     , ChartImageAlign.TopRight
                     , Color.Empty);
 }
コード例 #2
0
        private void UpadteChart()
        {
            StripLine stripLine = this.Chart1.ChartAreas["ChartArea1"].AxisX.StripLines[0];

            // Set Strip lines interval
            stripLine.Interval = double.Parse(Interval.SelectedItem.Value);

            // Set Strip Border Line Color
            stripLine.BorderColor = Color.FromName(LineColor.SelectedItem.Value);

            // Set Strip Border Line Style
            stripLine.BorderDashStyle = (ChartDashStyle)ChartDashStyle.Parse(typeof(ChartDashStyle), StripLinesStyle.SelectedItem.Text);

            // Set Strip Border Line Width
            stripLine.BorderWidth = int.Parse(LineWidth.SelectedItem.Value);

            // Set Strip Width
            stripLine.StripWidth = double.Parse(StripWidth.SelectedItem.Value);

            // Set Strip Back Color
            stripLine.BackColor = Color.FromName(StripColor.SelectedItem.Value);

            // Set Strip End Color
            stripLine.BackSecondaryColor = Color.FromName(StripEndColor.SelectedItem.Value);

            // Enable/Disable appearance controls
            LineWidth.Enabled     = (StripLinesStyle.SelectedIndex != 0);
            LineColor.Enabled     = (StripLinesStyle.SelectedIndex != 0);
            StripEndColor.Enabled = (Hatching.SelectedIndex != 0 || Gradient.SelectedIndex != 0);
        }
コード例 #3
0
        //Стиль
        private void ComboBoxStyleMain_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                if (TickorGridMarks.SelectedItem == "GridMarks")
                {
                    Axis_ref.MajorGrid.LineDashStyle = (ChartDashStyle)ChartDashStyle.Parse(typeof(ChartDashStyle), ComboBoxStyleMain.SelectedItem.ToString());
                }
                else
                {
                    Axis_ref.MajorTickMark.LineDashStyle = (ChartDashStyle)ChartDashStyle.Parse(typeof(ChartDashStyle), ComboBoxStyleMain.SelectedItem.ToString());
                }
            }
            catch (Exception)
            { }

            //Если друг под другом арены
            if (chart1_ref.ChartAreas.Count > 1)
            {
                foreach (ChartArea item in chart1_ref.ChartAreas)
                {
                    try
                    {
                        item.AxisX.MajorGrid.LineDashStyle     = (ChartDashStyle)ChartDashStyle.Parse(typeof(ChartDashStyle), ComboBoxStyleMain.SelectedItem.ToString());
                        item.AxisX.MajorTickMark.LineDashStyle = (ChartDashStyle)ChartDashStyle.Parse(typeof(ChartDashStyle), ComboBoxStyleMain.SelectedItem.ToString());
                    }
                    catch (Exception)
                    { }
                }
            }
        }
コード例 #4
0
        private static void AddSeries(
            this Chart chart, List <string> nameLines, List <Color> colors, int borderWidth = 5, bool isClear = false,
            Font font = default, ChartDashStyle chartDashStyle = ChartDashStyle.Solid,
            SeriesChartType chartType = SeriesChartType.Line)
        {
            if (isClear)
            {
                chart.Series.Clear();
            }
            int nextColor = 0;

            foreach (string nameLine in nameLines)
            {
                chart.Series.Add(nameLine);
                chart.Series[nameLine].BorderDashStyle = chartDashStyle;
                chart.Series[nameLine].BorderWidth     = borderWidth;
                chart.Series[nameLine].Color           = colors[nextColor];
                chart.Series[nameLine].Font            = font;
                chart.Series[nameLine].ChartType       = chartType;
                chart.Update();
                if (nextColor == colors.Count)
                {
                    nextColor = 0;
                }
                nextColor++;
            }
        }
コード例 #5
0
        /// <summary>
        /// Draw a line on chart.
        /// </summary>
        /// <param name="sender">Source Chart.</param>
        /// <param name="x0">First point on XAxis.</param>
        /// <param name="x1">Second piont on XAxis.</param>
        /// <param name="y0">First point on YAxis.</param>
        /// <param name="y1">Second point on YAxis.</param>
        /// <param name="lineColor">Outline color.</param>
        /// <param name="name">Annotation name.</param>
        /// <param name="lineWidth">Line width</param>
        /// <param name="lineStyle">Line style</param>
        public static void DrawLine(this Chart sender, double x0, double x1,
                                    double y0, double y1, Drawing.Color lineColor, string name = "",
                                    int lineWidth = 1, ChartDashStyle lineStyle = ChartDashStyle.Solid)
        {
            LineAnnotation line          = new LineAnnotation();
            string         chartAreaName = sender.ChartAreas[0].Name;

            line.ClipToChartArea      = chartAreaName;
            line.AxisXName            = chartAreaName + "\\rX";
            line.YAxisName            = chartAreaName + "\\rY";
            line.IsSizeAlwaysRelative = false;

            line.X             = x0;
            line.Y             = y0;
            line.Height        = y1 - y0;
            line.Width         = x1 - x0;
            line.LineColor     = lineColor;
            line.LineWidth     = lineWidth;
            line.LineDashStyle = lineStyle;
            sender.Annotations.Add(line);

            if (!string.IsNullOrEmpty(name))
            {
                line.Name = name;
            }
        }
コード例 #6
0
        private void plotLine(List <PointD> points, Color col, int width, ChartDashStyle dash, string title)
        {
            if (points == null || points.Count < 1)
            {
                return;
            }

            List <double> xg = new List <double>(), yg = new List <double>();

            foreach (PointD pt in points)
            {
                xg.Add(pt.X);
                yg.Add(pt.Y);
            }

            string sname = "line" + chart1.Series.Count + 1;

            if (title != "")
            {
                sname = title;
            }

            Series sp = chart1.Series.Add(sname);

            sp.ChartType = SeriesChartType.Line;
            sp.Points.DataBindXY(xg, yg);
            sp.Color           = col;
            sp.BorderWidth     = width;
            sp.BorderDashStyle = dash;
        }
コード例 #7
0
 public static void SetChartArea(ChartArea chartArea
                                 , Color backColor
                                 , Color backGradientEndColor
                                 , Color borderColor
                                 , ChartDashStyle borderStyle
                                 , int borderWidth
                                 , ChartHatchStyle chartHatchStyle
                                 , GradientType gradientType
                                 , int shadowOffset
                                 , Color shadowColor
                                 , bool enable3D)
 {
     SetChartArea(chartArea
                  , backColor
                  , backGradientEndColor
                  , borderColor
                  , borderStyle
                  , borderWidth
                  , chartHatchStyle
                  , gradientType
                  , shadowOffset
                  , shadowColor
                  , enable3D
                  , null
                  , ChartImageAlign.TopRight
                  , ChartImageWrapMode.Unscaled
                  , Color.Empty);
 }
コード例 #8
0
ファイル: AxisAppearance.cs プロジェクト: Dev9er/ChartStudy
        private void LineDashStyle_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            Chart1.ChartAreas["Default"].AxisY2.LineDashStyle =
                (ChartDashStyle)ChartDashStyle.Parse(typeof(ChartDashStyle), LineDashStyle.SelectedItem.ToString());

            LineWidth.Enabled = (LineDashStyle.SelectedIndex != 0);
            LineColor.Enabled = (LineDashStyle.SelectedIndex != 0);
        }
コード例 #9
0
ファイル: StripLines.cs プロジェクト: Dev9er/ChartStudy
        private void ControlChanged(object sender, System.EventArgs e)
        {
            if (this.StripEndColor.SelectedIndex >= 0)
            {
                this.Chart1.ChartAreas[0].AxisX.StripLines[0].BackSecondaryColor =
                    Color.FromName(this.StripEndColor.SelectedItem.ToString());
            }

            if (this.StripColor.SelectedIndex >= 0)
            {
                this.Chart1.ChartAreas[0].AxisX.StripLines[0].BackColor =
                    Color.FromName(this.StripColor.SelectedItem.ToString());
            }

            if (this.LineColor.SelectedIndex >= 0)
            {
                this.Chart1.ChartAreas[0].AxisX.StripLines[0].BorderColor =
                    Color.FromName(this.LineColor.SelectedItem.ToString());
            }

            if (this.LineWidth.SelectedIndex >= 0)
            {
                this.Chart1.ChartAreas[0].AxisX.StripLines[0].BorderWidth =
                    int.Parse(this.LineWidth.SelectedItem.ToString());
            }

            if (this.Interval.SelectedIndex >= 0)
            {
                this.Chart1.ChartAreas[0].AxisX.StripLines[0].Interval =
                    int.Parse(this.Interval.SelectedItem.ToString());
            }

            if (this.HatchStyle.SelectedIndex >= 0)
            {
                // Set Hatch Style
                this.Chart1.ChartAreas[0].AxisX.StripLines[0].BackHatchStyle =
                    (ChartHatchStyle)ChartHatchStyle.Parse(typeof(ChartHatchStyle), this.HatchStyle.SelectedItem.ToString());
            }

            if (this.Gradient.SelectedIndex >= 0)
            {
                // Set Gradient Type
                this.Chart1.ChartAreas[0].AxisX.StripLines[0].BackGradientStyle =
                    (GradientStyle)GradientStyle.Parse(typeof(GradientStyle), this.Gradient.SelectedItem.ToString());
            }

            if (this.StripLinesStyle.SelectedIndex >= 0)
            {
                this.Chart1.ChartAreas[0].AxisX.StripLines[0].BorderDashStyle =
                    (ChartDashStyle)ChartDashStyle.Parse(typeof(ChartDashStyle), this.StripLinesStyle.SelectedItem.ToString());
            }

            // Enable/disable attribute	contros
            StripEndColor.Enabled = (Gradient.SelectedIndex != 0 || HatchStyle.SelectedIndex != 0);
            LineColor.Enabled     = (StripLinesStyle.SelectedIndex != 0);
            LineWidth.Enabled     = (StripLinesStyle.SelectedIndex != 0);
        }
コード例 #10
0
        private void SetAnnotationStyle2()
        {
            if (AnnotationStyle2 == null || AnnotationStyle2.SelectedIndex == -1)
            {
                return;
            }

            if (Annotation.SelectedItem.Value == "Line")
            {
                LineAnnotation annotation = (LineAnnotation)Chart1.Annotations[0];

                annotation.EndCap =
                    (LineAnchorCapStyle)LineAnchorCapStyle.Parse(typeof(LineAnchorCapStyle), AnnotationStyle2.SelectedItem.Value);
            }
            else if (Annotation.SelectedItem.Value == "Vertical Line")
            {
                VerticalLineAnnotation annotation = (VerticalLineAnnotation)Chart1.Annotations[0];

                annotation.EndCap =
                    (LineAnchorCapStyle)LineAnchorCapStyle.Parse(typeof(LineAnchorCapStyle), AnnotationStyle2.SelectedItem.Value);
            }
            else if (Annotation.SelectedItem.Value == "Horizontal Line")
            {
                HorizontalLineAnnotation annotation = (HorizontalLineAnnotation)Chart1.Annotations[0];

                annotation.EndCap =
                    (LineAnchorCapStyle)LineAnchorCapStyle.Parse(typeof(LineAnchorCapStyle), AnnotationStyle2.SelectedItem.Value);
            }
            else if (Annotation.SelectedItem.Value == "Polyline")
            {
                PolylineAnnotation annotation = (PolylineAnnotation)Chart1.Annotations[0];

                annotation.EndCap =
                    (LineAnchorCapStyle)LineAnchorCapStyle.Parse(typeof(LineAnchorCapStyle), AnnotationStyle2.SelectedItem.Value);
            }
            else if (Annotation.SelectedItem.Value == "Rectangle")
            {
                RectangleAnnotation annotation = (RectangleAnnotation)Chart1.Annotations[0];

                annotation.LineDashStyle =
                    (ChartDashStyle)ChartDashStyle.Parse(typeof(ChartDashStyle), AnnotationStyle2.SelectedItem.Value);
            }
            else if (Annotation.SelectedItem.Value == "Ellipse")
            {
                EllipseAnnotation annotation = (EllipseAnnotation)Chart1.Annotations[0];

                annotation.LineDashStyle =
                    (ChartDashStyle)ChartDashStyle.Parse(typeof(ChartDashStyle), AnnotationStyle2.SelectedItem.Value);
            }
            else if (Annotation.SelectedItem.Value == "Polygon")
            {
                PolygonAnnotation annotation = (PolygonAnnotation)Chart1.Annotations[0];

                annotation.LineDashStyle =
                    (ChartDashStyle)ChartDashStyle.Parse(typeof(ChartDashStyle), AnnotationStyle2.SelectedItem.Value);
            }
        }
コード例 #11
0
 public GraphVariable()
 {
     LineColor     = Color.Red;
     Min           = 0;
     Max           = 100;
     Name          = "";
     Variable      = "";
     LineThickness = 1;
     LineStyle     = ChartDashStyle.Solid;
     Active        = true;
 }
コード例 #12
0
        protected void Hatching_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            // Set Strip Hatching
            StripLine stripLine = this.Chart1.ChartAreas["ChartArea1"].AxisX.StripLines[0];

            stripLine.BackHatchStyle    = (ChartHatchStyle)ChartDashStyle.Parse(typeof(ChartHatchStyle), Hatching.SelectedItem.Text);
            stripLine.BackGradientStyle = GradientStyle.None;
            Gradient.SelectedIndex      = 0;

            UpadteChart();
        }
コード例 #13
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="chart"></param>
 /// <param name="serie"></param>
 /// <param name="color"></param>
 /// <param name="dashStyle"></param>
 public static void ChartAddSeries(Chart chart, string serie, Color color, ChartDashStyle dashStyle)
 {
     if (chart.Series.IndexOf(serie) == -1)
     {
         chart.Series.Add(serie);
         chart.Series[serie].Color           = color;
         chart.Series[serie].BorderDashStyle = dashStyle;
         chart.Series[serie].BorderWidth     = 2;
         chart.Series[serie].ChartType       = SeriesChartType.Spline;
     }
 }
コード例 #14
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     BorderColor       = ccboBorderColor.SelectedItem;
     BorderDashStyle   = (ChartDashStyle)cboBorderDashStyle.SelectedItem;
     BorderWidth       = (int)nudBorderWidth.Value;
     BackColor         = ccboBackColor.SelectedItem;
     BackSecondColor   = ccboBackSecondColor.SelectedItem;
     BackHatchStyle    = (ChartHatchStyle)cboBackHatchStyle.SelectedItem;
     BackGradientStyle = (GradientStyle)cboBackGradientStyle.SelectedItem;
     this.DialogResult = DialogResult.OK;
 }
コード例 #15
0
 /// <summary>
 /// Изменение типа линии
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void ComBoxLineType_DropDownClosed(object sender, EventArgs e)
 {
     try
     {
         ChartDashStyle Mystyle = (ChartDashStyle)ChartDashStyle.Parse(typeof(ChartDashStyle), ComBoxLineType.Text);
         Seria_ref.BorderDashStyle = Mystyle;
     }
     catch (FormatException)
     {
         MessageBox.Show("Ввод непредвиденного значения");
     }
 }
コード例 #16
0
ファイル: cls_Chart_Drawing.cs プロジェクト: SnyUmd/Ctrl-Dll
 //**************************************************************************************
 /// <summary>
 /// 目盛スタイルをセット
 /// </summary>
 /// <param name="chrt">チャートコントローラ</param>
 /// <param name="i_area_no">エリア番号</param>
 /// <param name="x_color">X軸目盛の色</param>
 /// <param name="y_color">Y軸目盛の色</param>
 /// <param name="x_dash_style">X軸目盛のスタイル</param>
 /// <param name="y_dath_style">Y軸目盛のスタイル</param>
 //**************************************************************************************
 public void mSetGrid(ref Chart chrt,
                      int i_area_no,
                      Color x_color,
                      Color y_color,
                      ChartDashStyle x_dash_style,
                      ChartDashStyle y_dash_style)
 {
     chrt.ChartAreas[i_area_no].AxisX.MajorGrid.LineColor     = x_color;
     chrt.ChartAreas[i_area_no].AxisX.MajorGrid.LineDashStyle = x_dash_style;
     chrt.ChartAreas[i_area_no].AxisY.MajorGrid.LineColor     = y_color;
     chrt.ChartAreas[i_area_no].AxisY.MajorGrid.LineDashStyle = y_dash_style;
 }
コード例 #17
0
        private void AnnotationStyle2_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            if (Annotation.SelectedItem.ToString() == "Line")
            {
                LineAnnotation annotation = (LineAnnotation)Chart1.Annotations[0];

                annotation.EndCap =
                    (LineAnchorCapStyle)LineAnchorCapStyle.Parse(typeof(LineAnchorCapStyle), AnnotationStyle2.SelectedItem.ToString());
            }
            else if (Annotation.SelectedItem.ToString() == "Vertical Line")
            {
                VerticalLineAnnotation annotation = (VerticalLineAnnotation)Chart1.Annotations[0];

                annotation.EndCap =
                    (LineAnchorCapStyle)LineAnchorCapStyle.Parse(typeof(LineAnchorCapStyle), AnnotationStyle2.SelectedItem.ToString());
            }
            else if (Annotation.SelectedItem.ToString() == "Horizontal Line")
            {
                HorizontalLineAnnotation annotation = (HorizontalLineAnnotation)Chart1.Annotations[0];

                annotation.EndCap =
                    (LineAnchorCapStyle)LineAnchorCapStyle.Parse(typeof(LineAnchorCapStyle), AnnotationStyle2.SelectedItem.ToString());
            }
            else if (Annotation.SelectedItem.ToString() == "Polyline")
            {
                PolylineAnnotation annotation = (PolylineAnnotation)Chart1.Annotations[0];

                annotation.EndCap =
                    (LineAnchorCapStyle)LineAnchorCapStyle.Parse(typeof(LineAnchorCapStyle), AnnotationStyle2.SelectedItem.ToString());
            }
            else if (Annotation.SelectedItem.ToString() == "Rectangle")
            {
                RectangleAnnotation annotation = (RectangleAnnotation)Chart1.Annotations[0];

                annotation.LineDashStyle =
                    (ChartDashStyle)ChartDashStyle.Parse(typeof(ChartDashStyle), AnnotationStyle2.SelectedItem.ToString());
            }
            else if (Annotation.SelectedItem.ToString() == "Ellipse")
            {
                EllipseAnnotation annotation = (EllipseAnnotation)Chart1.Annotations[0];

                annotation.LineDashStyle =
                    (ChartDashStyle)ChartDashStyle.Parse(typeof(ChartDashStyle), AnnotationStyle2.SelectedItem.ToString());
            }
            else if (Annotation.SelectedItem.ToString() == "Polygon")
            {
                PolygonAnnotation annotation = (PolygonAnnotation)Chart1.Annotations[0];

                annotation.LineDashStyle =
                    (ChartDashStyle)ChartDashStyle.Parse(typeof(ChartDashStyle), AnnotationStyle2.SelectedItem.ToString());
            }
        }
コード例 #18
0
        private void AppearanceChange(object sender)
        {
            // Set Back Color
            Chart1.ChartAreas["Default"].BackColor = Color.FromName(BackColorCom.GetItemText(BackColorCom.SelectedItem));

            // Set Back Gradient End Color
            Chart1.ChartAreas["Default"].BackSecondaryColor = Color.FromName(ForeColorCom.GetItemText(ForeColorCom.SelectedItem));

            // Set Border Color
            Chart1.ChartAreas["Default"].BorderColor = Color.FromName(BorderColor.GetItemText(BorderColor.SelectedItem));

            // Set Gradient Type
            if (Gradient.SelectedItem != null)
            {
                Chart1.ChartAreas["Default"].BackGradientStyle = (GradientStyle)GradientStyle.Parse(typeof(GradientStyle), Gradient.GetItemText(Gradient.SelectedItem));
            }

            // Set Gradient Type
            if (HatchStyle.SelectedItem != null)
            {
                Chart1.ChartAreas["Default"].BackHatchStyle = (ChartHatchStyle)ChartHatchStyle.Parse(typeof(ChartHatchStyle), HatchStyle.GetItemText(HatchStyle.SelectedItem));
            }

            if (sender == Gradient && Chart1.ChartAreas["Default"].BackGradientStyle != GradientStyle.None)
            {
                HatchStyle.SelectedIndex = 0;
            }

            if (sender == HatchStyle && Chart1.ChartAreas["Default"].BackHatchStyle != ChartHatchStyle.None)
            {
                Gradient.SelectedIndex = 0;
            }


            // Set Border Width
            if (BorderSizeCom.SelectedItem != null)
            {
                Chart1.ChartAreas["Default"].BorderWidth = int.Parse(BorderSizeCom.GetItemText(BorderSizeCom.SelectedItem));
            }

            // Set Border Style
            if (BorderDashStyle.SelectedItem != null)
            {
                Chart1.ChartAreas["Default"].BorderDashStyle = (ChartDashStyle)ChartDashStyle.Parse(typeof(ChartDashStyle), BorderDashStyle.GetItemText(BorderDashStyle.SelectedItem));
            }

            // Set Shadow Offset
            if (ShadowOffset.SelectedItem != null)
            {
                Chart1.ChartAreas["Default"].ShadowOffset = int.Parse(ShadowOffset.GetItemText(ShadowOffset.SelectedItem));
            }
        }
コード例 #19
0
        public WykresWilgotnoscOkno(MySqlConnection myConnection, string queryWilgotnosc, DateTimePicker dateTimePickerWilgot1, DateTimePicker dateTimePickerWilgot2, ComboBox comboBoxWilgotIdCzujnika, ComboBox comboBoxWilgotRodzajWykresu, bool WilgotRazem_osobno,
            DateTimePicker dateTimePickerWilgot3, DateTimePicker dateTimePickerWilgot4, ComboBox comboBoxWilgotIdCzujnika2, ComboBox comboBoxWilgotRodzajWykresu2, bool WilgotRazem_osobno2,
            DateTimePicker dateTimePickerWilgot5, DateTimePicker dateTimePickerWilgot6, ComboBox comboBoxWilgotIdCzujnika3, ComboBox comboBoxWilgotRodzajWykresu3, bool WilgotRazem_osobno3,
            bool wcisnietoButtonWilgot, bool wcisnietoButtonWilgot2, bool wcisnietoButtonWilgot3, int gruboscWilg1, int gruboscWilg2, int gruboscWilg3,
            ChartDashStyle stylWykresuWilg1, ChartDashStyle stylWykresuWilg2, ChartDashStyle stylWykresuWilg3, int[] rgbWilg,
            int interwalWilgX1, int interwalWilgX2, int interwalWilgX3, int interwalWilgY1, int interwalWilgY2, int interwalWilgY3)
        {
            InitializeComponent();
            this.myConnection = myConnection;
            this.queryWilgotnosc = queryWilgotnosc;
            this.dateTimePickerWilgot1 = dateTimePickerWilgot1;
            this.dateTimePickerWilgot2 = dateTimePickerWilgot2;
            this.dateTimePickerWilgot3 = dateTimePickerWilgot3;
            this.dateTimePickerWilgot4 = dateTimePickerWilgot4;
            this.dateTimePickerWilgot5 = dateTimePickerWilgot5;
            this.dateTimePickerWilgot6 = dateTimePickerWilgot6;

            this.comboBoxWilgotIdCzujnika = comboBoxWilgotIdCzujnika;
            this.comboBoxWilgotIdCzujnika2 = comboBoxWilgotIdCzujnika2;
            this.comboBoxWilgotIdCzujnika3 = comboBoxWilgotIdCzujnika3;

            this.comboBoxWilgotRodzajWykresu = comboBoxWilgotRodzajWykresu;
            this.comboBoxWilgotRodzajWykresu2 = comboBoxWilgotRodzajWykresu2;
            this.comboBoxWilgotRodzajWykresu3 = comboBoxWilgotRodzajWykresu3;

            this.WilgotRazem_osobno = WilgotRazem_osobno;
            this.WilgotRazem_osobno2 = WilgotRazem_osobno2;
            this.WilgotRazem_osobno3 = WilgotRazem_osobno3;

            this.wcisnietoButtonWilgot = wcisnietoButtonWilgot;
            this.wcisnietoButtonWilgot2 = wcisnietoButtonWilgot2;
            this.wcisnietoButtonWilgot3 = wcisnietoButtonWilgot3;

            this.gruboscWilg1 = gruboscWilg1;
            this.gruboscWilg2 = gruboscWilg2;
            this.gruboscWilg3 = gruboscWilg3;

            this.stylWykresuWilg1 = stylWykresuWilg1;
            this.stylWykresuWilg2 = stylWykresuWilg2;
            this.stylWykresuWilg3 = stylWykresuWilg3;
            this.rgbWilg = rgbWilg;

            this.interwalWilgX1 = interwalWilgX1;
            this.interwalWilgX2 = interwalWilgX2;
            this.interwalWilgX3 = interwalWilgX3;

            this.interwalWilgY1 = interwalWilgY1;
            this.interwalWilgY2 = interwalWilgY2;
            this.interwalWilgY3 = interwalWilgY3;
        }
コード例 #20
0
        /// <summary>
        /// Initializes a new instance of the FancyControls.Data.Label class.
        /// </summary>
        /// <param name="text">
        /// Sets the text of the data point label.
        /// </param>
        /// <param name="angle">
        /// Sets the angle of the data point label.
        /// </param>
        /// <param name="backColor">
        /// Sets the background color of the data point label.
        /// </param>
        /// <param name="borderColor">
        /// Sets the border color of the data point label.
        /// </param>
        /// <param name="borderDashStyle">
        /// Sets the border style of the label.
        /// </param>
        /// <param name="borderWidth">
        /// Sets the border width of the label.
        /// </param>
        /// <param name="foreColor">
        /// Sets the text color of the label.
        /// </param>
        /// <param name="format">
        /// Sets the format of the data point label.
        /// </param>
        /// <param name="toolTip">
        /// Sets the tooltip for the data point label.
        /// </param>
        public Label(string text, int angle, Color backColor, Color borderColor, ChartDashStyle borderDashStyle, int borderWidth, Color foreColor, string format, string toolTip)
        {
            this.showValue = false;

            this.Text            = text;
            this.Angle           = angle;
            this.BackColor       = backColor;
            this.BorderColor     = borderColor;
            this.BorderDashStyle = borderDashStyle;
            this.BorderWidth     = borderWidth;
            this.ForeColor       = foreColor;
            this.Format          = format;
            this.ToolTip         = toolTip;
        }
コード例 #21
0
        //private void chData_MouseWheel(object sender, MouseEventArgs e)
        //{
        //    try
        //    {
        //        if (e.Delta < 0)
        //        {
        //            chart1.ChartAreas[0].AxisX.ScaleView.ZoomReset();
        //            chart1.ChartAreas[0].AxisY.ScaleView.ZoomReset();
        //        }
        //        if (e.Delta > 0)
        //        {
        //            double xMin = chart1.ChartAreas[0].AxisX.ScaleView.ViewMinimum;
        //            double xMax = chart1.ChartAreas[0].AxisX.ScaleView.ViewMaximum;
        //            double yMin = chart1.ChartAreas[0].AxisY.ScaleView.ViewMinimum;
        //            double yMax = chart1.ChartAreas[0].AxisY.ScaleView.ViewMaximum;
        //            double posXStart = chart1.ChartAreas[0].AxisX.PixelPositionToValue(e.Location.X) + xMin / 2;
        //            double posXFinish = chart1.ChartAreas[0].AxisX.PixelPositionToValue(e.Location.X) + xMax / 2;
        //            double posYStart = chart1.ChartAreas[0].AxisY.PixelPositionToValue(e.Location.Y) + yMin / 2;
        //            double posYFinish = chart1.ChartAreas[0].AxisY.PixelPositionToValue(e.Location.Y) + yMax / 2;
        //            chart1.ChartAreas[0].AxisX.ScaleView.Zoom(posXStart, posXFinish);
        //            chart1.ChartAreas[0].AxisY.ScaleView.Zoom(posYStart, posYFinish);
        //        }
        //    }
        //    catch { }
        //}
        public WykresTemperaturaOkno(MySqlConnection myConnection, string queryTemp, DateTimePicker dateTimePickerTemp1, DateTimePicker dateTimePickerTemp2, ComboBox comboBoxTempIdCzujnika, ComboBox comboBoxTempRodzajWykresu, bool TempRazem_osobno, 
            DateTimePicker dateTimePickerTemp3, DateTimePicker dateTimePickerTemp4, ComboBox comboBoxTempIdCzujnika2, ComboBox comboBoxTempRodzajWykresu2, bool TempRazem_osobno2,
            DateTimePicker dateTimePickerTemp5, DateTimePicker dateTimePickerTemp6, ComboBox comboBoxTempIdCzujnika3, ComboBox comboBoxTempRodzajWykresu3, bool TempRazem_osobno3,
            bool wcisnietoButton, bool wcisnietoButton2, bool wcisnietoButton3, int gruboscTemp1, int gruboscTemp2, int gruboscTemp3,
            ChartDashStyle stylWykresuTemp1, ChartDashStyle stylWykresuTemp2, ChartDashStyle stylWykresuTemp3, int[] rgbTemp,
            int interwalTempX1, int interwalTempX2, int interwalTempX3, int interwalTempY1, int interwalTempY2, int interwalTempY3)
        {
            InitializeComponent();
            this.myConnection = myConnection;
            this.queryTemp = queryTemp;
            this.dateTimePickerTemp1 = dateTimePickerTemp1;
            this.dateTimePickerTemp2 = dateTimePickerTemp2;
            this.dateTimePickerTemp3 = dateTimePickerTemp3;
            this.dateTimePickerTemp4 = dateTimePickerTemp4;
            this.dateTimePickerTemp5 = dateTimePickerTemp5;
            this.dateTimePickerTemp6 = dateTimePickerTemp6;

            this.comboBoxTempIdCzujnika = comboBoxTempIdCzujnika;
            this.comboBoxTempIdCzujnika2 = comboBoxTempIdCzujnika2;
            this.comboBoxTempIdCzujnika3 = comboBoxTempIdCzujnika3;

            this.comboBoxTempRodzajWykresu = comboBoxTempRodzajWykresu;
            this.comboBoxTempRodzajWykresu2 = comboBoxTempRodzajWykresu2;
            this.comboBoxTempRodzajWykresu3 = comboBoxTempRodzajWykresu3;

            this.TempRazem_osobno = TempRazem_osobno;
            this.TempRazem_osobno2 = TempRazem_osobno2;
            this.TempRazem_osobno3 = TempRazem_osobno3;

            this.wcisnietoButtonTemp = wcisnietoButton;
            this.wcisnietoButtonTemp2 = wcisnietoButton2;
            this.wcisnietoButtonTemp3 = wcisnietoButton3;
            this.gruboscTemp1 = gruboscTemp1;
            this.gruboscTemp2 = gruboscTemp2;
            this.gruboscTemp3 = gruboscTemp3;

            this.stylWykresuTemp1 = stylWykresuTemp1;
            this.stylWykresuTemp2 = stylWykresuTemp2;
            this.stylWykresuTemp3 = stylWykresuTemp3;
            this.rgbTemp = rgbTemp;

            this.interwalTempX1 = interwalTempX1;
            this.interwalTempX2 = interwalTempX2;
            this.interwalTempX3 = interwalTempX3;

            this.interwalTempY1 = interwalTempY1;
            this.interwalTempY2 = interwalTempY2;
            this.interwalTempY3 = interwalTempY3;
        }
コード例 #22
0
 public static Legend CreateLegend(Chart chart, string legendName
                                   , Color backColor, Color backGradientEndColor, Color borderColor
                                   , Font font
                                   , GradientType gradientType, ChartHatchStyle chartHatchStyle
                                   , int borderWidth, ChartDashStyle boaderStyle
                                   , bool positionAuto, float positionX, float positionY, float positionWidth, float positionHeight)
 {
     return(CreateLegend(chart, legendName
                         , backColor, backGradientEndColor, borderColor
                         , font
                         , gradientType, chartHatchStyle
                         , borderWidth, boaderStyle
                         , -1, Color.Empty
                         , positionAuto, positionX, positionX, positionWidth, positionHeight));
 }
コード例 #23
0
        /// <summary>
        /// Add line on axis.
        /// </summary>
        /// <param name="position">
        /// Position of the line.
        /// </param>
        /// <param name="width">
        /// Width of the line.
        /// </param>
        /// <param name="color">
        /// Color of the line.
        /// </param>
        /// <param name="style">
        /// Style of line.
        /// </param>
        /// <param name="text">
        /// Text of line.
        /// </param>
        /// <param name="textAlignment">
        /// Text alignment of line.
        /// </param>
        /// <param name="textOrientation">
        /// Text orientation of line.
        /// </param>
        public void AddLine(double position, int width, Color color, ChartDashStyle style = ChartDashStyle.Solid, string text = "", StringAlignment textAlignment = StringAlignment.Center, TextOrientation textOrientation = TextOrientation.Auto)
        {
            axis.StripLines.Add(new StripLine()
            {
                Interval        = 0,
                IntervalOffset  = position,
                BorderWidth     = width,
                BorderColor     = color,
                BorderDashStyle = style,

                Text            = text,
                TextAlignment   = textAlignment,
                TextOrientation = textOrientation,
            });
        }
コード例 #24
0
        public void UpdateColor()
        {
            if (!ApplyToPoint.Checked)
            {
                // Set Series["Default"] visual attributes
                Chart1.Series["Default"].Color = Color.FromName(ColorList.SelectedItem.Text);
                Chart1.Series["Default"].BackSecondaryColor = Color.FromName(EndColorList.SelectedItem.Text);
                Chart1.Series["Default"].BorderColor        = Color.FromName(BorderColorList.SelectedItem.Text);
                Chart1.Series["Default"].BackGradientStyle  = (GradientStyle)GradientStyle.Parse(typeof(GradientStyle), GradientList.SelectedItem.Text);
                Chart1.Series["Default"].BackHatchStyle     = (ChartHatchStyle)ChartHatchStyle.Parse(typeof(ChartHatchStyle), HatchingList.SelectedItem.Text);
                Chart1.Series["Default"].BorderWidth        = int.Parse(BorderSizeList.SelectedItem.Text);
                Chart1.Series["Default"].BorderDashStyle    = (ChartDashStyle)ChartDashStyle.Parse(typeof(ChartDashStyle), BorderDashStyleList.SelectedItem.Text);
                Chart1.Series["Default"].ShadowOffset       = int.Parse(ShadowOffsetList.SelectedItem.Text);

                // Disable fore color control if gradient or hatching are not used
                if (HatchingList.SelectedItem.Text == "None" && GradientList.SelectedItem.Text == "None")
                {
                    EndColorList.Enabled = false;
                }
                else
                {
                    EndColorList.Enabled = true;
                }
            }
            else
            {
                // Set Series["Default"] visual attributes
                Chart1.Series["Default"].Points[2].Color = Color.FromName(ColorList.SelectedItem.Text);
                Chart1.Series["Default"].Points[2].BackSecondaryColor = Color.FromName(EndColorList.SelectedItem.Text);
                Chart1.Series["Default"].Points[2].BorderColor        = Color.FromName(BorderColorList.SelectedItem.Text);
                Chart1.Series["Default"].Points[2].BackGradientStyle  = (GradientStyle)GradientStyle.Parse(typeof(GradientStyle), GradientList.SelectedItem.Text);
                Chart1.Series["Default"].Points[2].BackHatchStyle     = (ChartHatchStyle)ChartHatchStyle.Parse(typeof(ChartHatchStyle), HatchingList.SelectedItem.Text);
                Chart1.Series["Default"].Points[2].BorderWidth        = int.Parse(BorderSizeList.SelectedItem.Text);
                Chart1.Series["Default"].Points[2].BorderDashStyle    = (ChartDashStyle)ChartDashStyle.Parse(typeof(ChartDashStyle), BorderDashStyleList.SelectedItem.Text);
                Chart1.Series["Default"].ShadowOffset = int.Parse(ShadowOffsetList.SelectedItem.Text);

                // Disable fore color control if gradient or hatching are not used
                if (HatchingList.SelectedItem.Text == "None" && GradientList.SelectedItem.Text == "None")
                {
                    EndColorList.Enabled = false;
                }
                else
                {
                    EndColorList.Enabled = true;
                }
            }
        }
コード例 #25
0
        public WykresCisnieniaOkno(MySqlConnection myConnection, string queryCis, DateTimePicker dateTimePickerCis1, DateTimePicker dateTimePickerCis2, ComboBox comboBoxCisIdCzujnika, ComboBox comboBoxCisRodzajWykresu, bool CisRazem_osobno,
            DateTimePicker dateTimePickerCis3, DateTimePicker dateTimePickerCis4, ComboBox comboBoxCisIdCzujnika2, ComboBox comboBoxCisRodzajWykresu2, bool CisRazem_osobno2,
            DateTimePicker dateTimePickerCis5, DateTimePicker dateTimePickerCis6, ComboBox comboBoxCisIdCzujnika3, ComboBox comboBoxCisRodzajWykresu3, bool CisRazem_osobno3,
            bool wcisnietoButtonCis, bool wcisnietoButtonCis2, bool wcisnietoButtonCis3, int gruboscCis1, int gruboscCis2, int gruboscCis3,
            ChartDashStyle stylWykresuCis1, ChartDashStyle stylWykresuCis2, ChartDashStyle stylWykresuCis3, int[] rgbCis,
            int interwalCisX1, int interwalCisX2, int interwalCisX3, int interwalCisY1, int interwalCisY2, int interwalCisY3)
        {
            InitializeComponent();
            this.myConnection = myConnection;
            this.queryCisnienie = queryCis;
            this.dateTimePickerCis1 = dateTimePickerCis1;
            this.dateTimePickerCis2 = dateTimePickerCis2;
            this.dateTimePickerCis3 = dateTimePickerCis3;
            this.dateTimePickerCis4 = dateTimePickerCis4;
            this.dateTimePickerCis5 = dateTimePickerCis5;
            this.dateTimePickerCis6 = dateTimePickerCis6;

            this.comboBoxCisIdCzujnika = comboBoxCisIdCzujnika;
            this.comboBoxCisIdCzujnika2 = comboBoxCisIdCzujnika2;
            this.comboBoxCisIdCzujnika3 = comboBoxCisIdCzujnika3;

            this.comboBoxCisRodzajWykresu = comboBoxCisRodzajWykresu;
            this.comboBoxCisRodzajWykresu2 = comboBoxCisRodzajWykresu2;
            this.comboBoxCisRodzajWykresu3 = comboBoxCisRodzajWykresu3;

            this.CisRazem_osobno = CisRazem_osobno;
            this.CisRazem_osobno2 = CisRazem_osobno2;
            this.CisRazem_osobno3 = CisRazem_osobno3;

            this.wcisnietoButtonCis = wcisnietoButtonCis;
            this.wcisnietoButtonCis2 = wcisnietoButtonCis2;
            this.wcisnietoButtonCis3 = wcisnietoButtonCis3;
            this.gruboscCis1 = gruboscCis1;
            this.gruboscCis2 = gruboscCis2;
            this.gruboscCis3 = gruboscCis3;

            this.stylWykresuCis1 = stylWykresuCis1;
            this.stylWykresuCis2 = stylWykresuCis2;
            this.stylWykresuCis3 = stylWykresuCis3;
            this.rgbCis = rgbCis;
            this.interwalCisX1 = interwalCisX1;
            this.interwalCisX2 = interwalCisX2;
            this.interwalCisX3 = interwalCisX3;
            this.interwalCisY1 = interwalCisY1;
            this.interwalCisY2 = interwalCisY2;
            this.interwalCisY3 = interwalCisY3;
        }
コード例 #26
0
        private void YControl_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            System.Windows.Forms.DataVisualization.Charting.Cursor cursor = Chart1.ChartAreas["Default"].CursorY;

            if (YLineSize.SelectedIndex >= 0)
            {
                cursor.LineWidth = int.Parse(YLineSize.SelectedItem.ToString());
            }
            if (YLineDashStyle.SelectedIndex >= 0)
            {
                cursor.LineDashStyle = (ChartDashStyle)ChartDashStyle.Parse(typeof(ChartDashStyle), YLineDashStyle.SelectedItem.ToString());
            }
            if (YLineColor.SelectedIndex >= 0)
            {
                cursor.LineColor = Color.FromName(YLineColor.SelectedItem.ToString());
            }
        }
コード例 #27
0
        private static ChartDashStyle NextStyle(ChartDashStyle ds)
        {
            switch (ds)
            {
            case ChartDashStyle.Solid: return(ChartDashStyle.Dash);

            case ChartDashStyle.Dash: return(ChartDashStyle.Dot);

            case ChartDashStyle.Dot: return(ChartDashStyle.DashDot);

            case ChartDashStyle.DashDot: return(ChartDashStyle.DashDotDot);

            case ChartDashStyle.DashDotDot: return(ChartDashStyle.Solid);

            default: return(ChartDashStyle.Solid);
            }
        }
コード例 #28
0
        public void SetAttributes(DataPointAttributes attrib, bool area3D)
        {
            this.borderColor            = attrib.BorderColor;
            this.borderWidth            = attrib.BorderWidth;
            this.borderStyle            = attrib.BorderStyle;
            this.markerStyle            = attrib.MarkerStyle;
            this.markerSize             = attrib.MarkerSize;
            this.markerImage            = attrib.MarkerImage;
            this.markerImageTranspColor = attrib.MarkerImageTransparentColor;
            this.markerColor            = attrib.MarkerColor;
            this.markerBorderColor      = attrib.MarkerBorderColor;
            this.markerBorderWidth      = attrib.MarkerBorderWidth;
            float num = 96f;

            if (this.common != null)
            {
                num = this.common.graph.Graphics.DpiX;
            }
            int num2 = (int)Math.Round(2.0 * num / 96.0);

            if (this.markerBorderWidth > num2)
            {
                this.markerBorderWidth = num2;
            }
            if (attrib.MarkerBorderWidth <= 0)
            {
                this.markerBorderColor = Color.Transparent;
            }
            if (this.style == LegendImageStyle.Line && this.borderWidth <= (int)Math.Round(num / 96.0))
            {
                this.borderWidth = num2;
            }
            if (!area3D)
            {
                this.backGradientType     = attrib.BackGradientType;
                this.backGradientEndColor = attrib.BackGradientEndColor;
                this.backImageTranspColor = attrib.BackImageTransparentColor;
                this.backImage            = attrib.BackImage;
                this.backImageMode        = attrib.BackImageMode;
                this.backImageAlign       = attrib.BackImageAlign;
                this.backHatchStyle       = attrib.BackHatchStyle;
            }
        }
コード例 #29
0
        internal void SetAttributes(DataPointAttributes attrib, bool area3D)
        {
            borderColor            = attrib.BorderColor;
            borderWidth            = attrib.BorderWidth;
            borderStyle            = attrib.BorderStyle;
            markerStyle            = attrib.MarkerStyle;
            markerSize             = attrib.MarkerSize;
            markerImage            = attrib.MarkerImage;
            markerImageTranspColor = attrib.MarkerImageTransparentColor;
            markerColor            = attrib.MarkerColor;
            markerBorderColor      = attrib.MarkerBorderColor;
            markerBorderWidth      = attrib.MarkerBorderWidth;
            float num = 96f;

            if (common != null)
            {
                num = common.graph.Graphics.DpiX;
            }
            int num2 = (int)Math.Round(2f * num / 96f);

            if (markerBorderWidth > num2)
            {
                markerBorderWidth = num2;
            }
            if (attrib.MarkerBorderWidth <= 0)
            {
                markerBorderColor = Color.Transparent;
            }
            if (style == LegendImageStyle.Line && borderWidth <= (int)Math.Round(num / 96f))
            {
                borderWidth = num2;
            }
            if (!area3D)
            {
                backGradientType     = attrib.BackGradientType;
                backGradientEndColor = attrib.BackGradientEndColor;
                backImageTranspColor = attrib.BackImageTransparentColor;
                backImage            = attrib.BackImage;
                backImageMode        = attrib.BackImageMode;
                backImageAlign       = attrib.BackImageAlign;
                backHatchStyle       = attrib.BackHatchStyle;
            }
        }
コード例 #30
0
        private void SetAnnotationStyle()
        {
            if (AnnotationStyle == null || AnnotationStyle.SelectedIndex == -1)
            {
                return;
            }

            if (Annotation.SelectedItem.Value.ToLower().IndexOf("line") >= 0)
            {
                Chart1.Annotations[0].LineDashStyle =
                    (ChartDashStyle)ChartDashStyle.Parse(typeof(ChartDashStyle), AnnotationStyle.SelectedItem.Value);
            }

            else if (Annotation.SelectedItem.Value == "Text" ||
                     Annotation.SelectedItem.Value == "Rectangle" ||
                     Annotation.SelectedItem.Value == "Ellipse")
            {
                Chart1.Annotations[0].TextStyle =
                    (TextStyle)TextStyle.Parse(typeof(TextStyle), AnnotationStyle.SelectedItem.Value);
            }
            else if (Annotation.SelectedItem.Value == "Arrow")
            {
                ((ArrowAnnotation)Chart1.Annotations[0]).ArrowStyle =
                    (ArrowStyle)ArrowStyle.Parse(typeof(ArrowStyle), AnnotationStyle.SelectedItem.Value);
            }
            else if (Annotation.SelectedItem.Value == "Border3D")
            {
                ((Border3DAnnotation)Chart1.Annotations[0]).BorderSkin.SkinStyle =
                    (BorderSkinStyle)BorderSkinStyle.Parse(typeof(BorderSkinStyle), AnnotationStyle.SelectedItem.Value);
            }
            else if (Annotation.SelectedItem.Value == "Callout")
            {
                ((CalloutAnnotation)Chart1.Annotations[0]).CalloutStyle =
                    (CalloutStyle)CalloutStyle.Parse(typeof(CalloutStyle), AnnotationStyle.SelectedItem.Value);
            }
            else if (Annotation.SelectedItem.Value == "Polygon")
            {
                PolygonAnnotation annotation = (PolygonAnnotation)Chart1.Annotations[0];

                annotation.BackColor = Color.FromArgb(128, Color.FromName(AnnotationStyle.SelectedItem.Value));
            }
        }
コード例 #31
0
        private void SelectPoint(DataPoint point)
        {
            if (this._selectedPoint != null)
            {
                this._selectedPoint.BorderWidth     = this._oldWidth;
                this._selectedPoint.BorderDashStyle = this._oldDashStyle;
                this._selectedPoint.BorderColor     = this._oldColor;
            }

            this._selectedPoint = point;

            if (this._selectedPoint != null)
            {
                this._oldWidth     = this._selectedPoint.BorderWidth;
                this._oldDashStyle = this._selectedPoint.BorderDashStyle;
                this._oldColor     = this._selectedPoint.BorderColor;
                this._selectedPoint.BorderWidth     = 5;
                this._selectedPoint.BorderColor     = Color.Red;
                this._selectedPoint.BorderDashStyle = ChartDashStyle.Dash;
            }
        }
コード例 #32
0
        private void SelectSeries(Series series)
        {
            if (this._selectedSeries != null)
            {
                this._selectedSeries.BorderWidth     = this._oldWidth;
                this._selectedSeries.BorderDashStyle = this._oldDashStyle;
                this._selectedSeries.BorderColor     = this._oldColor;
            }

            this._selectedSeries = series;

            if (this._selectedSeries != null)
            {
                this._oldWidth     = this._selectedSeries.BorderWidth;
                this._oldDashStyle = this._selectedSeries.BorderDashStyle;
                this._oldColor     = this._selectedSeries.BorderColor;
                this._selectedSeries.BorderWidth     = 5;
                this._selectedSeries.BorderColor     = Color.Red;
                this._selectedSeries.BorderDashStyle = ChartDashStyle.Dash;
            }
        }
コード例 #33
0
        public void Read(XElement ele)
        {
            foreach (XAttribute att in ele.Attributes())
            {
                switch (att.Name.LocalName)
                {
                case "Active":
                    Active = bool.Parse(att.Value);
                    break;

                case "Variable":
                    Variable = att.Value;
                    break;

                case "Name":
                    Name = att.Value;
                    break;

                case "Min":
                    Min = decimal.Parse(att.Value);
                    break;

                case "Max":
                    Max = decimal.Parse(att.Value);
                    break;

                case "LineColor":
                    LineColor = Color.FromArgb(int.Parse(att.Value));
                    break;

                case "LineThickness":
                    LineThickness = int.Parse(att.Value);
                    break;

                case "LineStyle":
                    LineStyle = (ChartDashStyle)int.Parse(att.Value);
                    break;
                }
            }
        }
コード例 #34
0
        /// <summary>
        /// Draw a vertical line on chart.
        /// </summary>
        /// <param name="sender">Source Chart.</param>
        /// <param name="x">XAxis value.</param>
        /// <param name="lineColor">Line color.</param>
        /// <param name="name">Annotation name.</param>
        /// <param name="lineWidth">Line width</param>
        /// <param name="lineStyle">Line style</param>
        public static void DrawVerticalLine(this Chart sender, double x,
            Drawing.Color lineColor, string name = "",
            int lineWidth = 1, ChartDashStyle lineStyle = ChartDashStyle.Solid)
        {
            VerticalLineAnnotation vertLine = new VerticalLineAnnotation();
            string chartAreaName = sender.ChartAreas[0].Name;
            vertLine.ClipToChartArea = chartAreaName;
            vertLine.AxisXName = chartAreaName + "\\rX";
            vertLine.YAxisName = chartAreaName + "\\rY";
            vertLine.IsInfinitive = true;
            vertLine.IsSizeAlwaysRelative = false;

            vertLine.X = x;
            vertLine.LineColor = lineColor;
            vertLine.LineWidth = lineWidth;
            vertLine.LineDashStyle = lineStyle;
            sender.Annotations.Add(vertLine);

            if (!string.IsNullOrEmpty(name)) vertLine.Name = name;
        }
コード例 #35
0
        /// <summary>
        /// Draw a rectangle on chart.
        /// </summary>
        /// <param name="sender">Source Chart.</param>
        /// <param name="x">XAxis value</param>
        /// <param name="y">YAxis value</param>
        /// <param name="width">rectangle width using XAis value.</param>
        /// <param name="height">rectangle height using YAis value.</param>
        /// <param name="lineColor">Outline color.</param>
        /// <param name="name">Annotation name.</param>
        /// <param name="lineWidth">Line width</param>
        /// <param name="lineStyle">Line style</param>
        public static void DrawRectangle(this Chart sender, double x, double y,
            double width, double height,
            Drawing.Color lineColor, string name = "",
            int lineWidth = 1, ChartDashStyle lineStyle = ChartDashStyle.Solid)
        {
            RectangleAnnotation rect = new RectangleAnnotation();
            string chartAreaName = sender.ChartAreas[0].Name;
            rect.ClipToChartArea = chartAreaName;
            rect.AxisXName = chartAreaName + "\\rX";
            rect.YAxisName = chartAreaName + "\\rY";
            rect.BackColor = Drawing.Color.Transparent;
            rect.ForeColor = Drawing.Color.Transparent;
            rect.IsSizeAlwaysRelative = false;

            rect.LineColor = lineColor;
            rect.LineWidth = lineWidth;
            rect.LineDashStyle = lineStyle;

            //Limit rectangle within chart area
            Axis ptrAxis = sender.ChartAreas[0].AxisX;
            if (x < ptrAxis.Minimum)
            {
                width = width - (ptrAxis.Minimum - x);
                x = ptrAxis.Minimum;
            }
            else if (x > ptrAxis.Maximum)
            {
                width = width - (x - ptrAxis.Maximum);
                x = ptrAxis.Maximum;
            }
            if ((x + width) > ptrAxis.Maximum) width = ptrAxis.Maximum - x;

            ptrAxis = sender.ChartAreas[0].AxisY;
            if (y < ptrAxis.Minimum)
            {
                height = height - (ptrAxis.Minimum - y);
                y = ptrAxis.Minimum;
            }
            else if (y > ptrAxis.Maximum)
            {
                height = height - (y - ptrAxis.Maximum);
                y = ptrAxis.Maximum;
            }
            if ((y + height) > ptrAxis.Maximum) height = ptrAxis.Maximum - y;

            rect.X = x;
            rect.Y = y;
            rect.Width = width;
            rect.Height = height;
            rect.LineColor = lineColor;
            sender.Annotations.Add(rect);

            if (!string.IsNullOrEmpty(name)) rect.Name = name;
        }
コード例 #36
0
        /// <summary>
        /// Draw a line on chart.
        /// </summary>
        /// <param name="sender">Source Chart.</param>
        /// <param name="x0">First point on XAxis.</param>
        /// <param name="x1">Second piont on XAxis.</param>
        /// <param name="y0">First point on YAxis.</param>
        /// <param name="y1">Second point on YAxis.</param>
        /// <param name="lineColor">Outline color.</param>
        /// <param name="name">Annotation name.</param>
        /// <param name="lineWidth">Line width</param>
        /// <param name="lineStyle">Line style</param>
        public static void DrawLine(this Chart sender, double x0, double x1,
            double y0, double y1, Drawing.Color lineColor, string name = "",
            int lineWidth = 1, ChartDashStyle lineStyle = ChartDashStyle.Solid)
        {
            LineAnnotation line = new LineAnnotation();
            string chartAreaName = sender.ChartAreas[0].Name;
            line.ClipToChartArea = chartAreaName;
            line.AxisXName = chartAreaName + "\\rX";
            line.YAxisName = chartAreaName + "\\rY";
            line.IsSizeAlwaysRelative = false;

            line.X = x0;
            line.Y = y0;
            line.Height = y1 - y0;
            line.Width = x1 - x0;
            line.LineColor = lineColor;
            line.LineWidth = lineWidth;
            line.LineDashStyle = lineStyle;
            sender.Annotations.Add(line);

            if (!string.IsNullOrEmpty(name)) line.Name = name;
        }
コード例 #37
0
ファイル: Glowna.cs プロジェクト: zrozumiec/MySQL
        /*________________________________________________________________________

                       Funkcja ustawiająca typ wykresu
        ________________________________________________________________________*/
        private void ustawStylWykresu(Chart chart, string seriesName, ChartDashStyle stylWykresu)
        {
            stylWykresuTemp = stylWykresu;
            chart.Series[seriesName].BorderDashStyle = stylWykresu;
        }
コード例 #38
0
        /// <summary>
        /// Draw a horizontal line on chart.
        /// </summary>
        /// <param name="sender">Source Chart.</param>
        /// <param name="y">YAxis value.</param>
        /// <param name="lineColor">Line color.</param>
        /// <param name="name">Annotation name.</param>
        /// <param name="lineWidth">Line width</param>
        /// <param name="lineStyle">Line style</param>
        /// <param name="chartArea">Target ChartArea where annotation should be displayed. Default to first ChartArea if not defined.</param>
        public static Annotation DrawHorizontalLine(this Chart sender, double y,
            Drawing.Color lineColor, string name = "",
            int lineWidth = 1, ChartDashStyle lineStyle = ChartDashStyle.Solid, ChartArea chartArea = null)
        {
            HorizontalLineAnnotation horzLine = null;
            if (!string.IsNullOrEmpty(name)) horzLine = sender.Annotations.FindByName(name) as HorizontalLineAnnotation;

            if (horzLine == null)
            {
                horzLine = new HorizontalLineAnnotation();
                sender.Annotations.Add(horzLine);
                if (!string.IsNullOrEmpty(name)) horzLine.Name = name;
            }

            string chartAreaName = (chartArea == null) ? sender.ChartAreas[0].Name : chartArea.Name;
            horzLine.ClipToChartArea = chartAreaName;
            horzLine.AxisXName = chartAreaName + "\\rX";
            horzLine.YAxisName = chartAreaName + "\\rY";
            horzLine.IsInfinitive = true;
            horzLine.IsSizeAlwaysRelative = false;

            horzLine.Y = y;
            horzLine.LineColor = lineColor;
            horzLine.LineWidth = lineWidth;
            horzLine.LineDashStyle = lineStyle;

            return horzLine;
        }
コード例 #39
0
		private void SelectPoint(DataPoint point)
		{
			if (this._selectedPoint != null)
			{
				this._selectedPoint.BorderWidth     = this._oldWidth;
				this._selectedPoint.BorderDashStyle = this._oldDashStyle;
				this._selectedPoint.BorderColor     = this._oldColor;
			}

			this._selectedPoint = point;

			if (this._selectedPoint != null)
			{
				this._oldWidth                      = this._selectedPoint.BorderWidth;
				this._oldDashStyle                  = this._selectedPoint.BorderDashStyle;
				this._oldColor                      = this._selectedPoint.BorderColor;
				this._selectedPoint.BorderWidth     = 5;
				this._selectedPoint.BorderColor     = Color.Red;
				this._selectedPoint.BorderDashStyle = ChartDashStyle.Dash;
			}
		}
コード例 #40
0
		private void SelectSeries(Series series)
		{
			if (this._selectedSeries != null)
			{
				this._selectedSeries.BorderWidth     = this._oldWidth;
				this._selectedSeries.BorderDashStyle = this._oldDashStyle;
				this._selectedSeries.BorderColor     = this._oldColor;
			}

			this._selectedSeries = series;

			if (this._selectedSeries != null)
			{
				this._oldWidth                       = this._selectedSeries.BorderWidth;
				this._oldDashStyle                   = this._selectedSeries.BorderDashStyle;
				this._oldColor                       = this._selectedSeries.BorderColor;
				this._selectedSeries.BorderWidth     = 5;
				this._selectedSeries.BorderColor     = Color.Red;
				this._selectedSeries.BorderDashStyle = ChartDashStyle.Dash;
			}
		}
コード例 #41
0
ファイル: RysujWykres.cs プロジェクト: zrozumiec/MySQL
        public void draw(MySqlConnection connection, string query, string seriesName, string ChartAreaName, 
            DateTimePicker date1, DateTimePicker date2, ComboBox comboBoxIdCzujnika, ComboBox rodzaj, Chart chart,
            int[] rgb, int index, bool razem_osobno, int grubosc, ChartDashStyle styl, int interwalX, int interwalY)
        {
            Glowna gl = new Glowna();

            if (razem_osobno == true)   //sprawdza parametr który określa czy rysujemy wykres razem i innymi czy osobno, jeżeli razem
            {
                try
                {
                    chart.Series.Remove(chart.Series[seriesName]);  //wyczyść wykres
                    chart.ChartAreas.Remove(chart.ChartAreas["ChartArea1"]);    //wyczyść pole wykresu
                }
                catch { }

                try
                {
                    Series series = new Series();   //utwórz nowy obiekt typu wyrkes
                    ChartArea chartArea1 = new ChartArea(); //utwórz nowy obiekt typu przestrzeń dla wykresu
                    if (chart.ChartAreas.IsUniqueName("ChartArea1"))    //sprawdz czy taka przestrzeń już istnieje
                    {
                        chartArea1.Name = "ChartArea1"; //nazwa przestrzeni
                        chart.ChartAreas.Add(chartArea1);   //dodaj przestrzeń

                        //ustawienia właściwości przestrzeni
                        chartArea1.AxisY.IntervalAutoMode = IntervalAutoMode.VariableCount;
                        chartArea1.AxisX.IntervalAutoMode = IntervalAutoMode.VariableCount;
                        chartArea1.AxisX.Interval = 100;
                        chartArea1.AxisY.Interval = 2;
                        chartArea1.AxisX.LabelStyle.Interval = 100;
                        chartArea1.AxisY.LabelStyle.Interval = 2;
                        chartArea1.AxisX.LabelStyle.IntervalOffset = 0D;
                        chartArea1.AxisX.LabelStyle.IntervalOffsetType = DateTimeIntervalType.Auto;
                        chartArea1.AxisX.LabelStyle.IntervalType = DateTimeIntervalType.Auto;
                        chartArea1.AxisY.IsStartedFromZero = false;
                        chartArea1.AxisX.IsStartedFromZero = false;
                    }

                    if (chart.Series.IsUniqueName(series.Name)) //sprawdz czy taki wykres istnieje
                    {
                        series.Name = seriesName;   //pobier nazwę wykresu z parametrów
                        chart.Series.Add(series);   //dodaj wykres
                        chart.Series[series.Name].Color = System.Drawing.Color.FromArgb(rgb[index]);    //ustaw kolor
                        chart.Series[seriesName].BorderWidth = grubosc; //ustaw grubość
                        chart.Series[seriesName].BorderDashStyle = styl;    //ustaw styl
                        gl.ustawTypyWykresu(chart, rodzaj, series.Name);    //ustaw typ wykresu
                    }

                    chart.Series[series.Name].Points.Clear();   //wyczyść wszystkie punkty wykresu

                    connection.Open();  //otwórz połaczenie
                    MySqlCommand cmd = new MySqlCommand(query, connection); //utworzrenie komendy, zapytanie SQL pobierane jest z parametrów
                    cmd.Parameters.AddWithValue("@data_od", date1.Value.ToString("yyyy:MM:dd HH:mm:ss"));   //ustawienie zakresu daty od
                    cmd.Parameters.AddWithValue("@data_do", date2.Value.ToString("yyyy:MM:dd HH:mm:ss"));   //ustawienie zakresu daty do
                    cmd.Parameters.AddWithValue("@id_czujnika", comboBoxIdCzujnika.Text.NullString());    //ustawienie dla którego czujnika
                    rdr = cmd.ExecuteReader();  //wykonaj

                    //zczytuj dane i rysuj wykres
                    while (rdr.Read())
                    {
                        chart.Series[series.Name].Points.AddXY(rdr.GetDateTime("data").ToString("yyyy-MM-dd HH:mm:ss"), rdr.GetInt32("wartosc"));
                    }
                    connection.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error");
                }
                finally
                {
                    if (rdr != null)
                    {
                        rdr.Close();
                    }
                    connection.Close();
                }
            }
            else if(razem_osobno == false)  //jeżeli osobno
            {
                try
                {
                    chart.Series.Remove(chart.Series[seriesName]);  //usuń wykres
                    chart.ChartAreas.Remove(chart.ChartAreas[ChartAreaName]);   //wyczyść pole wykresu
                }
                catch { }
                try
                {
                    Series series = new Series();   //utwórz nowy obiekt typu wyrkes
                    ChartArea chartArea = new ChartArea();  //utwórz nowy obiekt typu przestrzeń dla wykresu
                    if (chart.ChartAreas.IsUniqueName(ChartAreaName))   //sprawdz czy taka przestrzen
                    {
                        chartArea.Name = ChartAreaName; //nazwa przestrzeni
                        chart.ChartAreas.Add(chartArea);    //dodaj przestrzeń
                        series.ChartArea = chartArea.Name;  //przypisz wykres do przestrzeni

                        //ustawienia właściwości przestrzeni
                        chartArea.AxisX.Interval = interwalX;
                        chartArea.AxisY.Interval = interwalY;
                        chartArea.AxisX.IntervalAutoMode = IntervalAutoMode.VariableCount;
                        chartArea.AxisY.IntervalAutoMode = IntervalAutoMode.VariableCount;
                        chartArea.AxisX.LabelStyle.Interval = interwalX;
                        chartArea.AxisY.LabelStyle.Interval = interwalY;
                        chartArea.AxisX.LabelStyle.IntervalOffset = 0D;
                        chartArea.AxisX.LabelStyle.IntervalOffsetType = DateTimeIntervalType.Auto;
                        chartArea.AxisX.LabelStyle.IntervalType = DateTimeIntervalType.Auto;
                        chartArea.AxisY.IsStartedFromZero = false;
                        chartArea.AxisX.IsStartedFromZero = false;
                    }

                    if (chart.Series.IsUniqueName(series.Name)) //sprawdz czy taki wykres istnieje
                    {
                        series.Name = seriesName;   //pobier nazwę wykresu z parametrów
                        chart.Series.Add(series);   //dodaj wykres
                        chart.Series[series.Name].Color = System.Drawing.Color.FromArgb(rgb[index]);    //ustaw kolor
                        chart.Series[seriesName].BorderWidth = grubosc; //ustaw grubosc
                        chart.Series[seriesName].BorderDashStyle = styl;    //ustaw styl
                        gl.ustawTypyWykresu(chart, rodzaj, series.Name);    //ustaw typ
                    }

                    chart.Series[series.Name].Points.Clear();   //czyść punkty
                    chart.Series[seriesName].IsXValueIndexed = true;    //zaczyna rysowanie wykresu od pierwszej daty nie od 0
                    connection.Open();  //otwórz połaczenie
                    MySqlCommand cmd = new MySqlCommand(query, connection); //utworzrenie komendy, zapytanie SQL pobierane jest z parametrów
                    cmd.Parameters.AddWithValue("@data_od", date1.Value.ToString("yyyy:MM:dd HH:mm:ss"));   //ustawienie zakresu daty od
                    cmd.Parameters.AddWithValue("@data_do", date2.Value.ToString("yyyy:MM:dd HH:mm:ss"));   //ustawienie zakresu daty do
                    cmd.Parameters.AddWithValue("@id_czujnika", comboBoxIdCzujnika.Text.NullString());
                    rdr = cmd.ExecuteReader();  //wykonaj

                    //odczytuj dane i rysuj wykres
                    while (rdr.Read())
                    {
                        chart.Series[series.Name].Points.AddXY(rdr.GetDateTime("data").ToString("yyyy-MM-dd HH:mm:ss"), rdr.GetInt32("wartosc"));
                    }

                    connection.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error");
                }
                finally
                {
                    if (rdr != null)
                    {
                        rdr.Close();
                    }
                    connection.Close();
                }
            }
        }