Qt의 차트의 경우


축에 있는 Range에 따라 차트를 그리는게아니라


데이터전체의 min max값을 파악하여 그래프를 먼저그린후 해당 데이터에 맞춰 축데이터를 수정한다 ㄱ-



d->mChart->removeAllSeries();
d->mChart->addSeries(series);
d->mChart->createDefaultAxes(); // always need this function after addSeries


따라서 createDefaultAxes 함수를 addSeries 이후에 반드시 호출해줘야 오류가 없다.




다음 도큐먼트 참고


//Referance : QtDocument 5.11.1


   Creates axes for the chart based on the series that have already been added to the chart. Any axes previously added to the chart will be deleted.

Note: This function has to be called after all series have been added to the chart. The axes created by this function will NOT get automatically attached to any series added to the chart after this function has been called. A series with no axes attached will by default scale to utilize the entire plot area of the chart, which can be confusing if there are other series with properly attached axes also present.


Series type

X-axis

Y-axis

QXYSeries

QValueAxis

QValueAxis

QBarSeries

QBarCategoryAxis

QValueAxis

QPieSeries

None

None

If there are several QXYSeries derived series added to the chart and no series of other types have been added, then only one pair of axes is created. If there are several series of different types added to the chart, then each series gets its own axes pair.

The axes specific to the series can be later obtained from the chart by providing the series as the parameter for the axes() function call. QPieSeries does not create any axes.

See also axisX(), axisY(), axes(), setAxisX(), setAxisY(), and QAbstractSeries::attachAxis().


+ Recent posts