QCustomPlot Discussion and Comments

plot using quadratic equation, issue at 0-x vvalueReturn to overview

I would like to plot the quadratic equation y = -0.2204*x**2 + 124.87*x - 1819.2, but when x=0, y is getting 0 and shows the spike with y=0. why? other values are correct
thanks in advance.
QVector<double> x(120), y(120);// initialize with entries 0..100

for (int i=0; i<100; i++)
{
x = i - 40 ;// x goes from -1 to 1
y1 = (-0.2204*(i - 40)*(i - 40 ))+ (124.87*(i - 40)) - 1819.2; // let's plot a quadratic function
}
// create graph and assign data to it:
customPlot->addGraph();
customPlot->graph(0)->setData(x, y);

// give the axes some labels:
customPlot->xAxis->setLabel("Temperature");
customPlot->yAxis->setLabel("Density Altitude");
// set axes ranges, so we see all data:
customPlot->xAxis->setRange(-40, 100);

It's not clear what you mean with
"but when x=0, y is getting 0 and shows the spike with y=0"

x ranges from -40 to 59...
when i == 40, x == 0 and y == - 1819.2...

what's a spike with y = 0 ? "spike" in a x,y plot is something along y for a certain value of x.