Exemplo n.º 1
0
        public void ResetChart(TireDataColumn column)
        {
            MainChart.ChartAreas[0].AxisX.Title = column.ToString();
            MainChart.ChartAreas[0].AxisY.Title = "データ数(個)";
            Series Data     = new Series();
            Series Selected = new Series();

            Data.LegendText     = "Data";
            Selected.LegendText = "選択";



            Data.ChartType         = SeriesChartType.Column;
            Selected.ChartType     = SeriesChartType.RangeColumn;
            Selected["PointWidth"] = "1";
            Data["PointWidth"]     = "0.6";

            Data.Color     = Color.Green;
            Selected.Color = Color.Red;

            MainChart.Series.Clear();
            MainChart.Series.Add(Data);
            MainChart.Series.Add(Selected);
            CalcBin_ShowGraph(column);
        }
Exemplo n.º 2
0
        private void TB_Enter(object sender, EventArgs e)
        {
            SelectedColumn = TireDataColumn.TSTC;
            if (sender == SATB)
            {
                SelectedColumn = TireDataColumn.SA;
            }
            if (sender == SRTB)
            {
                SelectedColumn = TireDataColumn.SR;
            }
            if (sender == FZTB)
            {
                SelectedColumn = TireDataColumn.FZ;
            }
            if (sender == IATB)
            {
                SelectedColumn = TireDataColumn.IA;
            }
            if (sender == PTB)
            {
                SelectedColumn = TireDataColumn.P;
            }

            ValidateCount();

            ResetChart(SelectedColumn);
        }
Exemplo n.º 3
0
        public double this[TireDataColumn c]
        {
            set
            {
                int i = (int)c;
                if (i < 0 || i >= _data.Count())
                {
                    throw new IndexOutOfRangeException();
                }
                this._data[i] = value;
            }
            get
            {
                if (c == TireDataColumn.NT)
                {
                    return(MZ / FY * 1000);
                }
                int i = (int)c;
                if (i < 0 || i > _data.Count())
                {
                    throw new IndexOutOfRangeException();
                }

                return(this._data[i]);
            }
        }
Exemplo n.º 4
0
 public TireDataConstrain(string name, TireDataColumn column, double max, double min, bool not = false)
 {
     Name   = name;
     Max    = max;
     Min    = min;
     Not    = not;
     Column = column;
 }
Exemplo n.º 5
0
        private void CalcBin_ShowGraph(TireDataColumn column)
        {
            TireDataSet tds = Editor.SelectedDataSet;

            if (SourceCB.SelectedItem as ProjectTree.Node_TireDataSet != null)
            {
                var ntds = SourceCB.SelectedItem as ProjectTree.Node_TireDataSet;
                tds = ntds.GetIDataSet().GetDataSet();
            }

            var table = (TableCB.SelectedItem as Table?).Value;

            Target = new List <double>();
            foreach (var data in tds.GetDataList(table))
            {
                Target.Add(data[column]);
            }
            Target.Sort();
            MainChart.Series[SeriesData].Points.Clear();
            if (Target.Count == 0)
            {
                return;
            }


            var    max = tds.MaxminSet.Limit(table).Max[column];
            var    min = tds.MaxminSet.Limit(table).Min[column];
            var    bin = CalculateMinimumEntropyBin(Target, TireData.Resolution()[column], max, min);
            double dif = (max - min) / bin.Count;



            for (int i = 0; i < bin.Count; ++i)
            {
                var data = new DataPoint(i * dif + dif / 2 + min, bin[i]);
                MainChart.Series[SeriesData].Points.Add(data);
            }

            //選択

            SortedBin = new List <Tuple <int, double> >(bin.Count);
            for (int i = 0; i < bin.Count; ++i)
            {
                SortedBin.Add(new Tuple <int, double>(i, bin[i]));
            }
            SortedBin.Sort(delegate(Tuple <int, double> ls, Tuple <int, double> rh)
            {
                if (ls.Item2 == rh.Item2)
                {
                    return(0);
                }
                return(ls.Item2 - rh.Item2 > 0 ? -1 : 1);
            }
                           );

            Bin = bin;
            SelectBin(column);
        }
Exemplo n.º 6
0
        public void Initialize(double ma, double mi, TireDataColumn column)
        {
            Column         = column;
            max            = ma;
            min            = mi;
            ConstrainedMax = max;
            ConstrainedMin = min;

            labelMax.Text       = max.ToString();
            labelMin.Text       = min.ToString();
            MaxTrackBar.Maximum = (int)max * 1000;
            MaxTrackBar.Minimum = (int)min * 1000;
            MinTrackBar.Maximum = (int)max * 1000;
            MinTrackBar.Minimum = (int)min * 1000;
        }
Exemplo n.º 7
0
        public void AddNewConstrain(TireDataColumn column, TreeNode ParentNode)
        {
            var dialog = new MaxMinDialog(column, Table, Selector);

            dialog.ShowDialog();
            if (dialog.DialogResult == DialogResult.OK)
            {
                AddConstrainToNode(column, ParentNode, dialog.Constrain);
                Selector.AddConstrain(dialog.Constrain, Table);
                Selector.ExtractData();
                if (SelectedAreaChanged != null)
                {
                    SelectedAreaChanged(Selector);
                }
                property.Changed();
            }
        }
Exemplo n.º 8
0
        public MaxMinDialog(TireDataColumn column, Table table, TireDataSetSelector selector, TireDataConstrain constrain = null)
        {
            InitializeComponent();
            Origin = constrain;

            Column   = column;
            Table    = table;
            Selector = selector;

            Target = new List <double>();
            foreach (var data in selector.Target(table))
            {
                Target.Add(data[column]);
            }
            Target.Sort();

            MainChart.ChartAreas[0].AxisX.Title = Column.ToString();
            MainChart.ChartAreas[0].AxisY.Title = "データ数(個)";
            Series exSeries           = new Series();
            Series nexSeries          = new Series();
            Series SelectedAreaSeries = new Series();

            exSeries.LegendText           = "抽出データ";
            nexSeries.LegendText          = "削除データ";
            SelectedAreaSeries.LegendText = "選択範囲";



            exSeries.ChartType           = SeriesChartType.StackedColumn;
            nexSeries.ChartType          = SeriesChartType.StackedColumn;
            SelectedAreaSeries.ChartType = SeriesChartType.Area;

            exSeries.Color           = Color.Green;
            nexSeries.Color          = Color.Red;
            SelectedAreaSeries.Color = Color.LightBlue;

            MainChart.Series.Clear();
            MainChart.Series.Add(SelectedAreaSeries);
            MainChart.Series.Add(exSeries);
            MainChart.Series.Add(nexSeries);
        }
Exemplo n.º 9
0
        void SelectBin(TireDataColumn column)
        {
            TireDataSet tds   = Editor.SelectedDataSet;
            var         table = (TableCB.SelectedItem as Table?).Value;

            if (SourceCB.SelectedItem as ProjectTree.Node_TireDataSet != null)
            {
                var ntds = SourceCB.SelectedItem as ProjectTree.Node_TireDataSet;
                tds = ntds.GetIDataSet().GetDataSet();
            }
            if (tds.GetDataList(table).Count == 0)
            {
                return;
            }

            ValidateCount();
            int i = SortedBin[selected[column]].Item1;


            var    max  = tds.MaxminSet.Limit(table).Max[column];
            var    min  = tds.MaxminSet.Limit(table).Min[column];
            double dif  = (max - min) / Bin.Count;
            var    data = new DataPoint(i * dif + dif / 2 + min, Bin[i]);

            MainChart.Series[SeriesSelected].Points.Clear();
            MainChart.Series[SeriesSelected].Points.Add(data);
            for (int j = 0; j < Bin.Count; ++j)
            {
                if (j == i)
                {
                    continue;
                }
                data = new DataPoint(j * dif + dif / 2 + min, 0);
                MainChart.Series[SeriesSelected].Points.Add(data);
            }
        }
Exemplo n.º 10
0
 public void SetAxis(TireDataColumn x, TireDataColumn y)
 {
     Viewers[ViewerNumber].SetAxis(x, y);
     //RefreshViewer();
 }
Exemplo n.º 11
0
 public void SetAxis(TireDataColumn x, TireDataColumn y, int number)
 {
     Viewers[number].SetAxis(x, y);
     //RefreshViewer();
 }
Exemplo n.º 12
0
 public double MeanValue(TireDataColumn column)
 {
     return(Mean[column]);
 }
Exemplo n.º 13
0
 public double MaxValue(TireDataColumn column)
 {
     return(Max[column]);
 }
Exemplo n.º 14
0
        void AddConstrainToNode(TireDataColumn column, TreeNode ParentNode, TireDataConstrain constrain)
        {
            var node = new TreeNode(constrain.Name);

            ParentNode.Nodes.Add(node);
            node.ContextMenuStrip = new ContextMenuStrip();
            EventHandler handler = delegate(object sender, EventArgs e)
            {
                var d = new MaxMinDialog(column, Table, Selector, constrain);
                d.ShowDialog();
                if (d.DialogResult == DialogResult.OK)
                {
                    constrain.CopyFrom(d.Constrain);
                    Selector.ExtractData();
                    Selector.ConfirmStateChanged(Table);
                    node.Text = constrain.Name;
                    if (SelectedAreaChanged != null)
                    {
                        SelectedAreaChanged(Selector);
                    }
                    property.Changed();
                }
            };

            node.TreeView.NodeMouseDoubleClick += delegate(object sender, TreeNodeMouseClickEventArgs e)
            {
                if (e.Node == node)
                {
                    handler(sender, e);
                }
            };
            node.TreeView.AfterLabelEdit += delegate(object sender, NodeLabelEditEventArgs e)
            {
                e.CancelEdit = true;
                if (e.Node == node && e.Label != null && e.Label != "")
                {
                    constrain.Name = e.Label;
                    node.Text      = e.Label;
                    Selector.ConfirmStateChanged(Table);


                    property.Changed();
                }
            };


            node.ContextMenuStrip.Items.Add(
                new ToolStripMenuItem(
                    "名前の変更",
                    null,
                    delegate(object sender, EventArgs e)
            {
                node.BeginEdit();
            }
                    )
                );
            node.ContextMenuStrip.Items.Add(
                new ToolStripMenuItem(
                    "編集",
                    null,
                    handler
                    )
                );
            node.ContextMenuStrip.Items.Add(
                new ToolStripMenuItem(
                    "削除",
                    null,
                    delegate(object sender, EventArgs e)
            {
                Selector.RemoveConstrain(constrain, Table);
                Selector.ExtractData();
                ParentNode.Nodes.Remove(node);
                if (SelectedAreaChanged != null)
                {
                    SelectedAreaChanged(Selector);
                }
                property.Changed();
            }
                    )
                );
        }