Qcustomplot User's Manual (iv)

Source: Internet
Author: User

First, the basic graphic components
1, Qcustomplot provide text, arrows, lines, pictures and other graphic components to meet user needs. They are all inherited from the base class Qcpabstractitem.
The inheritance relationship is as follows:

Examples of crossing online:

//Add the text label at the top:Qcpitemtext*Textlabel= NewQcpitemtext (customplot); customplot -AddItem (Textlabel); Textlabel -Setpositionalignment (Qt:: AlignTop|Qt:: Alignhcenter); Textlabel -Position -SetType (qcpitemposition::p taxisrectratio); Textlabel -Position -Setcoords (0.5,0);//Place position at Center/top of axis rectTextlabel -SetText ("Text Item Demo"); Textlabel -SetFont (Qfont (Font ().Family (), -));//Make font a bit largerTextlabel -Setpen (Qpen (Qt:: Black));//Show black border around text//Add the arrow:Qcpitemline*Arrow= NewQcpitemline (customplot); customplot -AddItem (arrow); arrow -Start -Setparentanchor (Textlabel -bottom); arrow -End -Setcoords (4,1.6);//point to (4, 1.6) in X-y-plot coordinatesArrow -Sethead (qcplineending:: Esspikearrow);

Effect:

The code is simple and can be seen, but when we drag or zoom the image, the arrows are fixed at (4, 1.6) positions. You can refer to Qcpabstractitem and qcpitemposition for more information.
2, set the components in the entire Qcustomplot visible:

setClipToAxisRect(false);

Or you can set the rectangular area where you are located:

void QCPAbstractItem::setClipAxisRect*  rect);

Typically, two functions are used together.

Qcustomplot User's Manual (iv)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.