Пример #1
0
        public void InitializeChart()
        {
            // Initialize ChartSeries
            ChartSeries series1 = new ChartSeries("Hard Disk");

            series1.Points.Add(1, 187);
            series1.Points.Add(2, 151);
            series1.Points.Add(3, 180);
            series1.Points.Add(4, 206);
            series1.Points.Add(5, 122);
            series1.Points.Add(6, 31);
            series1.Points.Add(7, 189);
            series1.Points.Add(8, 54);
            series1.Points.Add(9, 181);
            series1.Points.Add(10, 201);
            series1.Points.Add(11, 391);
            series1.Points.Add(12, 311);

            series1.Styles[0].Text = string.Format("{0}", series1.Points[0].YValues[0]);
            series1.Styles[1].Text = string.Format("{0}", series1.Points[1].YValues[0]);
            series1.Styles[2].Text = string.Format("{0}", series1.Points[2].YValues[0]);
            series1.Styles[3].Text = string.Format("{0}", series1.Points[3].YValues[0]);
            series1.Styles[4].Text = string.Format("{0}", series1.Points[4].YValues[0]);


            this.chartControl1.Series.Add(series1);

            ChartSeries series2 = new ChartSeries("Monitor");

            series2.Points.Add(1, 256);
            series2.Points.Add(2, 451);
            series2.Points.Add(3, 382);
            series2.Points.Add(4, 437);
            series2.Points.Add(5, 321);
            series2.Points.Add(6, 234);
            series2.Points.Add(7, 425);
            series2.Points.Add(8, 257);
            series2.Points.Add(9, 382);
            series2.Points.Add(10, 301);
            series2.Points.Add(11, 472);
            series2.Points.Add(12, 421);

            series2.Styles[0].Text = string.Format("{0}", series1.Points[0].YValues[0]);
            series2.Styles[1].Text = string.Format("{0}", series1.Points[1].YValues[0]);
            series2.Styles[2].Text = string.Format("{0}", series1.Points[2].YValues[0]);
            series2.Styles[3].Text = string.Format("{0}", series1.Points[3].YValues[0]);
            series2.Styles[4].Text = string.Format("{0}", series1.Points[4].YValues[0]);


            this.chartControl1.Series.Add(series2);

            chartControl1.ColumnDrawMode         = ChartColumnDrawMode.ClusteredMode;
            chartControl1.PrimaryXAxis.RangeType = ChartAxisRangeType.Set;
            chartControl1.PrimaryXAxis.Range     = new MinMaxInfo(0, 13, 1);
            ChartTemplate ct = new ChartTemplate(typeof(ChartControl));

            ct.Load("Column_Square.xml");
            ct.Apply(this.chartControl1);
            chartControl1.Series3D = false;
        }
Пример #2
0
        private void ChartType_Click(object sender, EventArgs e)
        {
            ButtonAdv chartButton = sender as ButtonAdv;

            this.buttonAdv1.Enabled  = true;
            this.buttonAdv2.Enabled  = true;
            this.buttonAdv3.Enabled  = true;
            this.buttonAdv4.Enabled  = true;
            this.buttonAdv5.Enabled  = true;
            this.buttonAdv6.Enabled  = true;
            this.buttonAdv7.Enabled  = true;
            this.buttonAdv10.Enabled = true;
            string filePath = Application.StartupPath.ToString();

            foreach (ButtonAdv buttonAdv in this.panel3.Controls)
            {
                buttonAdv.State = ButtonAdvState.Default;
                buttonAdv.Refresh();
            }
            if (chartButton == this.buttonAdv1)
            {
                #region Control settings

                this.toolStripStatusLabel1.Text = filePath + "\\Column_Cylinder.xml";
                currentTemplate         = "Column_Cylinder.xml";
                this.buttonAdv1.State   = ButtonAdvState.Pressed;
                this.buttonAdv1.Enabled = false;
                #endregion
            }
            if (chartButton == this.buttonAdv2)
            {
                #region Control settings

                this.toolStripStatusLabel1.Text = filePath + "\\Column_Square.xml";
                this.buttonAdv2.State           = ButtonAdvState.Pressed;
                this.buttonAdv2.Enabled         = false;
                currentTemplate = "Column_Square.xml";
                #endregion
            }
            if (chartButton == this.buttonAdv3)
            {
                #region Control settings

                this.toolStripStatusLabel1.Text = filePath + "\\Area.xml";
                this.buttonAdv3.State           = ButtonAdvState.Pressed;
                this.buttonAdv3.Enabled         = false;
                currentTemplate = "Area.xml";
                #endregion
            }
            if (chartButton == this.buttonAdv4)
            {
                #region Control settings

                this.toolStripStatusLabel1.Text = filePath + "\\Area_3D.xml";
                this.buttonAdv4.State           = ButtonAdvState.Pressed;
                this.buttonAdv4.Enabled         = false;
                currentTemplate = "Area_3D.xml";
                #endregion
            }
            if (chartButton == this.buttonAdv5)
            {
                #region Control settings

                this.toolStripStatusLabel1.Text = filePath + "\\Line.xml";
                this.buttonAdv5.State           = ButtonAdvState.Pressed;
                this.buttonAdv5.Enabled         = false;
                currentTemplate = "Line.xml";
                #endregion
            }
            if (chartButton == this.buttonAdv6)
            {
                #region Control settings

                this.toolStripStatusLabel1.Text = filePath + "\\Line_3D.xml";
                this.buttonAdv6.State           = ButtonAdvState.Pressed;
                this.buttonAdv6.Enabled         = false;
                currentTemplate = "Line_3D.xml";
                #endregion
            }
            if (chartButton == this.buttonAdv7)
            {
                #region Control settings

                this.toolStripStatusLabel1.Text = filePath + "\\Template1.xml";
                this.buttonAdv7.State           = ButtonAdvState.Pressed;
                currentTemplate         = "Template1.xml";
                this.buttonAdv7.Enabled = false;
                #endregion
            }
            if (chartButton == this.buttonAdv10)
            {
                #region Control settings
                this.toolStripStatusLabel1.Text = filePath + "\\Template2.xml";
                this.buttonAdv10.State          = ButtonAdvState.Pressed;
                currentTemplate          = "Template2.xml";
                this.buttonAdv10.Enabled = false;
                #endregion
            }

            ChartTemplate.Load(this.chartControl1, currentTemplate);

            #region Control settings

            this.propertyGrid1.Refresh();
            #endregion
        }
Пример #3
0
 private void button2_Click(object sender, EventArgs e)
 {
     ChartTemplate.Load(this.chartControl2, "Chart.xml");
 }