Esempio n. 1
0
        /// <summary>
        /// グラフにデータ系列を新規追加
        /// </summary>
        /// <param name="p"></param>
        private void addSeries(Plot plot)
        {
            foreach (Plot Plot in this.DataSeries.Values)
            {
                if (Plot.Series == plot.Series)
                {
                    MessageBox.Show("既にその系列名は使用されています");
                    return;
                }
            }

            Series s = new Series(plot.Series);
            s.ChartType = plot.ChartType;
            s.XValueType = ChartValueType.DateTime;
            s.YAxisType = plot.YAxisType;
            s.MarkerStyle = plot.MarkerStyle;
            s.MarkerSize = plot.MarkerSize;

            if (!this.SerialPorts[plot.comNumber].RxTimeStamp)
            {
                if (MessageBox.Show("受信データから正しくデータをグラフ化するためには," +
                    plot.COM + "の受信タイムタグを有効化する必要があります.\nタイムタグ設定を有効化しますか?", "タイムタグ設定の追加", MessageBoxButtons.YesNo)
                    == DialogResult.Yes)
                {
                    this.SerialPorts[plot.comNumber].RxTimeStamp = true;
                }
            }

            ColumnHeader h = new ColumnHeader();
            h.Name = plot.Series;
            h.Text = plot.Series;

            if (!this.listView1.Columns.Contains(h))
            {
                this.listView1.Columns.Add(h);
            }

            DataGridViewRow row = new DataGridViewRow();
            row.CreateCells(this.dataGridView_Series, true, plot.Series);
            this.dataGridView_Series.Rows.Add(row);

            this.comboBox_deleteList.Items.Add(plot.Series);

            this.chart1.Series.Add(s);
            this.chart1.ResetAutoValues();

            this.DataSeries[plot.Series] = plot;
        }
Esempio n. 2
0
        private void saveDetailSettings()
        {
            foreach (DataGridViewRow row in this.dataGridView1.Rows)
            {
                Plot p = new Plot();
                p.Series = row.Cells["Series"].Value.ToString();
                p.COM = row.Cells["COM"].Value.ToString();
                p.Label = row.Cells["Label"].Value.ToString();
                p.Splitter = row.Cells["Splitter"].Value.ToString();
                p.ChartType = (SeriesChartType)this.Dic[row.Cells["ChartType"].Value];
                try
                {
                    p.a = double.Parse(row.Cells["a"].Value.ToString());
                    p.b = double.Parse(row.Cells["b"].Value.ToString());
                }
                catch
                {
                    MessageBox.Show("a,bに正しい書式の数値を入力してください。","設定適用エラー");
                }
                p.YAxisType = (AxisType)this.Dic[row.Cells["YAXisType"].Value];
                p.MarkerStyle = (MarkerStyle)this.Dic[row.Cells["Marker"].Value];
                p.MarkerSize = int.Parse(row.Cells["MarkerSize"].Value.ToString());
                p.SeriesIndex = ((Plot)(this.DataSeries[p.Series])).SeriesIndex;
                p.DefaultColor = ((Plot)(this.DataSeries[p.Series])).DefaultColor;
                p.comNumber = ((Plot)(this.DataSeries[p.Series])).comNumber;
                p.IsSeriesPlot = ((Plot)(this.DataSeries[p.Series])).IsSeriesPlot;
                this.DataSeries[p.Series] = p;

            }
        }
Esempio n. 3
0
        /// <summary>
        /// グラフにデータ系列を新規追加
        /// </summary>
        /// <param name="Name">系列名</param>
        /// <param name="ComNumber">監視対象COM</param>
        /// <param name="a">表示値→物理値の一次変換係数(y=ax+b)</param>
        /// <param name="b">表示値→物理値の一次変換係数(y=ax+b)</param>
        /// <param name="Label">データ抽出に使用する正規表現</param>
        /// <param name="isSecondaryAxis">y軸に第2軸を使用</param>
        /// <param name="Type">グラフの種類</param>
        private void addSeries(string Name, int ComNumber, double a, double b, string Label, bool isSecondaryAxis, SeriesChartType Type)
        {
            foreach (Plot Plot in this.DataSeries.Values)
            {
                if (Plot.Series == Name)
                {
                    MessageBox.Show("既にその系列名は使用されています");
                    return;
                }
            }
            if (ComNumber < 0 || ComNumber > this.P.MAX_PORT_NUMBER)
            {
                MessageBox.Show("ポート番号の指定が無効です");
                return;
            }

            Plot p = new Plot();
            p.a = a;
            p.b = b;
            p.comNumber = ComNumber;
            p.COM = "COM" + ComNumber.ToString();
            p.Series = Name;
            p.Label = Label;
            p.MarkerStyle = this.dafaultMarkerStyle;
            p.MarkerSize = this.defaultMarkerSize;
            if (isSecondaryAxis)
            {
                p.YAxisType = AxisType.Secondary;
            }
            else
            {
                p.YAxisType = AxisType.Primary;
            }
            p.ChartType = Type;

            addSeries(p);
        }
Esempio n. 4
0
 private void addDataGrid(Plot p)
 {
     int i = this.dataGridView1.Rows.Count;
     this.dataGridView1.Rows.Add();
     this.dataGridView1["Marker", i].Value = Dic[p.MarkerStyle];
     this.dataGridView1["ChartType", i].Value = Dic[p.ChartType];
     this.dataGridView1["YAxisType", i].Value = Dic[p.YAxisType];
     this.dataGridView1["Series", i].Value = p.Series;
     this.dataGridView1["COM", i].Value = p.COM;
     this.dataGridView1["Splitter", i].Value = p.Splitter;
     this.dataGridView1["a", i].Value = p.a.ToString();
     this.dataGridView1["b", i].Value = p.b.ToString();
     this.dataGridView1["Label", i].Value = p.Label;
     this.dataGridView1["MarkerSize", i].Value = p.MarkerSize.ToString();
 }