Unsolved I'm not getting QValueAxis and chart->createDefaultAxes()
-
Hi Guys,
I read the QValueAxis doc and also used createDefaultAxes()
but I can't understand the QValueAxis usages and advantages over createDefaultAxes().If you have any thoughts about them please help me in understanding them with examples,
Thanks in advance. -
@thippu Hi,
The advantage of QValueAxis is that you can customize the axis according to your need, by changing font, colors, tick count, (see also AbstractAxis properties), etc... But usually createDefaultAxes() will make the job.
Personnaly I have used it only to make the font smaller for displaying on Mobile.
Here is a simple example:
ChartView{ //... LineSeries { //... axisY: ValueAxis{ labelsFont.pointSize: 8 color: "blue" labelsAngle: 20 } } }
-
@thippu `
Let's say clarify my doubt
code:// I have defined QChart object QValueAxis *AxisX=new QValueAxis; axisX->setRange(0,2000); axisX->setLableFormat("%g"); axisX->setTitleText("Samplees"); QValuesAxis *axisY=new QValueAxis; axisY->setRange(-1,1); axisY->setTitleText("Audio level"); chart->setAxisX(axisX,series); chart->setAxisY(axisY,series); chart->setAxisX(axisX,series2); chart->setAxisY(axisY,series2); // I have two dynamic QLineSeries objs those are series and series2 have defined them and now I want to plot them on the chart, In this series2 is not getting plotted on the chart, there is no lose or empty data on the series2, both series objects are connected to same data source, //chart is displaying only series object data.
So, Is there any mistakes in the setAxes to the chart?
-
@Gojir4 okay, thanks for the reply I'm using c++
-
@thippu Sorry. Anyway that's the same in C++
-
@thippu said in I'm not getting QValueAxis and chart->createDefaultAxes():
both series objects are connected to same data source
Does that mean that both series display the same data ?
In this case maybe you see only one series in your chart because serires2 is hidden under series1 ? -
@Gojir4 Yes, same data stream is given to the both but I have changed the QPen colors of them so we can see the changes through this think.
-
@thippu I don't think so, if they have same width you will only see the one which is at "front". Maybe try to increase the pen width of the one which is at "back".
I'm pretty sure that if you display different data in series2 you will see it. -
@Gojir4 I did increase the width. Before this I should understand the QValueAxis properly. Is there any video or documents with example
-
@thippu You can find many examples in Qt Charts Examples and some useful documentation in Qt Charts Overview.
You can also find many tutorials by typing "qt charts" in Youtube.