Set tick position and tick name of axis X on Qt chart.
-
Hello everyone.
I have a dynamic qchart that updates every 50 milliseconds. I want to change the name and position of ticks on the chart dynamically. For example, when I have less data, the difference between two ticks will be 20 (picture 1) and when I have more data, the difference between two ticks will be 50 (picture 2) and then 150, and so on.
I research it and found out, that I should use the "QCategoryAxis" but unfortunately, I did not find a simple and useful example.
Is there any link or does anyone know about it?Thanks in advance.
-
I assume the system configuration is sufficient for 50ms time. There may be two options. The first is to create a new chart each time (not a chartview) and delete the old one. The other is to update the axis max and min values with the series on the same chart. It seems from your example that in this case the series values will mostly be reloaded. I think the cost and code cleanup of the first option would be more appropriate.
-
I assume the system configuration is sufficient for 50ms time. There may be two options. The first is to create a new chart each time (not a chartview) and delete the old one. The other is to update the axis max and min values with the series on the same chart. It seems from your example that in this case the series values will mostly be reloaded. I think the cost and code cleanup of the first option would be more appropriate.
@A-A-SEZEN Thanks for the reply.
yes. It is a better option to create a new chart each time and I implemented it and the main problem is the axis. I want to have ticks with my own label differences. like the first tick has label 20, the second one 40, the third one 60, and so on. -
Could you be talking about the QValueAxis::setTickCount(int count) property? Because it will automatically partition as many as you want. Or maybe I still don't understand what you're talking about.
@A-A-SEZEN Yes, It partitions as many as I want, but the distance between each partition is my goal. For example, I need ticks with 50 differences between each tick(like picture 2 I sent before). But in QValueAxis::setTickCount(int count), I can just set the number of ticks, not the position of each tick. It may be tacked to me ticks with 35 differences between each tick.