コード例 #1
0
ファイル: SurfaceProfileChart.cs プロジェクト: Nicktoris/DPP
        private void SetAxisSizes()
        {
            if (ProfilesProperties.Count == 1)
            {
                profileChart.ChartAreas["Default"].AxisY.Maximum = ProfilesProperties[0].MaxHeight
                                                                   + ProfilesProperties[0].MaxHeight / 10;
                profileChart.ChartAreas["Default"].AxisY.Minimum = ProfilesProperties[0].MinHeight
                                                                   - ProfilesProperties[0].MaxHeight / 10;

                profileChart.ChartAreas["Default"].AxisX.Maximum = profileChart.Series[0].Points.Last().XValue
                                                                   + profileChart.Series[0].Points.Last().XValue / 10;
            }
            else
            {
                double maxHeight = ProfilesProperties.Max(profileProperties => profileProperties.MaxHeight);
                double minHeight = ProfilesProperties.Min(profileProperties => profileProperties.MinHeight);
                double absHeight = maxHeight - minHeight;

                profileChart.ChartAreas["Default"].AxisY.Maximum = maxHeight + absHeight / 10;
                profileChart.ChartAreas["Default"].AxisY.Minimum = minHeight - absHeight / 10;


                double maxWidth = profileChart.Series.Max(serie => serie.Points.Last().XValue);

                profileChart.ChartAreas["Default"].AxisX.Maximum = maxWidth + maxWidth / 30;
            }

            SetAxisYMinValue();

            _defaultChartHeight = profileChart.ChartAreas["Default"].AxisY.Maximum;
        }
コード例 #2
0
ファイル: SurfaceProfileChart.cs プロジェクト: Nicktoris/DPP
        private void ProfilePropertiesTable_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.ColumnIndex == profilePropertiesTable.Columns["AzimuthCol"].Index)
            {
                List <double> azimuths = ProfilesProperties.Select(profile => profile.Azimuth).ToList();
                azimuths.Sort();

                if (profilePropertiesTable.Columns["AzimuthCol"].Tag == "ASC")
                {
                    azimuths.Reverse();
                    profilePropertiesTable.Columns["AzimuthCol"].Tag = "DESC";
                }
                else
                {
                    profilePropertiesTable.Columns["AzimuthCol"].Tag = "ASC";
                }

                var sortedProperties = new List <ProfileProperties>();

                for (int i = 0; i < azimuths.Count; i++)
                {
                    var properties = ProfilesProperties.Where(profile => profile.Azimuth == azimuths[i]).ToList();

                    if (properties.Count() > 1)
                    {
                        foreach (var property in properties)
                        {
                            sortedProperties.Add(property);
                        }

                        i += (properties.Count() - 1);
                    }
                    else
                    {
                        sortedProperties.Add(properties[0]);
                    }
                }

                FillPropertiesTable(sortedProperties);
            }
        }