JKQTPlotter trunk/v5.0.0
an extensive Qt5+Qt6 Plotter framework (including a feature-richt plotter widget, a speed-optimized, but limited variant and a LaTeX equation renderer!), written fully in C/C++ and without external dependencies
Loading...
Searching...
No Matches

This class draws an Open-High-Low-Close (OHLC) or candle-stick graph typically representing financial data. More...

#include <jkqtpfinancial.h>

Inheritance diagram for JKQTPFinancialGraph:
[legend]
Collaboration diagram for JKQTPFinancialGraph:
[legend]

Public Types

enum  FinancialGraphType {
  CandleStick ,
  OHLC
}
 types of financial graphs that can be drawn by this class More...
 
- Public Types inherited from JKQTPXGraph
enum  DataSortOrder {
  Unsorted =0 ,
  SortedX =1
}
 specifies how to sort the data in a JKQTPXGraph before drawing More...
 
- Public Types inherited from JKQTPPlotElement
enum  HitTestMode {
  HitTestXY ,
  HitTestXOnly ,
  HitTestYOnly
}
 modes of operation for the function hitTest() More...
 

Public Slots

virtual void autoscaleBoxWidthAndShift (double maxWidth=0.8, double shrinkFactor=0.8)
 finds all financial charts of the same orientation and determines width and shift, so they stand side by side
 
void autoscaleBoxWidthAndShiftSeparatedGroups (double groupWidth=0.65)
 equivalent to autoscaleBoxWidthAndShift(groupWidth,0.8);
 
void setCandlestickOneColor (QColor cLine)
 sets graphType = FinancialGraphType::CandleStick and sets one color cLine for positive and negative items, where positive items are unfilled and negative items are filled
 
void setCandlestickTwoColor (QColor cPositive, QColor cNegative)
 sets graphType = FinancialGraphType::CandleStick and sets the positive and negative color (for fill and line equal!)
 
void setCandlestickTwoColor (QColor cPositive, QColor cNegative, QColor lineCOlor)
 sets graphType = FinancialGraphType::CandleStick and sets the positive and negative fill color and a single line-color
 
void setCloseColumn (int __value)
 column for the "Close" value of the financial graph
 
void setCloseColumn (size_t __value)
 column for the "Close" value of the financial graph
 
virtual void setColor (QColor cPositive, QColor cNegative)
 set outline and fill color at the same time, for both positive and negative boxes
 
virtual void setColor (QColor linePositive, QColor fillPositive, QColor lineNegative, QColor fillNegative)
 set outline and fill color at the same time, for both positive and negative boxes
 
void setGraphType (FinancialGraphType __value)
 type of the financial graph (OHLC or candle-stick)
 
void setHighColumn (int __value)
 column for the "High" value of the financial graph
 
void setHighColumn (size_t __value)
 column for the "High" value of the financial graph
 
void setLowColumn (int __value)
 column for the "Low" value of the financial graph
 
void setLowColumn (size_t __value)
 column for the "Low" value of the financial graph
 
void setOHLCTwoColor (QColor cPositive, QColor cNegative)
 sets graphType = FinancialGraphType::OHLC and sets the positive and negative color (for fill and line equal!)
 
void setOpenColumn (int __value)
 column for the "Open" value of the financial graph
 
void setOpenColumn (size_t __value)
 column for the "Open" value of the financial graph
 
void setShift (double __value)
 the shift of the boxes, relative to the distance between the current and the next x-value
 
void setWidth (double __value)
 the width of the boxes, relative to the distance between the current and the next x-value
 
- Public Slots inherited from JKQTPXGraph
void setDataSortOrder (DataSortOrder __value)
 if !=Unsorted, the data is sorted before plotting
 
void setDataSortOrder (int __value)
 if !=Unsorted, the data is sorted before plotting
 
virtual void setKeyColumn (int __value)
 sets the column used as "key" for the current graph (typically this call setXColumn(), but for horizontal graphs like filled curves or barcharts it may call setYColumn() )
 
void setXColumn (int __value)
 the column that contains the x-component of the datapoints
 
void setXColumn (size_t __value)
 the column that contains the x-component of the datapoints
 
- Public Slots inherited from JKQTPPlotElement
void setHighlighted (bool __value)
 sets whether the graph is drawn in a highlighted style in the plot

 
virtual void setTitle (const QString &__value)
 sets the title of the plot (for display in key!).
 
void setVisible (bool __value)
 sets whether the graph is visible in the plot

 

Public Member Functions

 JKQTPFinancialGraph (JKQTBasePlotter *parent=nullptr)
 class constructor
 
 JKQTPFinancialGraph (JKQTPlotter *parent)
 class constructor
 
virtual void draw (JKQTPEnhancedPainter &painter) override
 plots the graph to the plotter object specified as parent
 
virtual void drawKeyMarker (JKQTPEnhancedPainter &painter, const QRectF &rect) override
 plots a key marker inside the specified rectangle rect
 
JKQTPGraphFillStyleMixinfillStyleNegative ()
 fill style for negative items (close<open)
 
const JKQTPGraphFillStyleMixinfillStyleNegative () const
 fill style for negative items (close<open)
 
JKQTPGraphFillStyleMixinfillStylePositive ()
 fill style for positive items (close>open)
 
const JKQTPGraphFillStyleMixinfillStylePositive () const
 fill style for positive items (close>open)
 
int getCloseColumn () const
 column for the "Close" value of the financial graph
 
FinancialGraphType getGraphType () const
 type of the financial graph (OHLC or candle-stick)
 
int getHighColumn () const
 column for the "High" value of the financial graph
 
virtual bool getIndexRange (int &imin, int &imax) const override
 determines the range of row indexes available in the data columns of this graph
 
virtual QColor getKeyLabelColor () const override
 returns the color to be used for the key label
 
int getLowColumn () const
 column for the "Low" value of the financial graph
 
int getOpenColumn () const
 column for the "Open" value of the financial graph
 
double getShift () const
 the shift of the boxes, relative to the distance between the current and the next x-value
 
double getWidth () const
 the width of the boxes, relative to the distance between the current and the next x-value
 
virtual bool getYMinMax (double &miny, double &maxy, double &smallestGreaterZero) override
 get the maximum and minimum y-value of the graph
 
JKQTPGraphLineStyleMixinlineStyleNegative ()
 fill style for negative items (close<open)
 
const JKQTPGraphLineStyleMixinlineStyleNegative () const
 fill style for negative items (close<open)
 
JKQTPGraphLineStyleMixinlineStylePositive ()
 fill style for positive items (close>open)
 
const JKQTPGraphLineStyleMixinlineStylePositive () const
 fill style for positive items (close>open)
 
virtual bool usesColumn (int column) const override
 returns true if the given column is used by the graph
 
- Public Member Functions inherited from JKQTPXGraph
 JKQTPXGraph (JKQTBasePlotter *parent=nullptr)
 class constructor
 
DataSortOrder getDataSortOrder () const
 if !=Unsorted, the data is sorted before plotting
 
virtual int getKeyColumn () const
 returns the column used as "key" for the current graph (typically this call getXColumn(), but for horizontal graphs like filled curves or barcharts it may call getYColumn() )
 
int getXColumn () const
 the column that contains the x-component of the datapoints
 
virtual bool getXMinMax (double &minx, double &maxx, double &smallestGreaterZero) override
 get the maximum and minimum x-value of the graph
 
- Public Member Functions inherited from JKQTPGraph
 JKQTPGraph (JKQTBasePlotter *parent=nullptr)
 class constructor
 
virtual ~JKQTPGraph ()=default
 default wirtual destructor
 
- Public Member Functions inherited from JKQTPPlotElement
 JKQTPPlotElement (JKQTBasePlotter *parent=nullptr)
 class constructor
 
virtual ~JKQTPPlotElement ()=default
 default wirtual destructor
 
QPointF backTransform (const QPointF &x) const
 tool routine that back-transforms a QPointF according to the parent's transformation rules (pixels --> plot coordinate)
 
QPointF backTransform (double x, double y) const
 tool routine that back-transforms a QPointF according to the parent's transformation rules (pixels --> plot coordinate)
 
double backtransformX (double x) const
 tool routine that backtransforms an x-coordinate (pixels --> plot coordinate) for this plot element, uses the axis referenced in xAxisRef
 
double backtransformY (double y) const
 tool routine that backtransforms a y-coordinate (pixels --> plot coordinate) for this plot element, uses the axis referenced in yAxisRef
 
virtual void drawOutside (JKQTPEnhancedPainter &painter, QRect leftSpace, QRect rightSpace, QRect topSpace, QRect bottomSpace)
 plots outside the actual plot field of view (e.g. color bars, scale bars, ...)
 
QImage generateKeyMarker (QSize size=QSize(16, 16))
 returns an image with a key marker inside

 
virtual void getOutsideSize (JKQTPEnhancedPainter &painter, int &leftSpace, int &rightSpace, int &topSpace, int &bottomSpace)
 if the graph plots outside the actual plot field of view (e.g. color bars, scale bars, ...)
 
JKQTBasePlottergetParent ()
 returns the parent painter class
 
const JKQTBasePlottergetParent () const
 returns the parent painter class
 
QString getTitle () const
 returns the the title of the plot

 
const JKQTPCoordinateAxisgetXAxis () const
 returns the actual x-Axis-object from the parent plotter, referenced in xAxisRef
 
JKQTPCoordinateAxisRef getXAxisRef () const
 indicates which coordinate axis to use for coordinate transforms in x-direction
 
const JKQTPCoordinateAxisgetYAxis () const
 returns the actual y-Axis-object from the parent plotter, referenced in yAxisRef
 
JKQTPCoordinateAxisRef getYAxisRef () const
 indicates which coordinate axis to use for coordinate transforms in y-direction
 
virtual double hitTest (const QPointF &posSystem, QPointF *closestSpotSystem=nullptr, QString *label=nullptr, HitTestMode mode=HitTestXY) const
 returns the closest distance of the plot element to the (screen pixel) position pos, or NAN
 
bool isHighlighted () const
 returns whether the graph is shown in a highlighted style in the plot

 
bool isVisible () const
 returns whether the graph is visible in the plot

 
void setAxes (JKQTPCoordinateAxisRef ref)
 set the coordinate axes to use for this plot element
 
virtual void setParent (JKQTBasePlotter *parent)
 sets the parent painter class
 
virtual void setParent (JKQTPlotter *parent)
 sets the parent painter class
 
void setXAxis (JKQTPCoordinateAxisRef ref)
 indicates which coordinate axis to use for coordinate transforms in x-direction
 
void setYAxis (JKQTPCoordinateAxisRef ref)
 indicates which coordinate axis to use for coordinate transforms in y-direction
 
QPointF transform (const QPointF &x) const
 tool routine that transforms a QPointF according to the parent's transformation rules (plot coordinate --> pixels)
 
QPolygonF transform (const QPolygonF &x) const
 tool routine that transforms a QPolygonF according to the parent's transformation rules (plot coordinate --> pixels)
 
QPointF transform (double x, double y) const
 tool routine that transforms a QPointF according to the parent's transformation rules (plot coordinate --> pixels)
 
QPainterPath transformToLinePath (const QPolygonF &x) const
 tool routine that transforms a QPolygonF according to the parent's transformation rules and returns a (non-closed) path consisting of lines (plot coordinate --> pixels)
 
QVector< double > transformX (const QVector< double > &x) const
 transform all x-coordinates in a vector x
 
double transformX (double x) const
 tool routine that transforms an x-coordinate (plot coordinate --> pixels) for this plot element, uses the axis referenced in xAxisRef
 
QVector< double > transformY (const QVector< double > &x) const
 transform all y-coordinates in a vector x
 
double transformY (double y) const
 tool routine that transforms a y-coordinate (plot coordinate --> pixels) for this plot element, uses the axis referenced in yAxisRef
 

Static Public Member Functions

static void clearColorAssignStore ()
 

Protected Member Functions

virtual bool considerForAutoscaling (JKQTPFinancialGraph *other) const
 this function is used by autoscaleBoxWidthAndShift() to determine whether a given graph shall be taken into account when autoscaling. Typically this returns true for all JKQTPFinancialGraph-derved objects with the same orientation (horizontal or vertical, i.e. currently all)
 
- Protected Member Functions inherited from JKQTPXGraph
int getDataIndex (int i) const
 returns the index of the i-th datapoint (where i is an index into the SORTED datapoints)
 
virtual void intSortData ()
 sorts data according to the specified criterion in sortData ... The result is stored as a index-map in sorted Indices
 
- Protected Member Functions inherited from JKQTPGraph
virtual void drawErrorsAfter (JKQTPEnhancedPainter &)
 this function is used to plot error inidcators after plotting the graphs.
 
virtual void drawErrorsBefore (JKQTPEnhancedPainter &)
 this function is used to plot error inidcators before plotting the graphs.
 
bool getDataMinMax (int column, double &minx, double &maxx, double &smallestGreaterZero)
 get the maximum and minimum value of the given column
 
- Protected Member Functions inherited from JKQTPPlotElement
void addHitTestData (const HitTestLocation &loc)
 clear the internal datastore for hitTest()
 
void addHitTestData (const QPointF &pos_, const QString &label_)
 clear the internal datastore for hitTest()
 
void addHitTestData (const QPointF &pos_, int index_, const QString &label_)
 clear the internal datastore for hitTest()
 
void addHitTestData (const QPointF &pos_, int index_=-1, const JKQTPDatastore *datastore=nullptr)
 clear the internal datastore for hitTest(), this variant uses formatHitTestDefaultLabel() to auto-generate the label
 
void addHitTestData (double x_, double y_, const QString &label_)
 add a new point on the graph to the internal datastore for hitTest()
 
void addHitTestData (double x_, double y_, int index_, const QString &label_)
 clear the internal datastore for hitTest()
 
void addHitTestData (double x_, double y_, int index_=-1, const JKQTPDatastore *datastore=nullptr)
 add a new point on the graph to the internal datastore for hitTest(), this variant uses formatHitTestDefaultLabel() to auto-generate the label
 
void clearHitTestData ()
 clear the internal datastore for hitTest()
 
virtual QString formatHitTestDefaultLabel (double x, double y, int index=-1, const JKQTPDatastore *datastore=nullptr) const
 tool-function for hitTest(), which formats a default label, taking into account the x- and y-position (both provided) and optionally the errors of these positions.
 
void reserveHitTestData (int points)
 reserve list entries for up to points graph points in the internal datastore for hitTest()
 
QString xFloatToString (double v, int past_comma=-1) const
 converts a x-value v into a string, taking into account the type of x-axis
 
QString yFloatToString (double v, int past_comma=-1) const
 converts a x-value v into a string, taking into account the type of x-axis
 

Protected Attributes

JKQTPGraphFillStyleMixin m_fillStyleNegative
 fill style for negative items (close<open)
 
JKQTPGraphFillStyleMixin m_fillStylePositive
 fill style for positive items (close>open)
 
JKQTPGraphLineStyleMixin m_lineStyleNegative
 fill style for negative items (close<open)
 
JKQTPGraphLineStyleMixin m_lineStylePositive
 fill style for positive items (close>open)
 
double shift
 the shift of the boxes, relative to the distance between the current and the next x-value
 
double width
 the width of the boxes, relative to the distance between the current and the next x-value
 
- Protected Attributes inherited from JKQTPXGraph
QVector< int > sortedIndices
 this array contains the order of indices, in which to access the data in the data columns
 
- Protected Attributes inherited from JKQTPPlotElement
QVector< HitTestLocationm_hitTestData
 dataset with graph-points and associated data from the function hitTest()
 
JKQTBasePlotterparent
 the plotter object this object belongs to
 
int parentPlotStyle
 internal storage for the used parent plot style
 

Static Protected Attributes

static QSet< JKQTBasePlotter * > parentsAlreadySeen
 

Properties

int closeColumn
 column for the "Close" value of the financial graph
 
FinancialGraphType graphType
 type of the financial graph (OHLC or candle-stick)
 
int highColumn
 column for the "High" value of the financial graph
 
int lowColumn
 column for the "Low" value of the financial graph
 
int openColumn
 column for the "Open" value of the financial graph
 
- Properties inherited from JKQTPXGraph
DataSortOrder sortData
 if !=Unsorted, the data is sorted before plotting
 
int xColumn
 the column that contains the x-component of the datapoints
 
- Properties inherited from JKQTPPlotElement
bool highlighted
 indicates whether the graph is shown in a "highlghted" in the plot
 
QString title
 title of the plot (for display in key!). If no title is supplied, no key entry is drawn.
 
bool visible
 indicates whether the graph is visible in the plot
 
JKQTPCoordinateAxisRef xAxisRef
 indicates which coordinate axis to use for coordinate transforms in x-direction
 
JKQTPCoordinateAxisRef yAxisRef
 indicates which coordinate axis to use for coordinate transforms in y-direction
 

Detailed Description

This class draws an Open-High-Low-Close (OHLC) or candle-stick graph typically representing financial data.

This graph draws either candlstick charts:

or Open-High-Low-Close (OHLC) charts (depending on what you set in setGraphType() ).

Here is an example graph showcasing both variants:

See also
For details on the graph types see https://en.wikipedia.org/wiki/Candlestick_chart and https://en.wikipedia.org/wiki/Open-high-low-close_chart
JKQTPXGraph

Styling the Financial Graphs

You can control the type of graph and it's appearance with these functions (example images are in the documentation of the functions):

For fine-tuning, you can access the line- and fill-styles for positiove (close>open) and negative (close<open) items separately via:

Note that the width of the single elements for each x-value is automatically from the distance to the next neighbours. Here set parameter width (setWidth(), getWidth() ) is employed. It sets the relative amount of space that an element occupies in its part of the graph. Typically the default width is 0.8 (or 80%).

Several Financial Graphs side-by-side

In case you want to display several of these graphs in the same plot, you can make them appear side-by-side, even if they all cover the same x-values and would thus be draw atop each other. We apply the same principles that were used for barcharts in JKQTPBarGraphBase and add a shift-parameter (setShift() ) that shifts each element in the available space:

For example for two financial graph elements per x-value one would set:

*        width=0.4
*        shift=-0.5 / +0.5
*  

Two functions are provided (JKQTPFinancialGraph::autoscaleBoxWidthAndShift(), JKQTPFinancialGraph::autoscaleBoxWidthAndShiftSeparatedGroups() ) that can be applied to any JKQTPFinancialGraph in the plot and will calculate all JKQTPFinancialGraphs' shift and width parameter in such a way that the graphs appear tidied up into groups by x-value. With these functions you don't have to calculate the shift and width values by hand! A call always only affects the JKQTPFinancialGraph in the plot with the same orientation (vertical or horizontal).

Member Enumeration Documentation

◆ FinancialGraphType

types of financial graphs that can be drawn by this class

Enumerator
CandleStick 

candlestick graphs

OHLC 

OHLC (Open-High-Low-Close) graphs.

Constructor & Destructor Documentation

◆ JKQTPFinancialGraph() [1/2]

JKQTPFinancialGraph::JKQTPFinancialGraph ( JKQTBasePlotter parent = nullptr)

class constructor

◆ JKQTPFinancialGraph() [2/2]

JKQTPFinancialGraph::JKQTPFinancialGraph ( JKQTPlotter parent)

class constructor

Member Function Documentation

◆ autoscaleBoxWidthAndShift

virtual void JKQTPFinancialGraph::autoscaleBoxWidthAndShift ( double  maxWidth = 0.8,
double  shrinkFactor = 0.8 
)
virtualslot

finds all financial charts of the same orientation and determines width and shift, so they stand side by side

Parameters
maxWidththe maximum (relative) width, that all boxes will span of the (doubled) inter-box distance
shrinkFactorfactor, by which the boxes are shrinked compared to the available space
Note
This function will scale ALL graphs of the parent plot, which were derived from JKQTPFinancialGraph, that match in orientation (currently all).

◆ autoscaleBoxWidthAndShiftSeparatedGroups

void JKQTPFinancialGraph::autoscaleBoxWidthAndShiftSeparatedGroups ( double  groupWidth = 0.65)
slot

equivalent to autoscaleBoxWidthAndShift(groupWidth,0.8);

◆ clearColorAssignStore()

static void JKQTPFinancialGraph::clearColorAssignStore ( )
static

◆ considerForAutoscaling()

virtual bool JKQTPFinancialGraph::considerForAutoscaling ( JKQTPFinancialGraph other) const
protectedvirtual

this function is used by autoscaleBoxWidthAndShift() to determine whether a given graph shall be taken into account when autoscaling. Typically this returns true for all JKQTPFinancialGraph-derved objects with the same orientation (horizontal or vertical, i.e. currently all)

◆ draw()

virtual void JKQTPFinancialGraph::draw ( JKQTPEnhancedPainter painter)
overridevirtual

plots the graph to the plotter object specified as parent

Implements JKQTPPlotElement.

◆ drawKeyMarker()

virtual void JKQTPFinancialGraph::drawKeyMarker ( JKQTPEnhancedPainter painter,
const QRectF &  rect 
)
overridevirtual

plots a key marker inside the specified rectangle rect

Implements JKQTPPlotElement.

◆ fillStyleNegative() [1/2]

JKQTPGraphFillStyleMixin & JKQTPFinancialGraph::fillStyleNegative ( )

fill style for negative items (close<open)

See also
fillStyleNegative()

◆ fillStyleNegative() [2/2]

const JKQTPGraphFillStyleMixin & JKQTPFinancialGraph::fillStyleNegative ( ) const

fill style for negative items (close<open)

See also
fillStyleNegative()

◆ fillStylePositive() [1/2]

JKQTPGraphFillStyleMixin & JKQTPFinancialGraph::fillStylePositive ( )

fill style for positive items (close>open)

See also
fillStylePositive()

◆ fillStylePositive() [2/2]

const JKQTPGraphFillStyleMixin & JKQTPFinancialGraph::fillStylePositive ( ) const

fill style for positive items (close>open)

See also
fillStylePositive()

◆ getCloseColumn()

int JKQTPFinancialGraph::getCloseColumn ( ) const

column for the "Close" value of the financial graph

See also
setCloseColumn(), getCloseColumn()

◆ getGraphType()

FinancialGraphType JKQTPFinancialGraph::getGraphType ( ) const

type of the financial graph (OHLC or candle-stick)

See also
setGraphType(), getGraphType(), FinancialGraphType

◆ getHighColumn()

int JKQTPFinancialGraph::getHighColumn ( ) const

column for the "High" value of the financial graph

See also
setHighColumn(), getHighColumn()

◆ getIndexRange()

virtual bool JKQTPFinancialGraph::getIndexRange ( int &  imin,
int &  imax 
) const
overridevirtual

determines the range of row indexes available in the data columns of this graph

Parameters
[out]iminfirst usable row-index
[out]imaxlast usable row-index
Returns
true on success and false if the information is not available

Reimplemented from JKQTPXGraph.

◆ getKeyLabelColor()

virtual QColor JKQTPFinancialGraph::getKeyLabelColor ( ) const
overridevirtual

returns the color to be used for the key label

Implements JKQTPPlotElement.

◆ getLowColumn()

int JKQTPFinancialGraph::getLowColumn ( ) const

column for the "Low" value of the financial graph

See also
setLowColumn(), getLowColumn()

◆ getOpenColumn()

int JKQTPFinancialGraph::getOpenColumn ( ) const

column for the "Open" value of the financial graph

See also
setOpenColumn(), getOpenColumn()

◆ getShift()

double JKQTPFinancialGraph::getShift ( ) const

the shift of the boxes, relative to the distance between the current and the next x-value

See the following graphic to understand this concept (same principle as described in the JKQTPBarGraphBase documentation):

◆ getWidth()

double JKQTPFinancialGraph::getWidth ( ) const

the width of the boxes, relative to the distance between the current and the next x-value

See the following graphic to understand this concept (same principle as described in the JKQTPBarGraphBase documentation):

◆ getYMinMax()

virtual bool JKQTPFinancialGraph::getYMinMax ( double &  miny,
double &  maxy,
double &  smallestGreaterZero 
)
overridevirtual

get the maximum and minimum y-value of the graph

The result is given in the two parameters which are call-by-reference parameters!

Parameters
[out]minyminimal y-value used in the graph
[out]maxymaximal y-value used in the graph
[out]smallestGreaterZerothe smalles y-value in the graph, which is larger than 0 (this is used in auto-sizing for logarithmic axes)
Returns
true on success, i.e. if there were datapoints in the plot, or false on failure (e.g. when the graph is empty)

Implements JKQTPPlotElement.

◆ lineStyleNegative() [1/2]

JKQTPGraphLineStyleMixin & JKQTPFinancialGraph::lineStyleNegative ( )

fill style for negative items (close<open)

See also
lineStyleNegative()

◆ lineStyleNegative() [2/2]

const JKQTPGraphLineStyleMixin & JKQTPFinancialGraph::lineStyleNegative ( ) const

fill style for negative items (close<open)

See also
lineStyleNegative()

◆ lineStylePositive() [1/2]

JKQTPGraphLineStyleMixin & JKQTPFinancialGraph::lineStylePositive ( )

fill style for positive items (close>open)

See also
lineStylePositive()

◆ lineStylePositive() [2/2]

const JKQTPGraphLineStyleMixin & JKQTPFinancialGraph::lineStylePositive ( ) const

fill style for positive items (close>open)

See also
lineStylePositive()

◆ setCandlestickOneColor

void JKQTPFinancialGraph::setCandlestickOneColor ( QColor  cLine)
slot

sets graphType = FinancialGraphType::CandleStick and sets one color cLine for positive and negative items, where positive items are unfilled and negative items are filled

Parameters
cLineline-color for all items and also fill-color for positive items (close>open), negative items are unfilled

Here is an example output for setCandlestickOneColor(QColor("black")):

◆ setCandlestickTwoColor [1/2]

void JKQTPFinancialGraph::setCandlestickTwoColor ( QColor  cPositive,
QColor  cNegative 
)
slot

sets graphType = FinancialGraphType::CandleStick and sets the positive and negative color (for fill and line equal!)

Parameters
cPositivecolor for positive items (close>open)
cNegativecolor for negative items (close<open)

Here is an example output for setCandlestickTwoColor(QColor("blue"), QColor("orange")):

◆ setCandlestickTwoColor [2/2]

void JKQTPFinancialGraph::setCandlestickTwoColor ( QColor  cPositive,
QColor  cNegative,
QColor  lineCOlor 
)
slot

sets graphType = FinancialGraphType::CandleStick and sets the positive and negative fill color and a single line-color

Parameters
cPositivecolor for fill of positive items (close>open)
cNegativecolor for fill of negative items (close<open)

Here is an example output for setCandlestickTwoColor(QColor("green"), QColor("red"), QColor("black")):

◆ setCloseColumn [1/2]

void JKQTPFinancialGraph::setCloseColumn ( int  __value)
slot

column for the "Close" value of the financial graph

See also
setCloseColumn(), getCloseColumn()

◆ setCloseColumn [2/2]

void JKQTPFinancialGraph::setCloseColumn ( size_t  __value)
slot

column for the "Close" value of the financial graph

See also
setCloseColumn(), getCloseColumn()

◆ setColor [1/2]

virtual void JKQTPFinancialGraph::setColor ( QColor  cPositive,
QColor  cNegative 
)
virtualslot

set outline and fill color at the same time, for both positive and negative boxes

Parameters
cPositivecolor for positive items (close>open)
cNegativecolor for negative items (close<open)

◆ setColor [2/2]

virtual void JKQTPFinancialGraph::setColor ( QColor  linePositive,
QColor  fillPositive,
QColor  lineNegative,
QColor  fillNegative 
)
virtualslot

set outline and fill color at the same time, for both positive and negative boxes

Parameters
linePositiveline-color for positive items (close>open)
fillPositivefill-color for positive items (close>open)
lineNegativeline-color for negative items (close<open)
fillNegativefill-color for negative items (close<open)

◆ setGraphType

void JKQTPFinancialGraph::setGraphType ( FinancialGraphType  __value)
slot

type of the financial graph (OHLC or candle-stick)

See also
setGraphType(), getGraphType(), FinancialGraphType

◆ setHighColumn [1/2]

void JKQTPFinancialGraph::setHighColumn ( int  __value)
slot

column for the "High" value of the financial graph

See also
setHighColumn(), getHighColumn()

◆ setHighColumn [2/2]

void JKQTPFinancialGraph::setHighColumn ( size_t  __value)
slot

column for the "High" value of the financial graph

See also
setHighColumn(), getHighColumn()

◆ setLowColumn [1/2]

void JKQTPFinancialGraph::setLowColumn ( int  __value)
slot

column for the "Low" value of the financial graph

See also
setLowColumn(), getLowColumn()

◆ setLowColumn [2/2]

void JKQTPFinancialGraph::setLowColumn ( size_t  __value)
slot

column for the "Low" value of the financial graph

See also
setLowColumn(), getLowColumn()

◆ setOHLCTwoColor

void JKQTPFinancialGraph::setOHLCTwoColor ( QColor  cPositive,
QColor  cNegative 
)
slot

sets graphType = FinancialGraphType::OHLC and sets the positive and negative color (for fill and line equal!)

Parameters
cPositivecolor for positive items (close>open)
cNegativecolor for negative items (close<open)

Here is an example output for setOHLCTwoColor(QColor("darkblue"), QColor("darkorange")):

◆ setOpenColumn [1/2]

void JKQTPFinancialGraph::setOpenColumn ( int  __value)
slot

column for the "Open" value of the financial graph

See also
setOpenColumn(), getOpenColumn()

◆ setOpenColumn [2/2]

void JKQTPFinancialGraph::setOpenColumn ( size_t  __value)
slot

column for the "Open" value of the financial graph

See also
setOpenColumn(), getOpenColumn()

◆ setShift

void JKQTPFinancialGraph::setShift ( double  __value)
slot

the shift of the boxes, relative to the distance between the current and the next x-value

See the following graphic to understand this concept (same principle as described in the JKQTPBarGraphBase documentation):

◆ setWidth

void JKQTPFinancialGraph::setWidth ( double  __value)
slot

the width of the boxes, relative to the distance between the current and the next x-value

See the following graphic to understand this concept (same principle as described in the JKQTPBarGraphBase documentation):

◆ usesColumn()

virtual bool JKQTPFinancialGraph::usesColumn ( int  column) const
overridevirtual

returns true if the given column is used by the graph

This virtual function indicates whether a given column is used by this graph. Override this function in your derived graphs to indicate to JKQTPlotter / JKQTBasePlotter , which columns from the internal JKQTPDatastore are actually used. This information can be used e.g. for graph-specific data-export.

Reimplemented from JKQTPXGraph.

Member Data Documentation

◆ m_fillStyleNegative

JKQTPGraphFillStyleMixin JKQTPFinancialGraph::m_fillStyleNegative
protected

fill style for negative items (close<open)

See also
fillStyleNegative()

◆ m_fillStylePositive

JKQTPGraphFillStyleMixin JKQTPFinancialGraph::m_fillStylePositive
protected

fill style for positive items (close>open)

See also
fillStylePositive()

◆ m_lineStyleNegative

JKQTPGraphLineStyleMixin JKQTPFinancialGraph::m_lineStyleNegative
protected

fill style for negative items (close<open)

See also
lineStyleNegative()

◆ m_lineStylePositive

JKQTPGraphLineStyleMixin JKQTPFinancialGraph::m_lineStylePositive
protected

fill style for positive items (close>open)

See also
lineStylePositive()

◆ parentsAlreadySeen

QSet<JKQTBasePlotter*> JKQTPFinancialGraph::parentsAlreadySeen
staticprotected

◆ shift

double JKQTPFinancialGraph::shift
protected

the shift of the boxes, relative to the distance between the current and the next x-value

See the following graphic to understand this concept (same principle as described in the JKQTPBarGraphBase documentation):

◆ width

double JKQTPFinancialGraph::width
protected

the width of the boxes, relative to the distance between the current and the next x-value

See the following graphic to understand this concept (same principle as described in the JKQTPBarGraphBase documentation):

Property Documentation

◆ closeColumn

int JKQTPFinancialGraph::closeColumn
readwrite

column for the "Close" value of the financial graph

See also
setCloseColumn(), getCloseColumn()

◆ graphType

FinancialGraphType JKQTPFinancialGraph::graphType
readwrite

type of the financial graph (OHLC or candle-stick)

See also
setGraphType(), getGraphType(), FinancialGraphType

◆ highColumn

int JKQTPFinancialGraph::highColumn
readwrite

column for the "High" value of the financial graph

See also
setHighColumn(), getHighColumn()

◆ lowColumn

int JKQTPFinancialGraph::lowColumn
readwrite

column for the "Low" value of the financial graph

See also
setLowColumn(), getLowColumn()

◆ openColumn

int JKQTPFinancialGraph::openColumn
readwrite

column for the "Open" value of the financial graph

See also
setOpenColumn(), getOpenColumn()

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