PDA

View Full Version : setting color of the text in qwtdial partially



Navi
19th June 2015, 11:18
i can able to set the color of the text in qwt dial.
but i need to set the color of the text partially.

Example:
if lowerbound is 0 and upperbound is 100

i need the text color for 0 to 40 to be one color(say green)
and text color for 40 to 100 to be another color(say blue)

Uwe
19th June 2015, 12:42
Overload QwtRoundScaleDraw::label() and assign your derived class using QwtDial::setScaleDraw().
By using QwtText::setColor() you can set individual color for a label.

Uwe

Navi
20th June 2015, 05:38
Overload QwtRoundScaleDraw::label() and assign your derived class using QwtDial::setScaleDraw().
By using QwtText::setColor() you can set individual color for a label.

Uwe

Thanks Uwe

i need the color of dial also as two different colors
like first half part of the dial as one color and remaining half of the dial as another color

Uwe
20th June 2015, 10:40
Which parts of the dial - do you have a screenshot ?

Uwe

Navi
20th June 2015, 11:17
11225

i have attached the image

Uwe
20th June 2015, 16:20
Again you can do it by overloading methods from QwtRoundScaleDraw - here drawBackbone(). You could use a gradient or draw the arc in segments with different pens.
Have a look at the default implementations of QwtRoundScaleDraw, then it should be straightforward how to do it.

Uwe

Navi
22nd June 2015, 07:35
Again you can do it by overloading methods from QwtRoundScaleDraw - here drawBackbone(). You could use a gradient or draw the arc in segments with different pens.
Have a look at the default implementations of QwtRoundScaleDraw, then it should be straightforward how to do it.

Uwe

I referred QwtRoundScaleDraw .but i couldn't understand..

please can you give me example for drawBackbone in QwtRoundScaleDraw

Uwe
22nd June 2015, 08:44
Qwt is open source - there is no better example than simply looking at the code.

Uwe