getExponentialPoints method
List<CartesianChartPoint>
getExponentialPoints(
- List<
CartesianChartPoint> points, - dynamic xValues,
- List<
num> yValues, - CartesianSeriesRenderer seriesRenderer,
- _SlopeIntercept slopeInterceptExpo,
Defines Exponential Points
Implementation
List<CartesianChartPoint<dynamic>> getExponentialPoints(
List<CartesianChartPoint<dynamic>> points,
dynamic xValues,
List<num> yValues,
CartesianSeriesRenderer seriesRenderer,
_SlopeIntercept slopeInterceptExpo) {
num x1, x2, x3;
final int midPoint = (points.length / 2).round();
final List<CartesianChartPoint<dynamic>> ptsExpo =
<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 =
slopeInterceptExpo.intercept * math.exp(slopeInterceptExpo.slope * x1);
final num y2 =
slopeInterceptExpo.intercept * math.exp(slopeInterceptExpo.slope * x2);
final num y3 =
slopeInterceptExpo.intercept * math.exp(slopeInterceptExpo.slope * x3);
ptsExpo
.add(getDataPoint(x1, y1, points[0], seriesRenderer, ptsExpo.length));
ptsExpo.add(getDataPoint(
x2, y2, points[midPoint - 1], seriesRenderer, ptsExpo.length));
ptsExpo.add(getDataPoint(
x3, y3, points[points.length - 1], seriesRenderer, ptsExpo.length));
return ptsExpo;
}