So, after some investigation...
I found out that I have no idea whatsoever about how to do this ^^
Problems I found:
the differentiantion in thickness and color is not relative to the y or x value of the curve; rather it's based on uchar values outisde the implementation of the curve (it's a vector that hold the Y points and the uchar values, so I copied the Y data to a new QPointF values and that I put inside the curve:
QVector<QPointF> samples;
samples.reserve( vetor_ativos[stock].periodicity[period].size() );
for (int aaa = 0; aaa < vetor_ativos[stock].periodicity[period].size(); aaa++)
{
if (vetor_ativos[stock].periodicity[period][aaa].candle_probability_status.probability == 0.0f)
continue;
samples
+= QPointF(QwtDate
::toDouble(vetor_ativos
[stock
].
periodicity[period
][aaa
].
date),
(double)vetor_ativos[stock].periodicity[period][aaa].candle_probability_status.probability);
}
QVector<QPointF> samples;
samples.reserve( vetor_ativos[stock].periodicity[period].size() );
for (int aaa = 0; aaa < vetor_ativos[stock].periodicity[period].size(); aaa++)
{
if (vetor_ativos[stock].periodicity[period][aaa].candle_probability_status.probability == 0.0f)
continue;
samples += QPointF(QwtDate::toDouble(vetor_ativos[stock].periodicity[period][aaa].date),
(double)vetor_ativos[stock].periodicity[period][aaa].candle_probability_status.probability);
}
To copy to clipboard, switch view to plain text mode
My ideia would be about doing a for(; that would catch the data type and depending on the results, change the curve style:
QPen up_normal
(Qt
::green,
1.0);
QPen up_continuation
(Qt
::green,
2.0);
QPen up_reversal
(Qt
::green,
3.0);
QPen down_normal
(Qt
::red,
1.0);
QPen down_continuation
(Qt
::red,
2.0);
QPen down_reversal
(Qt
::red,
3.0);
for (int aaa = 0; aaa < samples.size(); aaa++)
{
if (vetor_ativos[stock].periodicity[period][aaa].candle_probability_status.foward_direction == DIRECTION_POSITIVE)
{
if (vetor_ativos[stock].periodicity[period][aaa].candle_probability_status.style == CAN_STYLE_CONTINUATION)
{
painter.setPen(up_continuation);
}
else if (vetor_ativos[stock].periodicity[period][aaa].candle_probability_status.style == CAN_STYLE_REVERSION)
{
}
else
{
}
}
else if (vetor_ativos[stock].periodicity[period][aaa].candle_probability_status.foward_direction == DIRECTION_NEGATIVE)
{
if (vetor_ativos[stock].periodicity[period][aaa].candle_probability_status.style == CAN_STYLE_CONTINUATION)
{
}
else if (vetor_ativos[stock].periodicity[period][aaa].candle_probability_status.style == CAN_STYLE_REVERSION)
{
}
else
{
}
}
else
{
if (vetor_ativos[stock].periodicity[period][aaa].candle_probability_status.style == CAN_STYLE_CONTINUATION)
{
}
else if (vetor_ativos[stock].periodicity[period][aaa].candle_probability_status.style == CAN_STYLE_REVERSION)
{
}
else
{
}
}
}
QPen up_normal(Qt::green,1.0);
QPen up_continuation(Qt::green,2.0);
QPen up_reversal(Qt::green,3.0);
QPen down_normal(Qt::red,1.0);
QPen down_continuation(Qt::red,2.0);
QPen down_reversal(Qt::red,3.0);
QPainter painter;
for (int aaa = 0; aaa < samples.size(); aaa++)
{
if (vetor_ativos[stock].periodicity[period][aaa].candle_probability_status.foward_direction == DIRECTION_POSITIVE)
{
if (vetor_ativos[stock].periodicity[period][aaa].candle_probability_status.style == CAN_STYLE_CONTINUATION)
{
painter.setPen(up_continuation);
}
else if (vetor_ativos[stock].periodicity[period][aaa].candle_probability_status.style == CAN_STYLE_REVERSION)
{
}
else
{
}
}
else if (vetor_ativos[stock].periodicity[period][aaa].candle_probability_status.foward_direction == DIRECTION_NEGATIVE)
{
if (vetor_ativos[stock].periodicity[period][aaa].candle_probability_status.style == CAN_STYLE_CONTINUATION)
{
}
else if (vetor_ativos[stock].periodicity[period][aaa].candle_probability_status.style == CAN_STYLE_REVERSION)
{
}
else
{
}
}
else
{
if (vetor_ativos[stock].periodicity[period][aaa].candle_probability_status.style == CAN_STYLE_CONTINUATION)
{
}
else if (vetor_ativos[stock].periodicity[period][aaa].candle_probability_status.style == CAN_STYLE_REVERSION)
{
}
else
{
}
}
}
To copy to clipboard, switch view to plain text mode
But simply overloading drawLines(...) don't seems to have any good, once I have no way of exctracting the parameters values to use the function. Does somebody have any idea? Any other way of how to do this?
Bookmarks