AbstractDataGraph
touchgfx/widgets/graph/AbstractDataGraph.hpp
An abstract data graph. This class is the base for other graphs. For specific graphs, please refer to those implementation, e.g. GraphScroll, GraphWrapAndClear, GraphWrapAndOverwrite and StaticGraph.
Inherits from: Container, Drawable
Inherited by: DynamicDataGraph, StaticDataGraph
Public Classes
class | GraphClickEvent |
An object of this type is passed with each callback that is sent when the graph is clicked. | |
class | GraphDragEvent |
An object of this type is passed with each callback that is sent when the graph is dragged. | |
Public Functions
AbstractDataGraph(int16_t capacity) | |
Initializes a new instance of the AbstractDataGraph class. | |
void | addBottomElement(AbstractGraphDecoration & d) |
Adds an element to be shown in the area below the graph. | |
void | addGraphElement(AbstractGraphElement & d) |
Adds a graph element which will display the graph. | |
void | addLeftElement(AbstractGraphDecoration & d) |
Adds an element to be shown in the area to the left of the graph. | |
void | addRightElement(AbstractGraphDecoration & d) |
Adds an element to be shown in the area to the right of the graph. | |
void | addTopElement(AbstractGraphDecoration & d) |
Adds an element to be shown in the area above the graph. | |
virtual void | clear() |
Clears the graph to its blank/initial state. | |
FORCE_INLINE_FUNCTION int | float2scaledX(float f) const |
Same as float2scaled(float, int) using the graph's x scale. | |
FORCE_INLINE_FUNCTION int | float2scaledY(float f) const |
Same as float2scaled(float, int) using the graph's y scale. | |
FORCE_INLINE_FUNCTION uint8_t | getAlpha() const |
Gets the current alpha value of the widget. | |
FORCE_INLINE_FUNCTION int16_t | getGapBeforeIndex() const |
Gets gap before index as set using setGapBeforeIndex(). | |
FORCE_INLINE_FUNCTION int16_t | getGraphAreaHeight() const |
Gets graph area height. | |
FORCE_INLINE_FUNCTION int16_t | getGraphAreaHeightIncludingPadding() const |
Gets graph area height including padding (but not margin). | |
FORCE_INLINE_FUNCTION int16_t | getGraphAreaMarginBottom() const |
Gets graph margin bottom. | |
FORCE_INLINE_FUNCTION int16_t | getGraphAreaMarginLeft() const |
Gets graph margin left. | |
FORCE_INLINE_FUNCTION int16_t | getGraphAreaMarginRight() const |
Gets graph margin right. | |
FORCE_INLINE_FUNCTION int16_t | getGraphAreaMarginTop() const |
Gets graph margin top. | |
FORCE_INLINE_FUNCTION int16_t | getGraphAreaPaddingBottom() const |
Gets graph area padding bottom. | |
FORCE_INLINE_FUNCTION int16_t | getGraphAreaPaddingLeft() const |
Gets graph area padding left. | |
FORCE_INLINE_FUNCTION int16_t | getGraphAreaPaddingRight() const |
Gets graph area padding right. | |
FORCE_INLINE_FUNCTION int16_t | getGraphAreaPaddingTop() const |
Gets graph area padding top. | |
FORCE_INLINE_FUNCTION int16_t | getGraphAreaWidth() const |
Gets graph area width. | |
FORCE_INLINE_FUNCTION int16_t | getGraphAreaWidthIncludingPadding() const |
Gets graph area width including padding (but not margin). | |
virtual float | getGraphRangeXMaxAsFloat() const |
Gets maximum x value for the graph. | |
virtual int | getGraphRangeXMaxAsInt() const |
Gets maximum x value for the graph. | |
virtual int | getGraphRangeXMaxScaled() const |
Gets maximum x value for the graph. | |
virtual float | getGraphRangeXMinAsFloat() const |
Gets minimum x value for the graph. | |
virtual int | getGraphRangeXMinAsInt() const |
Gets minimum x value for the graph. | |
virtual int | getGraphRangeXMinScaled() const |
Gets minimum x value for the graph. | |
virtual float | getGraphRangeYMaxAsFloat() const |
Gets maximum y value for the graph. | |
virtual int | getGraphRangeYMaxAsInt() const |
Gets maximum y value for the graph. | |
virtual int | getGraphRangeYMaxScaled() const |
Gets maximum y value for the graph. | |
virtual float | getGraphRangeYMinAsFloat() const |
Gets minimum y value for the graph. | |
virtual int | getGraphRangeYMinAsInt() const |
Gets minimum y value for the graph. | |
virtual int | getGraphRangeYMinScaled() const |
Gets minimum y value for the graph. | |
FORCE_INLINE_FUNCTION int16_t | getMaxCapacity() const |
Gets the capacity (max number of points) of the graph. | |
virtual bool | getNearestIndexForScreenX(int16_t x, int16_t & index) const |
Gets graph index nearest to the given screen x value. | |
virtual bool | getNearestIndexForScreenXY(int16_t x, int16_t y, int16_t & index) |
Gets graph index nearest to the given screen position. | |
virtual int | getScaleX() const |
Gets the scaling factor previously set using setScaleX(). | |
virtual int | getScaleY() const |
Gets the scaling factor previously set using setScaleY(). | |
FORCE_INLINE_FUNCTION int16_t | getUsedCapacity() const |
Gets the number of point used by the graph. | |
virtual void | handleClickEvent(const ClickEvent & event) |
Defines the event handler interface for ClickEvents. | |
virtual void | handleDragEvent(const DragEvent & event) |
Defines the event handler interface for DragEvents. | |
FORCE_INLINE_FUNCTION void | indexToDataPoint(int16_t index, float & xvalue, float & yvalue) const |
Gets data point as floating point values. | |
FORCE_INLINE_FUNCTION void | indexToDataPoint(int16_t index, int & xvalue, int & yvalue) const |
Gets data point as integer values. | |
FORCE_INLINE_FUNCTION void | indexToDataPointScaled(int16_t index, int & xvalue, int & yvalue) const |
Gets data point as raw (scaled) values. | |
FORCE_INLINE_FUNCTION float | indexToDataPointXAsFloat(int16_t index) const |
Gets data point x coordinate as float. | |
FORCE_INLINE_FUNCTION int | indexToDataPointXAsInt(int16_t index) const |
Gets data point x coordinate as int. | |
virtual int | indexToDataPointXScaled(int16_t index) const =0 |
Gets data point x coordinate scaled. | |
FORCE_INLINE_FUNCTION float | indexToDataPointYAsFloat(int16_t index) const |
Gets data point y coordinate as float. | |
FORCE_INLINE_FUNCTION int | indexToDataPointYAsInt(int16_t index) const |
Gets data point y coordinate as int. | |
virtual int | indexToDataPointYScaled(int16_t index) const =0 |
Gets data point y coordinate scaled. | |
FORCE_INLINE_FUNCTION int16_t | indexToScreenX(int16_t index) const |
Get the screen x coordinate for the given graph point index. | |
FORCE_INLINE_FUNCTION int16_t | indexToScreenY(int16_t index) const |
Get the screen y coordinate for the given graph point index. | |
FORCE_INLINE_FUNCTION int | int2scaledX(int i) const |
Same as int2scaled(int, int) using the graph's x scale. | |
FORCE_INLINE_FUNCTION int | int2scaledY(int i) const |
Same as int2scaled(int, int) using the graph's y scale. | |
virtual void | invalidateContent() const |
Invalidate content. | |
FORCE_INLINE_FUNCTION float | scaled2floatX(int i) const |
Same as scaled2float(int, int) using the graph's x scale. | |
FORCE_INLINE_FUNCTION float | scaled2floatY(int i) const |
Same as scaled2float(int, int) using the graph's y scale. | |
FORCE_INLINE_FUNCTION int | scaled2intX(int i) const |
Same as scaled2int(int, int) using the graph's x scale. | |
FORCE_INLINE_FUNCTION int | scaled2intY(int i) const |
Same as scaled2int(int, int) using the graph's y scale. | |
virtual void | setAlpha(uint8_t newAlpha) |
Sets the opacity (alpha value). | |
FORCE_INLINE_FUNCTION void | setClickAction(GenericCallback< const AbstractDataGraph &, const GraphClickEvent & > & callback) |
Sets an action to be executed when the graph is clicked. | |
FORCE_INLINE_FUNCTION void | setDragAction(GenericCallback< const AbstractDataGraph &, const GraphDragEvent & > & callback) |
Sets an action to be executed when the graph is dragged. | |
FORCE_INLINE_FUNCTION void | setGapBeforeIndex(int16_t index) |
Makes gap before the specified index. | |
void | setGraphAreaMargin(int16_t top, int16_t left, int16_t right, int16_t bottom) |
Sets graph position inside the widget by reserving a margin around the graph. | |
void | setGraphAreaPadding(int16_t top, int16_t left, int16_t right, int16_t bottom) |
Adds padding around the graph that will not be drawn in (apart from dots, boxes, lines etc. | |
FORCE_INLINE_FUNCTION void | setGraphRange(float xMin, float xMax, float yMin, float yMax) |
Sets minimum and maximum x and y coordinate ranges for the graph. | |
FORCE_INLINE_FUNCTION void | setGraphRange(float xMin, float xMax, int yMin, int yMax) |
Sets minimum and maximum x and y coordinate ranges for the graph. | |
FORCE_INLINE_FUNCTION void | setGraphRange(int xMin, int xMax, float yMin, float yMax) |
Sets minimum and maximum x and y coordinate ranges for the graph. | |
FORCE_INLINE_FUNCTION void | setGraphRange(int xMin, int xMax, int yMin, int yMax) |
Sets minimum and maximum x and y coordinate ranges for the graph. | |
FORCE_INLINE_FUNCTION void | setGraphRangeScaled(int xMin, int xMax, int yMin, int yMax) |
Same as setGraphRange(int, int, int, int) except the passed arguments are assumed scaled. | |
virtual void | setGraphRangeX(float min, float max) |
Sets minimum and maximum x coordinates for the graph. | |
virtual void | setGraphRangeX(int min, int max) |
Sets minimum and maximum x coordinates for the graph. | |
virtual void | setGraphRangeXAuto(bool showYaxis, float margin) |
Automatically adjust min and max x coordinate to show entire graph. | |
virtual void | setGraphRangeXAuto(bool showYaxis =true, int margin =0) |
Automatically adjust min and max x coordinate to show entire graph. | |
virtual void | setGraphRangeXAutoScaled(bool showYaxis, int margin) =0 |
Automatically adjust min and max x coordinate to show entire graph. | |
virtual void | setGraphRangeXScaled(int min, int max) |
Sets minimum and maximum x coordinates for the graph. | |
virtual void | setGraphRangeY(float min, float max) |
Sets minimum and maximum y coordinates for the graph. | |
virtual void | setGraphRangeY(int min, int max) |
Sets minimum and maximum y coordinates for the graph. | |
virtual void | setGraphRangeYAuto(bool showXaxis, float margin) |
Automatic adjust min and max y coordinate to show entire graph. | |
virtual void | setGraphRangeYAuto(bool showXaxis =true, int margin =0) |
Automatic adjust min and max y coordinate to show entire graph. | |
virtual void | setGraphRangeYAutoScaled(bool showXaxis, int margin) =0 |
Automatic adjust min and max y coordinate to show entire graph. | |
virtual void | setGraphRangeYScaled(int min, int max) |
Same as setGraphRangeY(int, int) except the passed arguments are assumed scaled. | |
virtual void | setHeight(int16_t height) |
Sets the height of this drawable. | |
virtual void | setScaleX(int scale, bool updateData =false) |
Sets a scaling factor to be multiplied on each X value added. | |
virtual void | setScaleY(int scale, bool updateData =false) |
Sets a scaling factor to be multiplied on each Y value added. | |
virtual void | setWidth(int16_t width) |
Sets the width of this drawable. | |
int | convertToNewScale(int value, int oldScale, int newScale) |
Converts a value from one scale to another scale. | |
FORCE_INLINE_FUNCTION int | float2scaled(float f, int scale) |
Multiply a floating point value with a constant and round the result. | |
FORCE_INLINE_FUNCTION int | int2scaled(int i, int scale) |
Multiply an integer value with a constant. | |
FORCE_INLINE_FUNCTION float | scaled2float(int i, int scale) |
Divide a floating point number with a constant. | |
FORCE_INLINE_FUNCTION int | scaled2int(int i, int scale) |
Divide an integer with a constant and round the result. | |
Protected Functions
virtual CWRUtil::Q5 | indexToScreenXQ5(int16_t index) const =0 |
Gets screen x coordinate for a specific data point added to the graph. | |
virtual CWRUtil::Q5 | indexToScreenYQ5(int16_t index) const =0 |
Gets screen y coordinate for a specific data point added to the graph. | |
virtual int | indexToXAxis(const int valueScaled, const int labelScaled) const =0 |
Convert the given valueScaled (index) to x axis value. | |
void | invalidateAllXAxisPoints() |
Invalidate all x axis points. | |
FORCE_INLINE_FUNCTION void | invalidateGraphArea() const |
Invalidate entire graph area (the center of the graph). | |
void | invalidateGraphPointAt(int16_t index) |
Invalidate point at a given index. | |
void | invalidateXAxisPointAt(int16_t index) |
Invalidate x axis point at the given index. | |
void | updateAreasPosition() |
Updates the position of all elements in all area after a change in size of the graph area and/or label padding. | |
virtual CWRUtil::Q5 | valueToScreenXQ5(int x) const |
Gets screen x coordinate for an absolute value. | |
virtual CWRUtil::Q5 | valueToScreenYQ5(int y) const |
Gets screen y coordinate for an absolute value. | |
virtual bool | xScreenRangeToIndexRange(int16_t xMin, int16_t xMax, int16_t & indexMin, int16_t & indexMax) const =0 |
Gets index range for screen x coordinate range taking the current graph range into account. | |
Protected Attributes
uint8_t | alpha |
The alpha of the entire graph. | |
Container | bottomArea |
The area below the graph. | |
int16_t | bottomPadding |
The graph area bottom padding. | |
GenericCallback< const AbstractDataGraph &, const GraphClickEvent & > * | clickAction |
The callback to be executed when this Graph is clicked. | |
GenericCallback< const AbstractDataGraph &, const GraphDragEvent & > * | dragAction |
The callback to be executed when this Graph is dragged. | |
int16_t | gapBeforeIndex |
The graph is disconnected (there is a gap) before this element index. | |
Container | graphArea |
The graph area (the center area) | |
int | graphRangeMaxX |
The graph range maximum x coordinate. | |
int | graphRangeMaxY |
The graph range maximum y coordinate. | |
int | graphRangeMinX |
The graph range minimum x coordinate. | |
int | graphRangeMinY |
The graph range minimum y coordinate. | |
Container | leftArea |
The area to the left of the graph. | |
int16_t | leftPadding |
The graph area left padding. | |
int16_t | maxCapacity |
Maximum number of points in the graph. | |
Container | rightArea |
The area to the right of the graph. | |
int16_t | rightPadding |
The graph area right padding. | |
Container | topArea |
The area above the graph. | |
int16_t | topPadding |
The graph area top padding. | |
int16_t | usedCapacity |
The number of used points in the graph. | |
int | xScale |
The data scale for the x values. | |
int | yScale |
The data scale for the y values. | |
Additional inherited members
Public Functions inherited from Container
virtual void | add(Drawable & d) |
Adds a Drawable instance as child to this Container. | |
Container() | |
virtual bool | contains(const Drawable & d) |
Query if a given Drawable has been added directly to this Container. | |
virtual void | draw(const Rect & invalidatedArea) const |
Draw this drawable. | |
virtual void | forEachChild(GenericCallback< Drawable & > * function) |
Executes the specified callback function for each child in the Container. | |
virtual Drawable * | getFirstChild() |
Obtain a pointer to the first child of this container. | |
virtual void | getLastChild(int16_t x, int16_t y, Drawable ** last) |
Gets the last child in the list of children in this Container. | |
virtual void | getLastChildNear(int16_t x, int16_t y, Drawable * last, int16_t fingerAdjustmentX, int16_t * fingerAdjustmentY) |
Works similar to getLastChild() but also considers the current set finger size in HAL. | |
virtual Rect | getSolidRect() const |
Get (the largest possible) rectangle that is guaranteed to be solid (opaque). | |
virtual void | insert(Drawable * previous, Drawable & d) |
Inserts a Drawable after a specific child node. | |
virtual void | remove(Drawable & d) |
Removes a Drawable from the container by removing it from the linked list of children. | |
virtual void | removeAll() |
Removes all children in the Container by resetting their parent and sibling pointers. | |
virtual void | unlink() |
Removes all children by unlinking the first child. | |
Protected Functions inherited from Container
virtual Rect | getContainedArea() const |
Gets a rectangle describing the total area covered by the children of this container. | |
virtual void | moveChildrenRelative(int16_t deltaX, int16_t deltaY) |
Calls moveRelative on all children. | |
Protected Attributes inherited from Container
Drawable * | firstChild |
Pointer to the first child of this container. Subsequent children can be found through firstChild's nextSibling. | |
Public Functions inherited from Drawable
void | center() |
Centers the Drawable inside its parent. | |
void | centerX() |
Center the Drawable horizontally inside its parent. | |
void | centerY() |
Center the Drawable vertically inside its parent. | |
virtual void | childGeometryChanged() |
This function can be called on parent nodes to signal that the size or position of one or more of its children has changed. | |
virtual void | draw(const Rect & invalidatedArea) const =0 |
Draw this drawable. | |
Drawable() | |
Initializes a new instance of the Drawable class. | |
void | drawToDynamicBitmap(BitmapId id) |
Render the Drawable object into a dynamic bitmap. | |
void | expand(int margin =0) |
Expands the Drawable to have the same size as its parent with a given margin around the edge. | |
Rect | getAbsoluteRect() const |
Helper function for obtaining the rectangle this Drawable covers, expressed in absolute coordinates. | |
virtual Drawable * | getFirstChild() |
Function for obtaining the first child of this drawable if any. | |
int16_t | getHeight() const |
Gets the height of this Drawable. | |
virtual void | getLastChild(int16_t x, int16_t y, Drawable ** last) =0 |
Function for obtaining the the last child of this drawable that intersects with the specified point. | |
Drawable * | getNextSibling() |
Gets the next sibling node. | |
Drawable * | getParent() const |
Returns the parent node. | |
const Rect & | getRect() const |
Gets the rectangle this Drawable covers, in coordinates relative to its parent. | |
virtual Rect | getSolidRect() const =0 |
Get (the largest possible) rectangle that is guaranteed to be solid (opaque). | |
virtual Rect | getSolidRectAbsolute() |
Helper function for obtaining the largest solid rect (as implemented by getSolidRect()) expressed in absolute coordinates. | |
virtual void | getVisibleRect(Rect & rect) const |
Function for finding the visible part of this drawable. | |
int16_t | getWidth() const |
Gets the width of this Drawable. | |
int16_t | getX() const |
Gets the x coordinate of this Drawable, relative to its parent. | |
int16_t | getY() const |
Gets the y coordinate of this Drawable, relative to its parent. | |
virtual void | handleGestureEvent(const GestureEvent & event) |
Defines the event handler interface for GestureEvents. | |
virtual void | handleTickEvent() |
Called periodically by the framework if the Drawable instance has subscribed to timer ticks. | |
virtual void | invalidate() const |
Tell the framework that this entire Drawable needs to be redrawn. | |
virtual void | invalidateRect(Rect & invalidatedArea) const |
Request that a region of this drawable is redrawn. | |
bool | isTouchable() const |
Gets whether this Drawable receives touch events or not. | |
bool | isVisible() const |
Gets whether this Drawable is visible. | |
virtual void | moveRelative(int16_t x, int16_t y) |
Moves the drawable. | |
virtual void | moveTo(int16_t x, int16_t y) |
Moves the drawable. | |
void | setPosition(const Drawable & drawable) |
Sets the position of the Drawable to the same as the given Drawable. | |
void | setPosition(int16_t x, int16_t y, int16_t width, int16_t height) |
Sets the size and position of this Drawable, relative to its parent. | |
void | setTouchable(bool touch) |
Controls whether this Drawable receives touch events or not. | |
void | setVisible(bool vis) |
Controls whether this Drawable should be visible. | |
void | setWidthHeight(const Bitmap & bitmap) |
Sets the dimensions (width and height) of the Drawable without changing the x and y coordinates). | |
void | setWidthHeight(const Drawable & drawable) |
Sets the dimensions (width and height) of the Drawable without changing the x and y coordinates). | |
void | setWidthHeight(const Rect & other) |
Sets the dimensions (width and height) of the Drawable without changing the x and y coordinates). | |
void | setWidthHeight(int16_t width, int16_t height) |
Sets the dimensions (width and height) of the Drawable without changing the x and y coordinates). | |
virtual void | setX(int16_t x) |
Sets the x coordinate of this Drawable, relative to its parent. | |
void | setXY(const Drawable & drawable) |
Sets the x and y coordinates of this Drawable. | |
void | setXY(int16_t x, int16_t y) |
Sets the x and y coordinates of this Drawable, relative to its parent. | |
virtual void | setY(int16_t y) |
Sets the y coordinate of this Drawable, relative to its parent. | |
virtual void | translateRectToAbsolute(Rect & r) const |
Helper function for converting a region of this Drawable to absolute coordinates. | |
virtual | ~Drawable() |
Finalizes an instance of the Drawable class. | |
Protected Attributes inherited from Drawable
Drawable * | nextSibling |
Pointer to the next Drawable. | |
Drawable * | parent |
Pointer to this drawable's parent. | |
Rect | rect |
The coordinates of this Drawable, relative to its parent. | |
bool | touchable |
True if this drawable should receive touch events. | |
bool | visible |
True if this drawable should be drawn. | |
Public Functions Documentation
AbstractDataGraph
AbstractDataGraph | ( | int16_t | capacity | ) | |
Initializes a new instance of the AbstractDataGraph class.
capacity | The capacity, i.e. the number of points in the graph. |
addBottomElement
void addBottomElement | ( | AbstractGraphDecoration & | d | ) | |
Adds an element to be shown in the area below the graph.
Labels and titles can be added here.
d | an AbstractGraphElement to add. |
addGraphElement
void addGraphElement | ( | AbstractGraphElement & | d | ) | |
Adds a graph element which will display the graph.
Several graph elements can be added. Examples of graph elements are lines, dots, histograms as well as horizontal and vertical grid lines.
d | an AbstractGraphElement to add. |
addLeftElement
void addLeftElement | ( | AbstractGraphDecoration & | d | ) | |
Adds an element to be shown in the area to the left of the graph.
Labels and titles can be added here.
d | an AbstractGraphElement to add. |
addRightElement
void addRightElement | ( | AbstractGraphDecoration & | d | ) | |
Adds an element to be shown in the area to the right of the graph.
Labels and titles can be added here.
d | an AbstractGraphElement to add. |
addTopElement
void addTopElement | ( | AbstractGraphDecoration & | d | ) | |
Adds an element to be shown in the area above the graph.
Labels and titles can be added here.
d | an AbstractGraphElement to add. |
clear
virtual void clear | ( | ) |
Clears the graph to its blank/initial state.
The graph is invalidated so that the empty graph will be drawn after a call to clear.
Reimplemented by: touchgfx::GraphScrollData::clear, touchgfx::GraphWrapAndClearData::clear, touchgfx::GraphWrapAndOverwriteData::clear
float2scaledX
FORCE_INLINE_FUNCTION int float2scaledX | ( | float | f | ) | |
Same as float2scaled(float, int) using the graph's x scale.
f | The floating point value to scale. |
The scaled value.
Note
For internal use.
float2scaledY
FORCE_INLINE_FUNCTION int float2scaledY | ( | float | f | ) | |
Same as float2scaled(float, int) using the graph's y scale.
f | The floating point value to scale. |
The scaled value.
Note
For internal use.
getAlpha
FORCE_INLINE_FUNCTION uint8_t getAlpha | ( | ) | const |
Gets the current alpha value of the widget.
The alpha value is in range 255 (solid) to 0 (invisible).
The current alpha value.
getGapBeforeIndex
FORCE_INLINE_FUNCTION int16_t getGapBeforeIndex | ( | ) | const |
Gets gap before index as set using setGapBeforeIndex().
The gap before index.
getGraphAreaHeight
FORCE_INLINE_FUNCTION int16_t getGraphAreaHeight | ( | ) | const |
Gets graph area height.
This is the height of the actual graph area and is the same as the height of the graph widget minus margin and padding.
The graph area height.
getGraphAreaHeightIncludingPadding
FORCE_INLINE_FUNCTION int16_t getGraphAreaHeightIncludingPadding | ( | ) | const |
Gets graph area height including padding (but not margin).
This is the height of the actual graph area and is the same as the height of the graph widget minus margin.
The graph area height including graph padding.
getGraphAreaMarginBottom
FORCE_INLINE_FUNCTION int16_t getGraphAreaMarginBottom | ( | ) | const |
getGraphAreaMarginLeft
FORCE_INLINE_FUNCTION int16_t getGraphAreaMarginLeft | ( | ) | const |
getGraphAreaMarginRight
FORCE_INLINE_FUNCTION int16_t getGraphAreaMarginRight | ( | ) | const |
getGraphAreaMarginTop
FORCE_INLINE_FUNCTION int16_t getGraphAreaMarginTop | ( | ) | const |
getGraphAreaPaddingBottom
FORCE_INLINE_FUNCTION int16_t getGraphAreaPaddingBottom | ( | ) | const |
getGraphAreaPaddingLeft
FORCE_INLINE_FUNCTION int16_t getGraphAreaPaddingLeft | ( | ) | const |
getGraphAreaPaddingRight
FORCE_INLINE_FUNCTION int16_t getGraphAreaPaddingRight | ( | ) | const |
getGraphAreaPaddingTop
FORCE_INLINE_FUNCTION int16_t getGraphAreaPaddingTop | ( | ) | const |
getGraphAreaWidth
FORCE_INLINE_FUNCTION int16_t getGraphAreaWidth | ( | ) | const |
Gets graph area width.
This is the width of the actual graph area and is the same as the width of the graph widget minus margin and padding.
The graph area width.
getGraphAreaWidthIncludingPadding
FORCE_INLINE_FUNCTION int16_t getGraphAreaWidthIncludingPadding | ( | ) | const |
Gets graph area width including padding (but not margin).
This is the width of the actual graph area and is the same as the width of the graph widget minus margin.
The graph width including graph padding.
getGraphRangeXMaxAsFloat
virtual float getGraphRangeXMaxAsFloat | ( | ) | const |
Gets maximum x value for the graph.
The maximum x value.
getGraphRangeXMaxAsInt
virtual int getGraphRangeXMaxAsInt | ( | ) | const |
Gets maximum x value for the graph.
The maximum x value.
getGraphRangeXMaxScaled
virtual int getGraphRangeXMaxScaled | ( | ) | const |
Gets maximum x value for the graph.
The maximum x value. The graph range x coordinate maximum scaled.
Note
The returned value is left scaled.
getGraphRangeXMinAsFloat
virtual float getGraphRangeXMinAsFloat | ( | ) | const |
Gets minimum x value for the graph.
The minimum x value.
getGraphRangeXMinAsInt
virtual int getGraphRangeXMinAsInt | ( | ) | const |
Gets minimum x value for the graph.
The minimum x value.
getGraphRangeXMinScaled
virtual int getGraphRangeXMinScaled | ( | ) | const |
Gets minimum x value for the graph.
The minimum x value. The graph range x coordinate minimum scaled.
Note
The returned value is left scaled.
getGraphRangeYMaxAsFloat
virtual float getGraphRangeYMaxAsFloat | ( | ) | const |
Gets maximum y value for the graph.
The maximum y value.
getGraphRangeYMaxAsInt
virtual int getGraphRangeYMaxAsInt | ( | ) | const |
Gets maximum y value for the graph.
The maximum y value.
getGraphRangeYMaxScaled
virtual int getGraphRangeYMaxScaled | ( | ) | const |
Gets maximum y value for the graph.
The maximum y value.
Note
The returned value is left scaled.
getGraphRangeYMinAsFloat
virtual float getGraphRangeYMinAsFloat | ( | ) | const |
Gets minimum y value for the graph.
The minimum y value.
getGraphRangeYMinAsInt
virtual int getGraphRangeYMinAsInt | ( | ) | const |
Gets minimum y value for the graph.
The minimum y value.
getGraphRangeYMinScaled
virtual int getGraphRangeYMinScaled | ( | ) | const |
Gets minimum y value for the graph.
The minimum y value.
Note
The returned value is left scaled.
getMaxCapacity
FORCE_INLINE_FUNCTION int16_t getMaxCapacity | ( | ) | const |
Gets the capacity (max number of points) of the graph.
The capacity.
getNearestIndexForScreenX
virtual bool getNearestIndexForScreenX | ( | int16_t | x , | const | |
int16_t & | index | const | |||
) | const |
Gets graph index nearest to the given screen x value.
The index of the graph point closest to the given x coordinate is handed back.
x | The x value. |
index | Zero-based index of the. |
True if it succeeds, false if it fails.
getNearestIndexForScreenXY
virtual bool getNearestIndexForScreenXY | ( | int16_t | x , | ||
int16_t | y , | ||||
int16_t & | index | ||||
) |
Gets graph index nearest to the given screen position.
The distance to each point on the graph is measured and the index of the point closest to the given position handed back.
x | The x value. |
y | The y value. |
index | Zero-based index of the point closest to the given position. |
True if it succeeds, false if it fails.
getScaleX
virtual int getScaleX | ( | ) | const |
Gets the scaling factor previously set using setScaleX().
The scaling factor.
Reimplemented by: touchgfx::DynamicDataGraph::getScaleX
getScaleY
virtual int getScaleY | ( | ) | const |
Gets the scaling factor previously set using setScaleY().
The scaling factor.
Reimplemented by: touchgfx::DynamicDataGraph::getScaleY
getUsedCapacity
FORCE_INLINE_FUNCTION int16_t getUsedCapacity | ( | ) | const |
Gets the number of point used by the graph.
The number of point used by the graph.
handleClickEvent
virtual void handleClickEvent | ( | const ClickEvent & | event | ) | |
Defines the event handler interface for ClickEvents.
The default implementation ignores the event. The event is only received if the Drawable is touchable and visible.
event | The ClickEvent received from the HAL. |
Reimplements: touchgfx::Drawable::handleClickEvent
handleDragEvent
virtual void handleDragEvent | ( | const DragEvent & | event | ) | |
Defines the event handler interface for DragEvents.
The default implementation ignores the event. The event is only received if the drawable is touchable and visible.
Reimplements: touchgfx::Drawable::handleDragEvent
indexToDataPoint
FORCE_INLINE_FUNCTION void indexToDataPoint | ( | int16_t | index , | const | |
float & | xvalue , | const | |||
float & | yvalue | const | |||
) | const |
Gets data point as floating point values.
index | Zero-based index of the values to fetch. |
xvalue | The x value. |
yvalue | The y value. |
indexToDataPoint
FORCE_INLINE_FUNCTION void indexToDataPoint | ( | int16_t | index , | const | |
int & | xvalue , | const | |||
int & | yvalue | const | |||
) | const |
Gets data point as integer values.
index | Zero-based index of the values to fetch. |
xvalue | The x value. |
yvalue | The y value. |
indexToDataPointScaled
FORCE_INLINE_FUNCTION void indexToDataPointScaled | ( | int16_t | index , | const | |
int & | xvalue , | const | |||
int & | yvalue | const | |||
) | const |
Gets data point as raw (scaled) values.
index | Zero-based index of the values to fetch. |
xvalue | The x value. |
yvalue | The y value. |
indexToDataPointXAsFloat
FORCE_INLINE_FUNCTION float indexToDataPointXAsFloat | ( | int16_t | index | ) | |
Gets data point x coordinate as float.
index | Zero-based index of the value to fetch. |
The data point x coordinate as float.
indexToDataPointXAsInt
FORCE_INLINE_FUNCTION int indexToDataPointXAsInt | ( | int16_t | index | ) | |
Gets data point x coordinate as int.
index | Zero-based index of the value to fetch. |
The data point x coordinate as int.
indexToDataPointXScaled
virtual int indexToDataPointXScaled | ( | int16_t | index | ) | |
Gets data point x coordinate scaled.
index | Zero-based index of the value to fetch. |
The data point x coordinate scaled.
indexToDataPointXAsInt, indexToDataPointXAsFloat, indexToDataPointYScaled, indexToDataPoint, indexToDataPointScaled
Reimplemented by: touchgfx::DynamicDataGraph::indexToDataPointXScaled, touchgfx::StaticDataGraph::indexToDataPointXScaled
indexToDataPointYAsFloat
FORCE_INLINE_FUNCTION float indexToDataPointYAsFloat | ( | int16_t | index | ) | |
Gets data point y coordinate as float.
index | Zero-based index of the value to fetch. |
The data point y coordinate as float.
indexToDataPointYAsInt
FORCE_INLINE_FUNCTION int indexToDataPointYAsInt | ( | int16_t | index | ) | |
Gets data point y coordinate as int.
index | Zero-based index of the value to fetch. |
The data point y coordinate as int.
indexToDataPointYScaled
virtual int indexToDataPointYScaled | ( | int16_t | index | ) | |
Gets data point y coordinate scaled.
index | Zero-based index of the value to fetch. |
The data point y coordinate scaled.
indexToDataPointYAsInt, indexToDataPointYAsFloat, indexToDataPointXScaled, indexToDataPoint, indexToDataPointScaled
Reimplemented by: touchgfx::DynamicDataGraph::indexToDataPointYScaled, touchgfx::StaticDataGraph::indexToDataPointYScaled
indexToScreenX
FORCE_INLINE_FUNCTION int16_t indexToScreenX | ( | int16_t | index | ) | |
Get the screen x coordinate for the given graph point index.
index | Zero-based index of the point. |
The screen x value.
indexToScreenY
FORCE_INLINE_FUNCTION int16_t indexToScreenY | ( | int16_t | index | ) | |
Get the screen y coordinate for the given graph point index.
index | Zero-based index of the point. |
The screen x value.
int2scaledX
FORCE_INLINE_FUNCTION int int2scaledX | ( | int | i | ) | |
Same as int2scaled(int, int) using the graph's x scale.
i | The integer value to scale. |
The scaled integer.
Note
For internal use.
int2scaledY
FORCE_INLINE_FUNCTION int int2scaledY | ( | int | i | ) | |
Same as int2scaled(int, int) using the graph's y scale.
i | The integer value to scale. |
The scaled integer.
Note
For internal use.
invalidateContent
virtual void invalidateContent | ( | ) | const |
Invalidate content.
Reimplements: touchgfx::Drawable::invalidateContent
scaled2floatX
FORCE_INLINE_FUNCTION float scaled2floatX | ( | int | i | ) | |
Same as scaled2float(int, int) using the graph's x scale.
i | The scaled value to convert to a floating point value. |
The unscaled value.
Note
For internal use.
scaled2floatY
FORCE_INLINE_FUNCTION float scaled2floatY | ( | int | i | ) | |
Same as scaled2float(int, int) using the graph's y scale.
i | The scaled value to convert to a floating point value. |
The unscaled value.
Note
For internal use.
scaled2intX
FORCE_INLINE_FUNCTION int scaled2intX | ( | int | i | ) | |
Same as scaled2int(int, int) using the graph's x scale.
i | The scaled value to convert to an integer. |
The unscaled value.
Note
For internal use.
scaled2intY
FORCE_INLINE_FUNCTION int scaled2intY | ( | int | i | ) | |
Same as scaled2int(int, int) using the graph's y scale.
i | The scaled value to convert to an integer. |
The unscaled value.
Note
For internal use.
setAlpha
virtual void setAlpha | ( | uint8_t | newAlpha | ) | |
Sets the opacity (alpha value).
This can be used to fade it away by gradually decreasing the alpha value from 255 (solid) to 0 (invisible).
newAlpha | The new alpha value. 255=solid, 0=invisible. |
Note
The user code must call invalidate() in order to update the display.All graph elements have to take this alpha into consideration.
setClickAction
FORCE_INLINE_FUNCTION void setClickAction | ( | GenericCallback< const AbstractDataGraph &, const GraphClickEvent & > & | callback | ) | |
Sets an action to be executed when the graph is clicked.
callback | The callback. |
setDragAction
FORCE_INLINE_FUNCTION void setDragAction | ( | GenericCallback< const AbstractDataGraph &, const GraphDragEvent & > & | callback | ) | |
Sets an action to be executed when the graph is dragged.
callback | The callback. |
setGapBeforeIndex
FORCE_INLINE_FUNCTION void setGapBeforeIndex | ( | int16_t | index | ) | |
Makes gap before the specified index.
This can be used to split a graph in two, but for some graph types, e.g. histograms, this has no effect. Only one gap can be specified at a time. Specifying a new gap automatically removes the previous gap.
index | Zero-based index where the gap should be placed. |
setGraphAreaMargin
void setGraphAreaMargin | ( | int16_t | top , | ||
int16_t | left , | ||||
int16_t | right , | ||||
int16_t | bottom | ||||
) |
Sets graph position inside the widget by reserving a margin around the graph.
These areas to the left, the right, above and below are used for drawing optional axis and titles.
top | The top margin in pixels. |
left | The left margin in pixels. |
right | The right margin in pixels. |
bottom | The bottom margin in pixels. |
Note
The graph is automatically invalidated when the graph margins are changed.
setGraphAreaPadding
void setGraphAreaPadding | ( | int16_t | top , | ||
int16_t | left , | ||||
int16_t | right , | ||||
int16_t | bottom | ||||
) |
Adds padding around the graph that will not be drawn in (apart from dots, boxes, lines etc.
that extend around the actual data point). The set padding will also work to make a gap between the graph and any labels that might have been added to the graph. To reserve an area that the graph will not be drawn in, use setGraphAreaMargin.
top | The top padding in pixels. |
left | The left padding in pixels. |
right | The right padding in pixels. |
bottom | The bottom padding in pixels. |
Note
The graph is automatically invalidated when the margins are set.
setGraphRange
FORCE_INLINE_FUNCTION void setGraphRange | ( | float | xMin , | ||
float | xMax , | ||||
float | yMin , | ||||
float | yMax | ||||
) |
Sets minimum and maximum x and y coordinate ranges for the graph.
This can be used to zoom in or out and only show parts of the graph. The range given is scaled.
xMin | The minimum x value. |
xMax | The maximum x value. |
yMin | The minimum y value. |
yMax | The maximum y value. |
setGraphRange
FORCE_INLINE_FUNCTION void setGraphRange | ( | float | xMin , | ||
float | xMax , | ||||
int | yMin , | ||||
int | yMax | ||||
) |
Sets minimum and maximum x and y coordinate ranges for the graph.
This can be used to zoom in or out and only show parts of the graph. The range given is scaled.
xMin | The minimum x value. |
xMax | The maximum x value. |
yMin | The minimum y value. |
yMax | The maximum y value. |
setGraphRange
FORCE_INLINE_FUNCTION void setGraphRange | ( | int | xMin , | ||
int | xMax , | ||||
float | yMin , | ||||
float | yMax | ||||
) |
Sets minimum and maximum x and y coordinate ranges for the graph.
This can be used to zoom in or out and only show parts of the graph. The range given is scaled.
xMin | The minimum x value. |
xMax | The maximum x value. |
yMin | The minimum y value. |
yMax | The maximum y value. |
setGraphRange
FORCE_INLINE_FUNCTION void setGraphRange | ( | int | xMin , | ||
int | xMax , | ||||
int | yMin , | ||||
int | yMax | ||||
) |
Sets minimum and maximum x and y coordinate ranges for the graph.
This can be used to zoom in or out and only show parts of the graph. The range given is scaled.
xMin | The minimum x value. |
xMax | The maximum x value. |
yMin | The minimum y value. |
yMax | The maximum y value. |
setGraphRangeScaled
FORCE_INLINE_FUNCTION void setGraphRangeScaled | ( | int | xMin , | ||
int | xMax , | ||||
int | yMin , | ||||
int | yMax | ||||
) |
Same as setGraphRange(int, int, int, int) except the passed arguments are assumed scaled.
This means that if the scale is 1000, a value of 1 is interpreted as 0.001 (i.e. 1/1000).
xMin | The minimum x value. |
xMax | The maximum x value. |
yMin | The minimum y value. |
yMax | The maximum y value. |
setGraphRangeX
virtual void setGraphRangeX | ( | float | min , | ||
float | max | ||||
) |
Sets minimum and maximum x coordinates for the graph.
This can be used to zoom in or out and only show parts of the graph.
min | The minimum x value. |
max | The maximum x value. |
Note
The graph as well as the area above and below are automatically redrawn (invalidated).
setGraphRangeX
virtual void setGraphRangeX | ( | int | min , | ||
int | max | ||||
) |
Sets minimum and maximum x coordinates for the graph.
This can be used to zoom in or out and only show parts of the graph.
min | The minimum x value. |
max | The maximum x value. |
Note
The graph as well as the area above and below are automatically redrawn (invalidated).
setGraphRangeXAuto
virtual void setGraphRangeXAuto | ( | bool | showYaxis , | ||
float | margin | ||||
) |
Automatically adjust min and max x coordinate to show entire graph.
It is possible to ensure that the y axis (i.e. x=0) is included in the new range. If the graph range is changed as a consequence of calling this function, the graph is automatically redrawn (invalidated).
showYaxis | (Optional) True to ensure that the y axis is visible (default is true). |
margin | (Optional) The margin to add above/below the max/min x value (default is no margin). |
Note
This takes the currently visible y coordinate range into account. If data in the graph is changed, added or deleted, the graph range is not automatically recalculated. Call this function again to achieve this functionality.
setGraphRangeXAuto
virtual void setGraphRangeXAuto | ( | bool | showYaxis =true, | ||
int | margin =0 | ||||
) |
Automatically adjust min and max x coordinate to show entire graph.
It is possible to ensure that the y axis (i.e. x=0) is included in the new range. If the graph range is changed as a consequence of calling this function, the graph is automatically redrawn (invalidated).
showYaxis | (Optional) True to ensure that the y axis is visible (default is true). |
margin | (Optional) The margin to add above/below the max/min x value (default is no margin). |
Note
This takes the currently visible y coordinate range into account. If data in the graph is changed, added or deleted, the graph range is not automatically recalculated. Call this function again to achieve this functionality.
setGraphRangeXAutoScaled
virtual void setGraphRangeXAutoScaled | ( | bool | showYaxis , | =0 | |
int | margin | =0 | |||
) | =0 |
Automatically adjust min and max x coordinate to show entire graph.
It is possible to ensure that the y axis (i.e. x=0) is included in the new range. If the graph range is changed as a consequence of calling this function, the graph is automatically redrawn (invalidated).
showYaxis | (Optional) True to ensure that the y axis is visible (default is true). |
margin | (Optional) The margin to add above/below the max/min x value (default is no margin). |
Note
This takes the currently visible y coordinate range into account. If data in the graph is changed, added or deleted, the graph range is not automatically recalculated. Call this function again to achieve this functionality.The arguments are assumed scaled. This means that if the scale is 1000, a value of 1 is interpreted as 0.001 (i.e. 1/1000).
Reimplemented by: touchgfx::StaticDataGraph::setGraphRangeXAutoScaled, touchgfx::DynamicDataGraph::setGraphRangeXAutoScaled
setGraphRangeXScaled
virtual void setGraphRangeXScaled | ( | int | min , | ||
int | max | ||||
) |
Sets minimum and maximum x coordinates for the graph.
This can be used to zoom in or out and only show parts of the graph.
min | The minimum x value. |
max | The maximum x value. |
Note
The graph as well as the area above and below are automatically redrawn (invalidated).The arguments are assumed scaled. This means that if the scale is 1000, a value of 1 is interpreted as 0.001 (i.e. 1/1000).
setGraphRangeY
virtual void setGraphRangeY | ( | float | min , | ||
float | max | ||||
) |
Sets minimum and maximum y coordinates for the graph.
This can be used to zoom in or out and only show parts of the graph.
min | The minimum y value. |
max | The maximum y value. |
Note
The graph as well as the area to the left and to the right of the graph are automatically redrawn (invalidated)
setGraphRangeY
virtual void setGraphRangeY | ( | int | min , | ||
int | max | ||||
) |
Sets minimum and maximum y coordinates for the graph.
This can be used to zoom in or out and only show parts of the graph.
min | The minimum y value. |
max | The maximum y value. |
Note
The graph as well as the area to the left and to the right of the graph are automatically redrawn (invalidated)
setGraphRangeYAuto
virtual void setGraphRangeYAuto | ( | bool | showXaxis , | ||
float | margin | ||||
) |
Automatic adjust min and max y coordinate to show entire graph.
It is possible to ensure that the x axis (i.e. y=0) is included in the new range. If the graph range is changed, the graph is automatically redrawn (invalidated).
showXaxis | True to ensure that the x axis is visible (default is true). |
margin | The margin to add above/below the max/min y value (default is no margin). |
Note
This takes the current visible x coordinate range into account.
setGraphRangeYAuto
virtual void setGraphRangeYAuto | ( | bool | showXaxis =true, | ||
int | margin =0 | ||||
) |
Automatic adjust min and max y coordinate to show entire graph.
It is possible to ensure that the x axis (i.e. y=0) is included in the new range. If the graph range is changed, the graph is automatically redrawn (invalidated).
showXaxis | True to ensure that the x axis is visible (default is true). |
margin | The margin to add above/below the max/min y value (default is no margin). |
Note
This takes the current visible x coordinate range into account.
setGraphRangeYAutoScaled
virtual void setGraphRangeYAutoScaled | ( | bool | showXaxis , | =0 | |
int | margin | =0 | |||
) | =0 |
Automatic adjust min and max y coordinate to show entire graph.
It is possible to ensure that the x axis (i.e. y=0) is included in the new range. If the graph range is changed, the graph is automatically redrawn (invalidated).
showXaxis | True to ensure that the x axis is visible (default is true). |
margin | The margin to add above/below the max/min y value (default is no margin). |
Note
This takes the current visible x coordinate range into account.
Reimplemented by: touchgfx::DynamicDataGraph::setGraphRangeYAutoScaled, touchgfx::StaticDataGraph::setGraphRangeYAutoScaled
setGraphRangeYScaled
virtual void setGraphRangeYScaled | ( | int | min , | ||
int | max | ||||
) |
Same as setGraphRangeY(int, int) except the passed arguments are assumed scaled.
min | The minimum y value. |
max | The maximum y value. |
setHeight
virtual void setHeight | ( | int16_t | height | ) | |
Sets the height of this drawable.
height | The new height. |
Note
For most Drawable widgets, changing this does normally not automatically yield a redraw.
Reimplements: touchgfx::Drawable::setHeight
setScaleX
virtual void setScaleX | ( | int | scale , | ||
bool | updateData =false | ||||
) |
Sets a scaling factor to be multiplied on each X value added.
Since the graph only stores integer values internally, it is possible to set a scale to e.g. 1000 and make the graph work as if there are three digits of precision. The addDataPoint() will multiply the x argument with the scaling factor and store this value. Please note the addDataPointScaled, which allows adding a value that is assumed to have already been multiplied by the scaling factor. Other functions exist in a "scaled" version where the arguments are assumed to already be scaled.
By setting the scale to 1 it is possible to simply use integer values for the graph.
scale | The scaling factor. |
updateData | (Optional) True to update all existing x value. |
Reimplemented by: touchgfx::DynamicDataGraph::setScaleX, touchgfx::StaticDataGraph::setScaleX
setScaleY
virtual void setScaleY | ( | int | scale , | ||
bool | updateData =false | ||||
) |
Sets a scaling factor to be multiplied on each Y value added.
Since the graph only stores integer values internally, it is possible to set a scale to e.g. 1000 and make the graph work as if there are three digits of precision. The addDataPoint() will multiply the y argument with the scaling factor and store this value. Please note the addDataPointScaled, which allows adding a value that is assumed to have already been multiplied by the scaling factor. Other functions exist in a "scaled" version where the arguments are assumed to already be scaled.
By setting the scale to 1 it is possible to simply use integer values for the graph.
scale | The scaling factor. |
updateData | (Optional) True to update all existing y value. |
Reimplemented by: touchgfx::DynamicDataGraph::setScaleY, touchgfx::StaticDataGraph::setScaleY
setWidth
virtual void setWidth | ( | int16_t | width | ) | |
Sets the width of this drawable.
width | The new width. |
Note
For most Drawable widgets, changing this does normally not automatically yield a redraw.
Reimplements: touchgfx::Drawable::setWidth
convertToNewScale
static int convertToNewScale | ( | int | value , | ||
int | oldScale , | ||||
int | newScale | ||||
) |
Converts a value from one scale to another scale.
This would convert eg. 21 in scale 10 to 210 in scale 100 or to 2 in scale 1.
value | The value to convert to another scale. |
oldScale | The old (current) scale of the value. |
newScale | The new scale that the value should be converted to. |
The given data converted to a new scale.
float2scaled
static FORCE_INLINE_FUNCTION int float2scaled | ( | float | f , | ||
int | scale | ||||
) |
Multiply a floating point value with a constant and round the result.
f | the value to scale. |
scale | The scale. |
The product of the two numbers, rounded to nearest integer value.
int2scaled
static FORCE_INLINE_FUNCTION int int2scaled | ( | int | i , | ||
int | scale | ||||
) |
Multiply an integer value with a constant.
i | the value to scale. |
scale | The scale. |
The product of the two numbers.
scaled2float
static FORCE_INLINE_FUNCTION float scaled2float | ( | int | i , | ||
int | scale | ||||
) |
Divide a floating point number with a constant.
i | The number to divide. |
scale | The divisor (scale). |
The number divided by the scale.
scaled2int
static FORCE_INLINE_FUNCTION int scaled2int | ( | int | i , | ||
int | scale | ||||
) |
Divide an integer with a constant and round the result.
i | The number to divide. |
scale | The divisor (scale). |
The number divided by the scale, rounded to nearest integer.
Protected Functions Documentation
indexToScreenXQ5
virtual CWRUtil::Q5 indexToScreenXQ5 | ( | int16_t | index | ) | |
Gets screen x coordinate for a specific data point added to the graph.
index | The index of the element to get the x coordinate for. |
The screen x coordinate for the specific data point.
Reimplemented by: touchgfx::DynamicDataGraph::indexToScreenXQ5, touchgfx::StaticDataGraph::indexToScreenXQ5
indexToScreenYQ5
virtual CWRUtil::Q5 indexToScreenYQ5 | ( | int16_t | index | ) | |
Gets screen y coordinate for a specific data point added to the graph.
index | The index of the element to get the y coordinate for. |
The screen x coordinate for the specific data point.
Reimplemented by: touchgfx::DynamicDataGraph::indexToScreenYQ5, touchgfx::StaticDataGraph::indexToScreenYQ5
indexToXAxis
virtual int indexToXAxis | ( | const int | valueScaled , | const =0 | |
const int | labelScaled | const =0 | |||
) | const =0 |
Convert the given valueScaled (index) to x axis value.
valueScaled | The value scaled. |
labelScaled | The label scaled. |
The x axis value.
Reimplemented by: touchgfx::DynamicDataGraph::indexToXAxis, touchgfx::StaticDataGraph::indexToXAxis
invalidateAllXAxisPoints
void invalidateAllXAxisPoints | ( | ) |
Invalidate all x axis points.
Similar to invalidateXAxisPointAt, this function will iterate all visible x values and invalidate them in turn.
invalidateGraphArea
FORCE_INLINE_FUNCTION void invalidateGraphArea | ( | ) | const |
Invalidate entire graph area (the center of the graph).
This is often useful when a graph is cleared or the X or Y range is changed.
invalidateGraphPointAt
void invalidateGraphPointAt | ( | int16_t | index | ) | |
Invalidate point at a given index.
This will call the function invalidateGraphPointAt() on every element added to the graphArea which in turn is responsible for invalidating the part of the screen occupied by its element.
index | Zero-based index of the element to invalidate. |
invalidateXAxisPointAt
void invalidateXAxisPointAt | ( | int16_t | index | ) | |
Invalidate x axis point at the given index.
Since the y axis is often static, the x axis can change, and all labels need to be updated without redrawing the entire graph.
index | The x index to invalidate. |
updateAreasPosition
void updateAreasPosition | ( | ) |
Updates the position of all elements in all area after a change in size of the graph area and/or label padding.
Note
The entire graph area is invalidated.
valueToScreenXQ5
virtual CWRUtil::Q5 valueToScreenXQ5 | ( | int | x | ) | |
Gets screen x coordinate for an absolute value.
x | The x value. |
The screen x coordinate for the given value.
valueToScreenYQ5
virtual CWRUtil::Q5 valueToScreenYQ5 | ( | int | y | ) | |
Gets screen y coordinate for an absolute value.
y | The y value. |
The screen y coordinate for the given value.
xScreenRangeToIndexRange
virtual bool xScreenRangeToIndexRange | ( | int16_t | xMin , | const =0 | |
int16_t | xMax , | const =0 | |||
int16_t & | indexMin , | const =0 | |||
int16_t & | indexMax | const =0 | |||
) | const =0 |
Gets index range for screen x coordinate range taking the current graph range into account.
xMin | The low screen x coordinate. |
xMax | The high screen x coordinate. |
indexMin | The low element index. |
indexMax | The high element index. |
True if the range from low index to high index is legal.
Note
For internal use.
Reimplemented by: touchgfx::DynamicDataGraph::xScreenRangeToIndexRange, touchgfx::StaticDataGraph::xScreenRangeToIndexRange
Protected Attributes Documentation
alpha
uint8_t alpha
The alpha of the entire graph.
bottomArea
Container bottomArea
The area below the graph.
bottomPadding
int16_t bottomPadding
The graph area bottom padding.
clickAction
GenericCallback< const AbstractDataGraph &, const GraphClickEvent & > * clickAction
The callback to be executed when this Graph is clicked.
dragAction
GenericCallback< const AbstractDataGraph &, const GraphDragEvent & > * dragAction
The callback to be executed when this Graph is dragged.
gapBeforeIndex
int16_t gapBeforeIndex
The graph is disconnected (there is a gap) before this element index.
graphArea
Container graphArea
The graph area (the center area)
graphRangeMaxX
int graphRangeMaxX
The graph range maximum x coordinate.
graphRangeMaxY
int graphRangeMaxY
The graph range maximum y coordinate.
graphRangeMinX
int graphRangeMinX
The graph range minimum x coordinate.
graphRangeMinY
int graphRangeMinY
The graph range minimum y coordinate.
leftArea
Container leftArea
The area to the left of the graph.
leftPadding
int16_t leftPadding
The graph area left padding.
maxCapacity
int16_t maxCapacity
Maximum number of points in the graph.
rightArea
Container rightArea
The area to the right of the graph.
rightPadding
int16_t rightPadding
The graph area right padding.
topArea
Container topArea
The area above the graph.
topPadding
int16_t topPadding
The graph area top padding.
usedCapacity
int16_t usedCapacity
The number of used points in the graph.
xScale
int xScale
The data scale for the x values.
yScale
int yScale
The data scale for the y values.