|
QTradingView 1.0.0
A high-performance charting library built with C++ and Qt.
|
Manages the visible range and pixel mapping for chart bars. More...
#include <ViewPort.h>
Public Member Functions | |
| ViewPort () | |
| Constructs an empty ViewPort. | |
| ViewPort (int startIndex, int endIndex, const QRectF &pixelRect, double barWidth=8.0) | |
| Constructs a ViewPort with specified range, pixel rectangle, and bar width. | |
| void | setVisibleRange (int start, int end) |
| Sets the visible range of bar indices. | |
| int | startIndex () const |
| Returns the index of the first visible bar. | |
| int | endIndex () const |
| Returns the index of the last visible bar. | |
| int | visibleCount () const |
| Returns the number of visible bars in the viewport. | |
| void | setPixelRect (const QRectF &rect) |
| Sets the pixel rectangle for the viewport area. | |
| QRectF | pixelRect () const |
| Returns the pixel rectangle of the viewport. | |
| double | indexToPixel (int index) const |
| Converts a bar index to its pixel position within the viewport. | |
| int | pixelToIndex (double pixel) const |
| Converts a pixel position to the corresponding bar index. | |
| void | setBarWidth (double width) |
| Sets the width of each bar in pixels. | |
| double | barWidth () const |
| Returns the width of each bar in pixels. | |
Manages the visible range and pixel mapping for chart bars.
ViewPort controls which data indices are visible, their pixel positions, and the bar width for rendering. It provides conversion between data indices and pixel coordinates, and supports dynamic resizing and zooming.
| QTradingView::ViewPort::ViewPort | ( | int | startIndex, |
| int | endIndex, | ||
| const QRectF & | pixelRect, | ||
| double | barWidth = 8.0 |
||
| ) |
Constructs a ViewPort with specified range, pixel rectangle, and bar width.
| startIndex | Index of the first visible bar. |
| endIndex | Index of the last visible bar. |
| pixelRect | Rectangle area in pixels for the viewport. |
| barWidth | Width of each bar in pixels (default 8.0). |
| double QTradingView::ViewPort::indexToPixel | ( | int | index | ) | const |
Converts a bar index to its pixel position within the viewport.
| index | Bar index to convert. |
| int QTradingView::ViewPort::pixelToIndex | ( | double | pixel | ) | const |
Converts a pixel position to the corresponding bar index.
| pixel | Pixel position to convert. |
| void QTradingView::ViewPort::setBarWidth | ( | double | width | ) |
Sets the width of each bar in pixels.
| width | Bar width in pixels. |
| void QTradingView::ViewPort::setPixelRect | ( | const QRectF & | rect | ) |
Sets the pixel rectangle for the viewport area.
| rect | Rectangle area in pixels. |
| void QTradingView::ViewPort::setVisibleRange | ( | int | start, |
| int | end | ||
| ) |
Sets the visible range of bar indices.
| start | Index of the first visible bar. |
| end | Index of the last visible bar. |