QTradingView 1.0.0
A high-performance charting library built with C++ and Qt.
Loading...
Searching...
No Matches
QTradingView::BarSeries Class Reference

Represents a bar chart series in QTradingView. More...

#include <BarSeries.h>

Inheritance diagram for QTradingView::BarSeries:
QTradingView::Series

Public Member Functions

 BarSeries (const QList< DataPoint > &data={})
 Constructs a BarSeries with optional initial data.
 
 ~BarSeries () override
 Destroys the BarSeries object.
 
void setData (const QList< DataPoint > &data)
 Sets the bar data for the series.
 
const QList< DataPoint > & data () const
 Returns the current bar data.
 
qint64 timestampAt (int index) const override
 Returns the timestamp for the bar at the given index.
 
int dataCount () const override
 Returns the number of bars in the series.
 
void setUpColor (const QColor &color)
 Sets the color for upward bars.
 
void setDownColor (const QColor &color)
 Sets the color for downward bars.
 
void setBarWidthRatio (double ratio)
 Sets the width ratio for bars.
 
void setLineWidth (double width)
 Sets the line width for the bars.
 
void setAntialiasing (bool enabled)
 Enables or disables antialiasing for bar rendering.
 
void render (QPainter *painter, const ViewPort &viewport, IScale *scale) override
 Renders the series within the given viewport and scale.
 
bool hitTest (const QPointF &point, int &outIndex) const override
 Performs hit testing to find the nearest data point to the given position.
 
void calculateRange (int startIndex, int endIndex, double &outMin, double &outMax) const override
 Calculates the data range (min/max values) within the given index range.
 
- Public Member Functions inherited from QTradingView::Series
 Series (SeriesType type)
 Constructs a Series of the given type.
 
virtual ~Series ()=default
 Virtual destructor for Series.
 
SeriesType type () const
 Returns the type of the series.
 

Additional Inherited Members

- Protected Attributes inherited from QTradingView::Series
SeriesType m_type
 

Detailed Description

Represents a bar chart series in QTradingView.

BarSeries manages a collection of bar data and renders them as a bar chart. Supports data updates and style customization.

Constructor & Destructor Documentation

◆ BarSeries()

QTradingView::BarSeries::BarSeries ( const QList< DataPoint > &  data = {})
explicit

Constructs a BarSeries with optional initial data.

Parameters
dataList of DataPoint objects.

Member Function Documentation

◆ calculateRange()

void QTradingView::BarSeries::calculateRange ( int  startIndex,
int  endIndex,
double &  outMin,
double &  outMax 
) const
overridevirtual

Calculates the data range (min/max values) within the given index range.

Parameters
startIndexStart index of the range.
endIndexEnd index of the range.
outMinOutput parameter for the minimum value.
outMaxOutput parameter for the maximum value.

Implements QTradingView::Series.

◆ data()

const QList< DataPoint > & QTradingView::BarSeries::data ( ) const

Returns the current bar data.

Returns
List of DataPoint objects.

◆ dataCount()

int QTradingView::BarSeries::dataCount ( ) const
overridevirtual

Returns the number of bars in the series.

Returns
Bar count.

Implements QTradingView::Series.

◆ hitTest()

bool QTradingView::BarSeries::hitTest ( const QPointF &  point,
int &  outIndex 
) const
overridevirtual

Performs hit testing to find the nearest data point to the given position.

Parameters
pointPosition to test.
outIndexOutput parameter for the nearest data point index.
Returns
True if a data point was hit, false otherwise.

Implements QTradingView::Series.

◆ render()

void QTradingView::BarSeries::render ( QPainter *  painter,
const ViewPort viewport,
IScale scale 
)
overridevirtual

Renders the series within the given viewport and scale.

Parameters
painterQPainter instance for drawing.
viewportViewport defining the area to render.
scaleScale used for rendering.

Implements QTradingView::Series.

◆ setAntialiasing()

void QTradingView::BarSeries::setAntialiasing ( bool  enabled)

Enables or disables antialiasing for bar rendering.

Parameters
enabledAntialiasing flag.

◆ setBarWidthRatio()

void QTradingView::BarSeries::setBarWidthRatio ( double  ratio)

Sets the width ratio for bars.

Parameters
ratioRatio of bar width to total width.

◆ setData()

void QTradingView::BarSeries::setData ( const QList< DataPoint > &  data)

Sets the bar data for the series.

Parameters
dataList of DataPoint objects.

◆ setDownColor()

void QTradingView::BarSeries::setDownColor ( const QColor &  color)

Sets the color for downward bars.

Parameters
colorDownward bar color.

◆ setLineWidth()

void QTradingView::BarSeries::setLineWidth ( double  width)

Sets the line width for the bars.

Parameters
widthLine width in pixels.

◆ setUpColor()

void QTradingView::BarSeries::setUpColor ( const QColor &  color)

Sets the color for upward bars.

Parameters
colorUpward bar color.

◆ timestampAt()

qint64 QTradingView::BarSeries::timestampAt ( int  index) const
overridevirtual

Returns the timestamp for the bar at the given index.

Parameters
indexBar index.
Returns
Timestamp in milliseconds.

Implements QTradingView::Series.


The documentation for this class was generated from the following files: