QValueAxis
Detailed Description
The QValueAxis class is used for manipulating chart’s axis.
ValueAxis can be setup to show axis line with tick marks, grid lines and shades. Values of axis are drawn to position of ticks.
詳細說明
這個QValueAxis類,用於操縱chart的圖軸。
ValueAxis可以設置顯示刻度軸線、網格線和陰影。以及軸的值被繪制到軸上面的位置。
QCategoryAxis
Detailed Description
The QCategoryAxis class allows putting a named ranges on the axis.
This class can be used when the underlying data needs to be given extra meaning. Unlike with the QBarCategoryAxis the QCategoryAxis allows the categories ranges widths to be specified freely.
Example code on how to use QCategoryAxis:
詳細說明
這個QCategoryAxis類允許自定義,所指定的軸范圍。
這個類可以使用時,底層的數據需要給予額外的意義。與QBarCategoryAxis類的QCategoryAxis允許類范圍可任意指定寬度。
這與QBarCategoryAxis的QCategoryAxis允許類范圍可任意指定寬度不同。
1 QChartView *chartView = new QChartView; 2 QLineSeries *series = new QLineSeries; 3 // ...
4 chartView->chart()->addSeries(series); 5
6 QCategoryAxis *axisY = new QCategoryAxis; 7 axisY->setMin(0); 8 axisY->setMax(52); 9 axisY->setStartValue(15); 10 axisY->append("First", 20); 11 axisY->append("Second", 37); 12 axisY->append("Third", 52); 13 chartView->chart()->setAxisY(axisY, series);
個人理解:
簡單的說QValueAxis是一個懶人版,軸的范圍什么的不需要自己指定,軸上顯示的label(也就是0,1,2,3這些內容)是默認的。qt會根據你軸上的點自動設置。
若你需要自定義一些內容,QCategoryAxis是比較好的,但是需要自己自定義好才可以調用。