PDA

View Full Version : canvas size



gkarthick5
18th July 2011, 10:18
I'm implementing a custom bar chart by extending QwtPlot and overriding the drawItems() method. I set the number of bars i have to draw on the canvas in a particular method(in which i create the plotItems). I dont want the bar width to be too small or too big. How do i restrict the canvas size for this? (i compute the bar width in draw items as canvas()->width() / Number_of_items).

Uwe
19th July 2011, 06:58
Do it the other way round: calculatate the width of the bars from the canvas size.

Uwe

gkarthick5
19th July 2011, 08:27
That is what i do now. But if the the number of bars is very small and the canvas size is very big, the bars do not look so nice. that is why i want to limit the canvas size from (Number_of_Bars * Min_Bar_Width) to (Number_of_Bars * Max_Bar_Width)

Uwe
20th July 2011, 06:57
You can limit the size of the complete plot widget like for any other Qt widget.

Uwe