PDA

View Full Version : Axis Auto Scale



gkarthick5
8th July 2011, 12:54
I'm creating a custon Plot by subclassing QwtPlotItem and QwtPlot. When i set the axis autoscale (yAxis), the values for the scale takes double of the maximum for my y value. Which function do I need to override to set the correct y axis values?

Also, which method is called to print the title on the legend? Is is drawLegendIdentifier() or is there some other method?

gkarthick5
13th July 2011, 10:57
Got it. I was returning the wrong values from the boundingRect() method of the PlotItem.

But the other part (legend titles) is not solved.

Uwe
13th July 2011, 12:32
But the other part (legend titles) is not solved.
An item on the legend is a QwtLegendItem, what is derived from QwtTextLabel.

Uwe

gkarthick5
13th July 2011, 13:57
If i do the following:

QwtLegend* legend = new QwtLegend();
plot->insertLegend(legend);
will the legend automatically display all the items of the plot?

Currently, I'm reimplementing
drawLegendIdentifier(QPainter*, const QRectF&) in my custom PlotItem, in which i'm filling the rectangle i get with the item's color. Is there any other function with which i can paint the text(title of the item) next to this rectangle?