Exemple #1
0
        private void InitializeAxes()
        {
            _xAxisLog = new LogarithmicNumericAxis
            {
                TextFormatting     = "#.#E+0",
                ScientificNotation = ScientificNotation.LogarithmicBase,
                VisibleRange       = new DoubleRange(0, 100),
                GrowBy             = new DoubleRange(0.1, 0.1),
                DrawMajorBands     = false,
                LogarithmicBase    = 10
            };

            _xAxisNum = new NumericAxis
            {
                TextFormatting     = "#.#E+0",
                ScientificNotation = ScientificNotation.Normalized,
                VisibleRange       = new DoubleRange(0, 100),
                GrowBy             = new DoubleRange(0.1, 0.1),
            };

            _yAxisLog = new LogarithmicNumericAxis
            {
                TextFormatting     = "#.#E+0",
                ScientificNotation = ScientificNotation.LogarithmicBase,
                AxisAlignment      = AxisAlignment.Left,
                GrowBy             = new DoubleRange(0.1, 0.1),
                DrawMajorBands     = false,
                LogarithmicBase    = 10
            };

            _yAxisNum = new NumericAxis
            {
                TextFormatting     = "#.#E+0",
                ScientificNotation = ScientificNotation.Normalized,
                AxisAlignment      = AxisAlignment.Left,
                GrowBy             = new DoubleRange(0.1, 0.1)
            };

            //var converter = new LogarithmicBaseConverter();
            //var logBinding = new Binding("SelectedValue") { ElementName = "logBasesChbx", Converter = converter };

            //_xAxisLog.SetBinding(LogarithmicNumericAxis.LogarithmicBaseProperty, logBinding);
            //_yAxisLog.SetBinding(LogarithmicNumericAxis.LogarithmicBaseProperty, logBinding);
        }
        private void InitializeAxes()
        {
            try
            {
                System.Windows.Application.Current.Dispatcher.Invoke((Action) delegate
                {
                    AutoRange _xAutorange = AutoRange.Never;
                    lock (_lockAxes)
                    {
                        _xAxisLog = new LogarithmicNumericAxis
                        {
                            TextFormatting     = "#0#",
                            ScientificNotation = ScientificNotation.Normalized,
                            VisibleRange       = _xAxisDoubleRange,
                            GrowBy             = new DoubleRange(0.1, 0.1),
                            DrawMajorBands     = false,
                            AutoRange          = _xAutorange,
                            DrawMinorGridLines = true,
                            DrawMajorTicks     = true,
                            DrawMinorTicks     = true,
                            StrokeThickness    = 1,
                            LogarithmicBase    = 10.0,
                            FontSize           = 5
                        };
                        XAxis1    = _xAxisLog;
                        _xAxisLog = new LogarithmicNumericAxis
                        {
                            TextFormatting     = "#0#",
                            ScientificNotation = ScientificNotation.Normalized,
                            VisibleRange       = _xAxisDoubleRange,
                            GrowBy             = new DoubleRange(0.1, 0.1),
                            DrawMajorBands     = false,
                            AutoRange          = _xAutorange,
                            DrawMinorGridLines = true,
                            DrawMajorTicks     = true,
                            DrawMinorTicks     = true,
                            StrokeThickness    = 1,
                            LogarithmicBase    = 10.0,
                            FontSize           = 5
                        };
                        XAxis2            = _xAxisLog;
                        MagVisibleRange   = _magVisibleRange;
                        PhaseVisibleRange = _phaseVisibleRange;
                    }
                });
            }
            catch { }
#if Yaxes
            NumericAxis Y1 = new NumericAxis()
            {
                Id                   = "Y1_Magnitude",
                TextFormatting       = "0.00",
                ScientificNotation   = ScientificNotation.Normalized,
                AxisAlignment        = AxisAlignment.Left,
                GrowBy               = new DoubleRange(0.2, 0.2),
                VisibleRange         = new DoubleRange(-50, 20),
                AnimatedVisibleRange = new DoubleRange(-50, 20),
                AxisTitle            = "Magnitude (dB)",
                TickTextBrush        = new SolidColorBrush(Colors.White),
                DrawMajorBands       = false,
                DrawMinorGridLines   = false,
                DrawMajorTicks       = false,
                DrawMinorTicks       = false,
                StrokeThickness      = 1
            };
            NumericAxis Y2 = new NumericAxis()
            {
                Id                   = "Y2_Phase",
                TextFormatting       = "0.00",
                ScientificNotation   = ScientificNotation.Normalized,
                AxisAlignment        = AxisAlignment.Right,
                GrowBy               = new DoubleRange(0.2, 0.2),
                VisibleRange         = new DoubleRange(-200, 200),
                AutoRange            = AutoRange.Always,
                AnimatedVisibleRange = new DoubleRange(-200, 200),
                AxisTitle            = "Phase (Degree)",
                TickTextBrush        = new SolidColorBrush(Colors.White),
                DrawMajorBands       = false,
                DrawMinorGridLines   = false,
                DrawMajorTicks       = false,
                DrawMinorTicks       = false,
                StrokeThickness      = 1
            };
            //ChartYAxes.Add(new NumericAxis() {
            //Id = "DefaultAxisId",
            //Visibility = Visibility.Hidden
            //});
            //ChartYAxes.Add(Y1);
            //ChartYAxes.Add(Y2);
#endif
        }