PDA

View Full Version : Axis Tick and Label !



huyhoangfool
24th July 2014, 05:03
Hi All,

I have 2 questions about the tick on the axis.

1. When i disable the label on an axis (QwtPlot::xBottom), the tick at the maximum value of the axis doesn't display. Please look at the red rectangular of the image.
10525

2. How can i get the tick alignment like the red circles of the image?
10526

Any help appreciated.

Thanks.

Uwe
24th July 2014, 07:35
Is your question about how to align the ticks to the inner side of the plot ?

Uwe

huyhoangfool
24th July 2014, 09:08
Is your question about how to align the ticks to the inner side of the plot ?

Uwe

Hi Uwe,

Yes, that's my second question.

My first question is why the tick at the maximum value of the x axis doesn't display when i disable the label.

Can you please give me any hint ?

Thanks

Uwe
28th July 2014, 07:11
My first question is why the tick at the maximum value of the x axis doesn't display when i disable the label.
In general I don't see a reason for this. Without running some code it is hard to say more.

Uwe

huyhoangfool
28th July 2014, 09:27
In general I don't see a reason for this. Without running some code it is hard to say more.

Uwe

Hi Uwe,

Thanks for response.
The code is done as following:



QwtPlot *myPlot = new QwtPlot;

//Set Axis Scale
myPlot->setAxisScale(QwtPlot::xBottom, 0, 12);
myPlot->setAxisScale(QwtPlot::yLeft, 0, 120);

//Set Axis Title, Set Max Minor, Medium, Major
...

//Disable Label Component
myPlot->axisScaleDraw(QwtPlot::xBottom)->enableComponent(QwtAbstractScaleDraw::Labels, false);


When i use this line "myPlot->axisScaleDraw(QwtPlot::xBottom)->enableComponent(QwtAbstractScaleDraw::Labels, false);", the tick at the maximum value of x axis (value: 12) doesn't display.

If i set the pen width of the ScaleDraw to 2, that tick will display. But, it's very ugly.
10529

Thanks

Uwe
29th July 2014, 12:20
Looks like a bug in the layout code of QwtScaleWidget to me. Maybe subtracting one pixel from length in QwtScaleWidget::layoutScale() is the necessary fix.

Uwe