I'm trying to draw a signal response on a chart and I need a logarithmic scale for X and Y. I defined two functions, one for X axis
private void Configure_Axis_X(bool Logaritmic, double Maximum, double Minimum, double Interval)
{
CH_EQ_Chart.ChartAreas[0].AxisX.IsLogarithmic = Logaritmic;
CH_EQ_Chart.ChartAreas[0].AxisX.Minimum = Minimum;
CH_EQ_Chart.ChartAreas[0].AxisX.Maximum = Maximum;
CH_EQ_Chart.ChartAreas[0].AxisX.Interval = Interval;
CH_EQ_Chart.ChartAreas[0].AxisX.MajorGrid.LineColor = Color.Black;
CH_EQ_Chart.ChartAreas[0].AxisX.MajorGrid.LineDashStyle = Graph.ChartDashStyle.Dash;
}
and one for Y axis
private void Configure_Axis_Y(bool Logaritmic, double Maximum, double Minimum, double Interval)
{
CH_EQ_Chart.ChartAreas[0].AxisY.IsLogarithmic = Logaritmic;
CH_EQ_Chart.ChartAreas[0].AxisY.Minimum = Minimum;
CH_EQ_Chart.ChartAreas[0].AxisY.Maximum = Maximum;
CH_EQ_Chart.ChartAreas[0].AxisY.Interval = Interval;
CH_EQ_Chart.ChartAreas[0].AxisY.MajorGrid.LineColor = Color.Black;
CH_EQ_Chart.ChartAreas[0].AxisY.MajorGrid.LineDashStyle = Graph.ChartDashStyle.Dash;
}
the response to draw is expressed in Decibel and I'd like to have logarithmic scale also for Y.
When I have the array with values, I get minimum and maxim value and I try to use the function above with
double Abs_Max = Math.Max(y.Max(), z.Max());
double Abs_Min = Math.Min(y.Min(), z.Min());
Configure_Axis_Y(true, Abs_Max + Abs_Max/10, Abs_Min + Abs_Min/10, 20);
but when I select islogaritmic = true a red cross appears instead the graph.
If I set islogaritmic = false the picture appears right.