예제 #1
0
        /// <summary>
        /// Здесь отсчеты идут эквидистантно с шагом x_step
        /// </summary>
        /// <param name="inputs">Количество входов</param>
        /// <param name="x_step">шаг по х</param>
        public ChartApplet(GraphBuilder gb, int inputs, double x_step)
            : base(gb)
        {
            m_XStep = x_step;
            Chart = new ChartPanel();
            Chart.Dock = DockStyle.Fill;
            Chart.Location = new Point(0, 0);

            Random rnd_clr = new Random((int)DateTime.Now.Ticks);
            for (int i = 0; i < inputs; i++)
            {
                Chart.Chart.SeriesList.Add(new LineSeries(Chart.Chart, "series" + i.ToString(),
                    Color.FromArgb(rnd_clr.Next(255), rnd_clr.Next(255), rnd_clr.Next(255)), 2.0f));

                int index = i;
                double x = 0.0;
                InPin<double> pin = RegisterInputPin<double>("ChartInput" + i.ToString(), 1, 1);
                pin.OnNewDataEnabled += new NewDataEnabled<double>(
                    delegate(IEnumerable<double> data)
                    {
                        LineSeries ls = (Chart.Chart.SeriesList[index] as LineSeries);
                        foreach (double y in data)
                        {
                            ls.AddPoint(x, y);
                            x += m_XStep;
                        }

                        Chart.Chart.AutoFit();
                    });
            }
        }
예제 #2
0
파일: Chart.cs 프로젝트: sinc/DeviceHandler
        public Chart(ChartPanel chartPanel, string name)
        {
            _chartPanel = chartPanel;
              _title = name;

              _axisList = new List<Axis>();
              _axisList.Add(new Axis(this, "Theta", "Degrees"));
              _axisList.Add(new Axis(this, "R", "%"));

              _margins = new Margins(52, 24, 24, 44);

              _pnFrame = new Pen(Color.Silver, 1.0f);
              _pnGridMain = new Pen(Color.Gray, 1.0f);
              _pnGridAux = new Pen(Color.Gray, 1.0f);
              _pnGridAux.DashStyle = DashStyle.Dash;
              _pnSelection = new Pen(Color.FromKnownColor(KnownColor.HotTrack), 1.0f);
              _pnProgress = new Pen(Color.SpringGreen, 2.0f);

              _brSelection = new SolidBrush(Color.FromArgb(32, Color.FromKnownColor(KnownColor.HotTrack)));

              _fntTickMarks = new Font("Arial", 8.0f);
              _fntLabelsH = new Font("Arial", 8.0f, FontStyle.Bold);
              _fntLabelsV = new Font("Arial", 8.0f, FontStyle.Bold/*, GraphicsUnit.Pixel, Encoding. 0, true*/);

              _seriesList = new List<Series>();

              CreateGradientBrushes();
        }
예제 #3
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.chartView = ((Chart.ChartPanel)(target));
                return;

            case 2:
                this.txt_input = ((System.Windows.Controls.TextBox)(target));
                return;

            case 3:
                this.btn_input = ((System.Windows.Controls.Button)(target));
                return;

            case 4:
                this.btn_reset = ((System.Windows.Controls.Button)(target));
                return;

            case 5:
                this.btn_roundomBeg = ((System.Windows.Controls.Button)(target));
                return;

            case 6:
                this.btn_roundomEnd = ((System.Windows.Controls.Button)(target));
                return;
            }
            this._contentLoaded = true;
        }
예제 #4
0
        public DefectoscopeApplet(GraphBuilder gb, ChartPanel mainPanel, ChartPanel dipolePanel, ListBox dipoleList, Form defectoscopeForm)
            : base(gb)
        {
            m_defectoscopeForm = defectoscopeForm;
            m_mainChartPanel = mainPanel;
            m_dipoleChartPanel = dipolePanel;
            m_mainChartSeriesCh1 = new LineSeries(m_mainChartPanel.Chart, "1", Color.Red, 2.0f);
            m_mainChartSeriesCh2 = new LineSeries(m_mainChartPanel.Chart, "2", Color.Green, 2.0f);
            m_mainChartSeriesCh3 = new LineSeries(m_mainChartPanel.Chart, "3", Color.Blue, 2.0f);

            m_dipoleChartSeriesCh1 = new LineSeries(m_dipoleChartPanel.Chart, "1", Color.Red, 2.0f);
            m_dipoleChartSeriesCh2 = new LineSeries(m_dipoleChartPanel.Chart, "2", Color.Green, 2.0f);
            m_dipoleChartSeriesCh3 = new LineSeries(m_dipoleChartPanel.Chart, "3", Color.Blue, 2.0f);

            m_mainChartPanel.Chart.SeriesList.Add(m_mainChartSeriesCh1);
            m_mainChartPanel.Chart.SeriesList.Add(m_mainChartSeriesCh2);
            m_mainChartPanel.Chart.SeriesList.Add(m_mainChartSeriesCh3);
            m_dipoleChartPanel.Chart.SeriesList.Add(m_dipoleChartSeriesCh1);
            m_dipoleChartPanel.Chart.SeriesList.Add(m_dipoleChartSeriesCh2);
            m_dipoleChartPanel.Chart.SeriesList.Add(m_dipoleChartSeriesCh3);

            InPin<CHDSample> mainIn = RegisterInputPin<CHDSample>(1, kVisiblePoints);
            mainIn.OnNewDataEnabled += new NewDataEnabled<CHDSample>(mainIn_OnNewDataEnabled);

            InPin<CHDSample[]> subIn = RegisterInputPin<CHDSample[]>("SubInPin", 1, 1);
            subIn.OnNewDataEnabled += new NewDataEnabled<CHDSample[]>(subIn_OnNewDataEnabled);

            m_dipoleListBox = dipoleList;
            m_dipoleListBox.SelectedIndexChanged += new EventHandler(dipoleList_SelectedIndexChanged);
        }