public clsPythonPlotContainer3D( string plotTitle = "Undefined", string xAxisTitle = "X", string yAxisTitle = "Y", string zAxisTitle = "Z", bool writeDebug = false, string dataSource = "") : base(plotTitle, xAxisTitle, yAxisTitle, writeDebug, dataSource) { PointsByCharge = new Dictionary <int, List <ScatterPoint> >(); ClearData(); ZAxisInfo = new clsAxisInfo(zAxisTitle); }
/// <summary> /// Constructor /// </summary> /// <param name="plotTitle"></param> /// <param name="xAxisTitle"></param> /// <param name="yAxisTitle"></param> /// <param name="writeDebug"></param> /// <param name="dataSource"></param> protected clsPythonPlotContainer( string plotTitle = "Undefined", string xAxisTitle = "X", string yAxisTitle = "Y", bool writeDebug = false, string dataSource = "") : base(writeDebug, dataSource) { mSeriesCount = 0; DeleteTempFiles = true; PlotTitle = plotTitle; PythonPath = string.Empty; XAxisInfo = new clsAxisInfo(xAxisTitle); YAxisInfo = new clsAxisInfo(yAxisTitle); }
/// <summary> /// Examine the values in dataPoints to see if they are all less than 10 (or all less than 1) /// If they are, change the axis format code from the default of "#,##0" (see DEFAULT_AXIS_LABEL_FORMAT) /// </summary> /// <param name="currentAxis"></param> /// <param name="dataPoints"></param> /// <param name="integerData"></param> /// <remarks></remarks> public static void UpdateAxisFormatCodeIfSmallValues(Axis currentAxis, List <double> dataPoints, bool integerData) { if (!dataPoints.Any()) { return; } var axisInfo = new clsAxisInfo(); clsPlotUtilities.GetAxisFormatInfo(dataPoints, integerData, axisInfo); currentAxis.StringFormat = axisInfo.StringFormat; currentAxis.MinorGridlineThickness = axisInfo.MajorStep; currentAxis.MajorStep = axisInfo.MinorGridlineThickness; }
public static void GetAxisFormatInfo( IList <double> dataPoints, bool integerData, clsAxisInfo axisInfo) { var absValueMin = dataPoints.Count == 0 ? 0 : Math.Abs(dataPoints[0]); var absValueMax = absValueMin; foreach (var currentValAbs in from value in dataPoints select Math.Abs(value)) { absValueMin = Math.Min(absValueMin, currentValAbs); absValueMax = Math.Max(absValueMax, currentValAbs); } GetAxisFormatInfo(absValueMin, absValueMax, integerData, axisInfo); }
public static void GetAxisFormatInfo( double absValueMin, double absValueMax, bool integerData, clsAxisInfo axisInfo) { if (Math.Abs(absValueMin) < float.Epsilon && Math.Abs(absValueMax) < float.Epsilon) { axisInfo.StringFormat = "0"; axisInfo.MinorGridlineThickness = 0; axisInfo.MajorStep = 1; return; } if (integerData) { if (absValueMax >= 1000000) { axisInfo.StringFormat = clsAxisInfo.EXPONENTIAL_FORMAT; } return; } var minDigitsPrecision = 0; if (absValueMax < 0.02) { axisInfo.StringFormat = clsAxisInfo.EXPONENTIAL_FORMAT; } else if (absValueMax < 0.2) { minDigitsPrecision = 2; axisInfo.StringFormat = "0.00"; } else if (absValueMax < 2) { minDigitsPrecision = 1; axisInfo.StringFormat = "0.0"; } else if (absValueMax >= 1000000) { axisInfo.StringFormat = clsAxisInfo.EXPONENTIAL_FORMAT; } if (absValueMax - absValueMin < 1E-05) { if (!axisInfo.StringFormat.Contains(".")) { axisInfo.StringFormat = "0.00"; } } else { // Examine the range of values between the minimum and the maximum // If the range is small, e.g. between 3.95 and 3.98, then we need to guarantee that we have at least 2 digits of precision // The following combination of Log10 and ceiling determins the minimum needed var minDigitsRangeBased = (int)Math.Ceiling(-Math.Log10(absValueMax - absValueMin)); if (minDigitsRangeBased > minDigitsPrecision) { minDigitsPrecision = minDigitsRangeBased; } if (minDigitsPrecision > 0) { axisInfo.StringFormat = "0." + new string('0', minDigitsPrecision); } } }
public static void GetAxisFormatInfo( IList <double> dataPoints, bool integerData, clsAxisInfo axisInfo) { var minValue = Math.Abs(dataPoints[0]); var maxValue = minValue; foreach (var currentValAbs in from value in dataPoints select Math.Abs(value)) { minValue = Math.Min(minValue, currentValAbs); maxValue = Math.Max(maxValue, currentValAbs); } if (Math.Abs(minValue - 0) < float.Epsilon & Math.Abs(maxValue - 0) < float.Epsilon) { axisInfo.StringFormat = "0"; axisInfo.MinorGridlineThickness = 0; axisInfo.MajorStep = 1; return; } if (integerData) { if (maxValue >= 1000000) { axisInfo.StringFormat = clsAxisInfo.EXPONENTIAL_FORMAT; } return; } var minDigitsPrecision = 0; if (maxValue < 0.02) { axisInfo.StringFormat = clsAxisInfo.EXPONENTIAL_FORMAT; } else if (maxValue < 0.2) { minDigitsPrecision = 2; axisInfo.StringFormat = "0.00"; } else if (maxValue < 2) { minDigitsPrecision = 1; axisInfo.StringFormat = "0.0"; } else if (maxValue >= 1000000) { axisInfo.StringFormat = clsAxisInfo.EXPONENTIAL_FORMAT; } if (maxValue - minValue < 1E-05) { if (!axisInfo.StringFormat.Contains(".")) { axisInfo.StringFormat = "0.00"; } } else { // Examine the range of values between the minimum and the maximum // If the range is small, e.g. between 3.95 and 3.98, then we need to guarantee that we have at least 2 digits of precision // The following combination of Log10 and ceiling determins the minimum needed var minDigitsRangeBased = (int)Math.Ceiling(-(Math.Log10(maxValue - minValue))); if (minDigitsRangeBased > minDigitsPrecision) { minDigitsPrecision = minDigitsRangeBased; } if (minDigitsPrecision > 0) { axisInfo.StringFormat = "0." + new string('0', minDigitsPrecision); } } }