コード例 #1
0
 public OtherDataGraphWindow(SelectXYDataWindow sw)
     : base()
 {
     chart.Series.Clear();
     AddGraph(sw);
     EnableAddGraph = true;
 }
コード例 #2
0
        public override void addGraphToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SelectXYDataWindow sw = new SelectXYDataWindow();

            if (sw.ShowDialog() == DialogResult.OK)
            {
                AddGraph(sw);
            }
        }
コード例 #3
0
        private void bt_rdf_Click(object sender, EventArgs e)
        {
            //BTdat.datの検索
            if (File.Exists("feffdat/BTdat.dat") == false)
            {
                MessageBox.Show("BTdat.dat is not found");
                return;
            }
            SelectXYDataWindow sw = new SelectXYDataWindow();

            if (sw.SetXY_Manual("R", "g(R)"))
            {
                OtherDataGraphWindow ow = new OtherDataGraphWindow(sw);
                ow.Show();
            }
        }
コード例 #4
0
        private void bt_others_Click(object sender, EventArgs e)
        {
            //BTdat.datの検索
            if (File.Exists("feffdat/BTdat.dat") == false)
            {
                MessageBox.Show("BTdat.dat is not found");
                return;
            }
            SelectXYDataWindow sw = new SelectXYDataWindow();

            if (sw.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (sw.Xindex == -1 || sw.Yindex == -1)
                {
                    MessageBox.Show("select x,y value");
                    return;
                }
                OtherDataGraphWindow ow = new OtherDataGraphWindow(sw);
                ow.Show();
            }
        }
コード例 #5
0
        private void AddGraph(SelectXYDataWindow sw)
        {
            bool         readstart = false;
            CustomSeries srs       = new CustomSeries();

            srs.ChartArea = "ChartArea1";
            srs.ChartType = SeriesChartType.Line;
            srs.Name      = sw.ParamName;
            srs.XName     = sw.ParamXName;
            chart.Series.Add(srs);

            if (sw.Errorindex >= 0)
            {
                CustomSeries errsrs = new CustomSeries();
                errsrs.ChartArea = "ChartArea1";
                errsrs.ChartType = SeriesChartType.ErrorBar;
                errsrs.Error     = true;
                errsrs.Name      = sw.ParamErrName;
                errsrs.XName     = sw.ParamXName;
                errsrs.Parent    = sw.ParamName;
                chart.Series.Add(errsrs);
            }
            foreach (string line in File.ReadLines("feffdat/BTdat.dat", BTMainForm.CharEncode))
            {
                //選択した行を探す
                if (sw.Line == 0)
                {
                    if (!readstart && line.IndexOf("Eexp_0") >= 0)
                    {
                        readstart = true;
                        continue;
                    }
                }
                if (sw.Line == 1)
                {
                    if (!readstart && line.IndexOf("Eexp_1") >= 0)
                    {
                        readstart = true;
                        continue;
                    }
                }
                if (sw.Line == 2)
                {
                    if (!readstart && line.IndexOf("f(R)_SS") >= 0)
                    {
                        readstart = true;
                        continue;
                    }
                }
                if (sw.Line == 3)
                {
                    if (!readstart && line.IndexOf("kbg") >= 0)
                    {
                        readstart = true;
                        continue;
                    }
                }

                if (readstart)
                {
                    string[] d = line.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
                    //読み込み終わり
                    if (d.Count() < 5)
                    {
                        break;
                    }
                    //それぞれ読み込む
                    double x = double.Parse(d[sw.Xindex]);
                    double y = double.Parse(d[sw.Yindex]);
                    if (sw.Errorindex >= 0)
                    {
                        double err = double.Parse(d[sw.Errorindex]);
                        chart.Series[chart.Series.Count - 2].Points.Add(new DataPoint(x, y));                                    //グラフにデータ追加
                        chart.Series[chart.Series.Count - 1].Points.Add(new DataPoint(x, new double[] { y, y - err, y + err })); //グラフにデータ追加
                        chart.Series[chart.Series.Count - 1].Points.Last()["ErrorBarCenterMarkerStyle"] = "Circle";
                        chart.Series[chart.Series.Count - 1].Points.Last()["ErrorBarSeries"]            = "Exp";
                    }
                    else
                    {
                        chart.Series[chart.Series.Count - 1].Points.Add(new DataPoint(x, y));   //グラフにデータ追加
                    }
                }
            }
        }