/// <summary> /// Takes a series of average values and a series of weights and produces a weighted average for all values. The corresponding values should share one or more zero-indexed nodes. /// </summary> public SeriesListFunction WeightedAverage(SeriesListBase seriesListWeight, params int[] nodes) { if (seriesListWeight == null) { throw new ArgumentNullException(nameof(seriesListWeight)); } return(new SeriesListFunction("weightedAverage", Merge(this, Merge(seriesListWeight, nodes)))); }
/// <summary> /// Takes a metric or wildcard seriesList and replaces null values with the value specified by default. The value 0 used if not specified. The optional referenceSeries, if specified, is a metric or wildcard series list that governs which time intervals nulls should be replaced. If specified, nulls are replaced only in intervals where a non-null is found for the same interval in any of referenceSeries. This method compliments the drawNullAsZero function in graphical mode, but also works in text-only mode. /// </summary> public SeriesListFunction TransformNull(double defaultValue = 0.0, SeriesListBase referenceSeries = null) { if (referenceSeries != null) { return(Ternary("transformNull", defaultValue.ToString("r", CultureInfo.InvariantCulture), referenceSeries)); } // ReSharper disable once CompareOfFloatsByEqualityOperator if (defaultValue == 0.0) { return(Unary("transformNull")); } return(Binary("transformNull", defaultValue.ToString("r", CultureInfo.InvariantCulture))); }
/// <summary> /// Takes a wildcard seriesList, and a second fallback metric. If the wildcard does not match any series, draws the fallback metric. /// </summary> public SeriesListFunction FallbackSeries(SeriesListBase fallback) { return(Binary("fallbackSeries", fallback)); }
/// <summary> /// Takes a dividend metric and a divisor metric and draws the division result.<para/> /// A constant may not be passed. To divide by a constant, use the scale() function /// (which is essentially a multiplication operation) and use the inverse of the dividend. /// (Division by 8 = multiplication by 1/8 or 0.125) /// </summary> /// <param name="divisorSeries"></param> /// <returns></returns> public SeriesListFunction DivideSeries(SeriesListBase divisorSeries) { return(Binary("divideSeries", divisorSeries)); }
/// <summary> /// Calculates a percentage of the total of a wildcard series. If total is specified, each series will be calculated as a percentage of that total. If total is not specified, the sum of all points in the wildcard series will be used instead.<para/> /// The total parameter may be a single series or a numeric value. /// </summary> public SeriesListFunction AsPercent(SeriesListBase total) { return(Binary("asPercent", total)); }