private void UpdateScrollbars()
        {
            double        sx  = SpecChart.View.AxisX.Scale;
            AxisScrollBar sbx = (AxisScrollBar)SpecChart.View.AxisX.ScrollBar;

            if (sx >= 1.0)
            {
                sbx.Visibility = Visibility.Collapsed;
            }
            else
            {
                sbx.Visibility = Visibility.Visible;
            }
            double        sy  = SpecChart.View.AxisY.Scale;
            AxisScrollBar sby = (AxisScrollBar)SpecChart.View.AxisY.ScrollBar;

            if (sy >= 1.0)
            {
                sby.Visibility = Visibility.Collapsed;
            }
            else
            {
                sby.Visibility = Visibility.Visible;
            }
        }
示例#2
0
        public static bool DrawWave(WaveFile wave, Chart chartcontrol)
        {
            bool isComplited = true;

            if (wave != null)
            {
                // Установка меток оси
                chartcontrol.ChartAreas[0].AxisX.Title = "t";
                chartcontrol.ChartAreas[0].AxisY.Title = "A";
                // Минимальное значение по оси Х, максимальное значение, установки интервала масштабирования
                chartcontrol.ChartAreas[0].AxisX.Minimum  = 0;
                chartcontrol.ChartAreas[0].AxisX.Maximum  = wave.RightData.Length;
                chartcontrol.ChartAreas[0].AxisX.Interval = wave.SamplingRate;
                // Минимальное значение Y-оси, максимальное значение
                chartcontrol.ChartAreas[0].AxisY.Minimum = wave.RightData.Min();
                chartcontrol.ChartAreas[0].AxisY.Maximum = wave.RightData.Max();

                // Отображение полосы прокрутки
                AxisScaleView sv = chartcontrol.ChartAreas[0].AxisX.ScaleView;
                sv.SmallScrollSize = wave.SamplingRate;
                sv.Position        = 1;
                sv.Size            = wave.SamplingRate * 10;
                chartcontrol.ChartAreas[0].AxisX.ScaleView = sv;

                AxisScrollBar sb = chartcontrol.ChartAreas[0].AxisX.ScrollBar;
                sb.ButtonStyle        = ScrollBarButtonStyles.All;
                sb.IsPositionedInside = true;
                chartcontrol.ChartAreas[0].AxisX.ScrollBar = sb;

                Series series = new Series();
                series.ChartType = SeriesChartType.FastLine;

                for (int i = 0; i < wave.LeftData.Length; i++)
                {
                    series.Points.AddXY(i, wave.RightData[i]);
                }

                chartcontrol.Series.Add(series);

                chartcontrol.Invalidate();
            }
            else
            {
                isComplited = false;
            }

            return(isComplited);
        }
示例#3
0
 //------------------------------------------------------
 private void AppliqueScrollBar(CScrollBarStyle f, AxisScrollBar ms)
 {
     if (f.BackColor != Color.FromArgb(0))
     {
         ms.BackColor = f.BackColor;
     }
     if (f.ButtonColor != Color.FromArgb(0))
     {
         ms.ButtonColor = f.ButtonColor;
     }
     ms.ButtonStyle        = CConvertisseurChartEnumToMSEnum.GetMSScrollBarButtonStyles(f.ButtonStyle);
     ms.Enabled            = f.Enabled;
     ms.IsPositionedInside = f.IsPositionedInside;
     if (f.LineColor != Color.FromArgb(0))
     {
         ms.LineColor = f.LineColor;
     }
     ms.Size = f.Size;
 }
示例#4
0
        ////////////////////////////////////////////////////////////////////////////
        /////////////////////////////// PARETO CHART ///////////////////////////////
        ////////////////////////////////////////////////////////////////////////////

        // InitializeParetoChart: Initializes the Pareto Chart
        private void InitializeParetoChart()
        {
            // CHART
            ParetoChart = new Chart
            {
                Name     = "Pareto Chart",
                Location = new Point(313, 31),
                Margin   = new Padding(3, 4, 3, 4),
                Size     = new Size(773, 639),
                Anchor   = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom
            };


            // CHART AREA
            ChartArea chartArea = new ChartArea
            {
                Name      = "ChartArea",
                BackColor = Color.White
            };

            // Axis Info
            chartArea.AxisX.RoundAxisValues();
            chartArea.AxisX.ScaleView.Zoomable = true;
            chartArea.AxisY.RoundAxisValues();
            chartArea.AxisY.ScaleView.Zoomable = true;
            //Scroll Bar
            AxisScrollBar scrollX = new AxisScrollBar
            {
                Size        = 8,
                ButtonColor = Color.FromArgb(210, 210, 210),
                ButtonStyle = ScrollBarButtonStyles.None
            };

            chartArea.AxisX.ScrollBar = scrollX;
            AxisScrollBar scrollY = new AxisScrollBar
            {
                Size        = 8,
                ButtonColor = Color.FromArgb(210, 210, 210),
                ButtonStyle = ScrollBarButtonStyles.None
            };

            chartArea.AxisY.ScrollBar = scrollY;
            ParetoChart.ChartAreas.Add(chartArea);


            // LEGEND
            Legend legend = new Legend();

            ParetoChart.Legends.Add(legend);


            // SERIES
            Series historySeries = new Series
            {
                Name       = "Solution History",
                ChartType  = SeriesChartType.FastPoint,
                MarkerSize = 6,
                Color      = Color.LightGray
            };

            ParetoChart.Series.Add(historySeries);

            Series paretoSeries = new Series
            {
                Name       = "Pareto Solutions",
                ChartType  = SeriesChartType.FastPoint,
                MarkerSize = 8,
                Color      = Color.SteelBlue
            };

            ParetoChart.Series.Add(paretoSeries);


            // EVENTS
            ParetoChart.MouseWheel += Chart_MouseWheel;
            ParetoChart.MouseMove  += Chart_MouseMove;

            Editor.Controls.Add(ParetoChart);
            ParetoChart.SendToBack();
        }