예제 #1
0
        private void OnWindRoseClick(object sender, EventArgs e)
        {
            DataGridViewSelectedRowCollection rows = WorkSpace.SelectedRows;
            var chfEx = new ChartFormEx();
            var nValues = new List<int>();

            for (int i = 0; i < 8; i++)
                nValues.Add(0);

            for (int i = 0; i < rows.Count; i++)
            {
                int index = int.Parse(rows[i].Cells["colIndex"].Value.ToString());
                ClimatData cd = _workspace.GetDatabyIndex(index);
                if (cd.WindDirect != -1)
                    nValues[cd.WindDirect]++;
            }

            chfEx.MakeWindRose(nValues);
            chfEx.ShowDialog();
        }
예제 #2
0
        private void OnShowChartClick(object sender, EventArgs e)
        {
            DataGridViewSelectedRowCollection rows = WorkSpace.SelectedRows;
            var dtDates = new List<DateTime>();
            for (int i = 0; i < rows.Count; i++)
                dtDates.Add(DateTime.Parse(rows[i].Cells["colDate"].Value.ToString()));

            var chfEx = new ChartFormEx(dtDates);
            String toolName = ((ToolStripMenuItem)sender).Name;
            if (toolName == "tempChartContextMenuItem" || toolName == "contextShowTemp")
            {
                chfEx.Title = "График изменения температуры.";
                chfEx.YAxis = "Температура (°C)";

                var dblTempDry = new List<double>();
                var dblTempWet = new List<double>();
                for (int i = 0; i < rows.Count; i++)
                {
                    dblTempDry.Add(double.Parse(rows[i].Cells["colTempDry"].Value.ToString()));
                    if (_bColShow[1])
                        dblTempWet.Add(double.Parse(rows[i].Cells["colTempWet"].Value.ToString()));
                }
                if (rows[0].Index > rows[1].Index)
                {
                    dtDates.Reverse();
                    dblTempDry.Reverse();
                    dblTempWet.Reverse();
                }

                if (_bColShow[1])
                    chfEx.MakeChartOf2Param(dblTempDry, dblTempWet);
                else
                    chfEx.MakeChartOf1Param(dblTempDry);
            }
            else
            {
                var dblParam = new List<double>();
                for (int i = 0; i < rows.Count; i++)
                {
                    if (toolName == "presChartContextMenuItem" || toolName == "contextShowPres")
                    {
                        chfEx.Title = "График изменения давления.";
                        chfEx.ParName = "Давление.";
                        chfEx.YAxis = "Давление (мм рт.ст.)";
                        if (_bColShow[2])
                            dblParam.Add(double.Parse(rows[i].Cells["colPressure"].Value.ToString()));
                    }
                    else
                    {
                        chfEx.Title = "График изменения влажности.";
                        chfEx.ParName = "Влажность.";
                        chfEx.YAxis = "Влажность (%)";
                        if (_bColShow[4])
                            dblParam.Add(double.Parse(rows[i].Cells["colHumidity"].Value.ToString()));
                    }
                }
                if (rows[0].Index > rows[1].Index)
                {
                    dtDates.Reverse();
                    dblParam.Reverse();
                }
                chfEx.MakeChartOf1Param(dblParam);
            }
            chfEx.ShowDialog();
        }