简体   繁体   中英

How do I set tick label explicitly from QChart?

I have to create a chart and use QChart . So I looked at the QChart dynamic spline example (because I'm going to create a dynamic chart), and I found something strange there.

Below is the launch screen. The code is the example code provided by Qt, except for setTickCount() .

launch screen image: 启动屏幕图像

dynamic spline chart example code from Qt home page

I changed the value of tick from 5 to 10. I thought that if I changed it to 10, it would appear as 0, 1, 2, 3, 4, ..., 10 as the scale value. But it does not.

When moving by the scale interval, I think that it should be increased only by the scale interval exactly. What should I do? The code looks fine.

You might want to try calling void QValueAxis::applyNiceNumbers() , somewhere in the constructor. Take a look at void QValueAxis::applyNiceNumbers() in Qt documentation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM