getLogarithmicPoints method
List<CartesianChartPoint>
getLogarithmicPoints(
- List<
CartesianChartPoint> points, - dynamic xValues,
- List<
num> yValues, - CartesianSeriesRenderer seriesRenderer,
- _SlopeIntercept slopeInterceptLog,
Defines Logarithmic Points
Implementation
List<CartesianChartPoint<dynamic>> getLogarithmicPoints(
List<CartesianChartPoint<dynamic>> points,
dynamic xValues,
List<num> yValues,
CartesianSeriesRenderer seriesRenderer,
_SlopeIntercept slopeInterceptLog) {
num x1, x2, x3;
final int midPoint = (points.length / 2).round();
final List<CartesianChartPoint<dynamic>> ptsLog =
<CartesianChartPoint<dynamic>>[];
if (seriesRenderer._xAxisRenderer is DateTimeAxisRenderer) {
x1 = _increaseDateTimeForecast(
seriesRenderer._xAxisRenderer as DateTimeAxisRenderer,
xValues[0],
-_trendline.backwardForecast);
x2 = xValues[midPoint - 1];
x3 = _increaseDateTimeForecast(
seriesRenderer._xAxisRenderer as DateTimeAxisRenderer,
xValues[xValues.length - 1],
_trendline.forwardForecast);
} else {
x1 = xValues[0] - _trendline.backwardForecast;
x2 = xValues[midPoint - 1];
x3 = xValues[xValues.length - 1] + _trendline.forwardForecast;
}
final num y1 = slopeInterceptLog.intercept +
(slopeInterceptLog.slope *
((math.log(x1)).isFinite ? math.log(x1) : x1));
final num y2 = slopeInterceptLog.intercept +
(slopeInterceptLog.slope *
((math.log(x2)).isFinite ? math.log(x2) : x2));
final num y3 = slopeInterceptLog.intercept +
(slopeInterceptLog.slope *
((math.log(x3)).isFinite ? math.log(x3) : x3));
ptsLog.add(getDataPoint(x1, y1, points[0], seriesRenderer, ptsLog.length));
ptsLog.add(getDataPoint(
x2, y2, points[midPoint - 1], seriesRenderer, ptsLog.length));
ptsLog.add(getDataPoint(
x3, y3, points[points.length - 1], seriesRenderer, ptsLog.length));
return ptsLog;
}