mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-26 01:00:50 +01:00
[apps/regression] Add methods in data model to set the cursor position
at a specific abscissa/ordinate Change-Id: I95cde32b36405f57e3e6ccfa37e6e0cda70da59a
This commit is contained in:
@@ -107,6 +107,20 @@ int Data::selectedDotIndex() {
|
||||
return m_selectedDotIndex;
|
||||
}
|
||||
|
||||
void Data::setCursorPositionAtAbscissa(float abscissa) {
|
||||
m_xCursorPosition = abscissa;
|
||||
centerAxisAround(CurveViewWindow::Axis::X, m_xCursorPosition);
|
||||
m_yCursorPosition = yValueForXValue(m_xCursorPosition);
|
||||
centerAxisAround(CurveViewWindow::Axis::Y, m_yCursorPosition);
|
||||
}
|
||||
|
||||
void Data::setCursorPositionAtOrdinate(float ordinate) {
|
||||
m_yCursorPosition = ordinate;
|
||||
centerAxisAround(CurveViewWindow::Axis::Y, m_yCursorPosition);
|
||||
m_xCursorPosition = xValueForYValue(m_yCursorPosition);
|
||||
centerAxisAround(CurveViewWindow::Axis::X, m_xCursorPosition);
|
||||
}
|
||||
|
||||
/* Window */
|
||||
|
||||
void Data::setDefault() {
|
||||
@@ -197,6 +211,10 @@ float Data::yValueForXValue(float x) {
|
||||
return slope()*x+yIntercept();
|
||||
}
|
||||
|
||||
float Data::xValueForYValue(float y) {
|
||||
return (y - yIntercept())/slope();
|
||||
}
|
||||
|
||||
float Data::correlationCoefficient() {
|
||||
return covariance()/(xStandardDeviation()*yStandardDeviation());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user