diff --git a/examples/areachart/main.cpp b/examples/areachart/main.cpp index 62b76fd..2f7f3a2 100644 --- a/examples/areachart/main.cpp +++ b/examples/areachart/main.cpp @@ -29,6 +29,7 @@ QTCOMMERCIALCHART_USE_NAMESPACE int main(int argc, char *argv[]) { QApplication a(argc, argv); + //![1] QLineSeries* series0 = new QLineSeries(); QLineSeries* series1 = new QLineSeries(); @@ -40,6 +41,7 @@ int main(int argc, char *argv[]) *series1 << QPointF(1, 3) << QPointF(3, 4) << QPointF(7, 3) << QPointF(8, 2) << QPointF(12, 3) << QPointF(16, 4) << QPointF(18, 3); //![2] + //![3] QAreaSeries* series = new QAreaSeries(series0, series1); QPen pen(0x059605); @@ -52,6 +54,7 @@ int main(int argc, char *argv[]) gradient.setCoordinateMode(QGradient::ObjectBoundingMode); series->setBrush(gradient); //![3] + //![4] QChart* chart = new QChart(); chart->addSeries(series); @@ -59,15 +62,18 @@ int main(int argc, char *argv[]) chart->axisX()->setRange(0, 20); chart->axisY()->setRange(0, 10); //![4] + //![5] QChartView* chartView = new QChartView(chart); chartView->setRenderHint(QPainter::Antialiasing); //![5] + //![6] QMainWindow window; window.setCentralWidget(chartView); window.resize(400, 300); window.show(); //![6] + return a.exec(); } diff --git a/examples/barchart/main.cpp b/examples/barchart/main.cpp index 9c31404..b5bb808 100644 --- a/examples/barchart/main.cpp +++ b/examples/barchart/main.cpp @@ -29,10 +29,12 @@ QTCOMMERCIALCHART_USE_NAMESPACE int main(int argc, char *argv[]) { QApplication a(argc, argv); + //![1] QBarCategories categories; categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun"; //![1] + //![2] QBarSet *set0 = new QBarSet("Jane"); QBarSet *set1 = new QBarSet("John"); @@ -46,6 +48,7 @@ int main(int argc, char *argv[]) *set3 << 5 << 6 << 7 << 3 << 4 << 5; *set4 << 9 << 7 << 5 << 3 << 1 << 2; //![2] + //![3] QBarSeries* series = new QBarSeries(categories); series->appendBarSet(set0); @@ -54,20 +57,24 @@ int main(int argc, char *argv[]) series->appendBarSet(set3); series->appendBarSet(set4); //![3] + //![4] QChart* chart = new QChart(); chart->addSeries(series); chart->setTitle("Simple barchart example"); //![4] + //![5] QChartView* chartView = new QChartView(chart); chartView->setRenderHint(QPainter::Antialiasing); //![5] + //![6] QMainWindow window; window.setCentralWidget(chartView); window.resize(400, 300); window.show(); //![6] + return a.exec(); } diff --git a/examples/customchart/main.cpp b/examples/customchart/main.cpp index a3095bd..c7e98c5 100644 --- a/examples/customchart/main.cpp +++ b/examples/customchart/main.cpp @@ -35,14 +35,17 @@ int main(int argc, char *argv[]) blue.setWidth(3); series->setPen(blue); //![1] + //![2] *series << QPointF(0, 6) << QPointF(2, 4) << QPointF(3, 8) << QPointF(7, 4) << QPointF(10,5); //![2] + //![3] QChart* chart = new QChart(); chart->addSeries(series); chart->setTitle("Simple customchart example"); //![3] + //![4] QFont font; font.setPixelSize(18); @@ -57,6 +60,7 @@ int main(int argc, char *argv[]) backgroundGradient.setCoordinateMode(QGradient::ObjectBoundingMode); chart->setBackgroundBrush(backgroundGradient); //![4] + //![5] QPen black(Qt::black); QChartAxis* axisX = chart->axisX(); @@ -72,6 +76,7 @@ int main(int argc, char *argv[]) axisY->setShadesBrush(Qt::white); axisY->setShadesVisible(true); //![5] + //![6] QChartAxisCategories* categoriesX = chart->axisX()->categories(); categoriesX->insert(1,"low"); @@ -83,21 +88,25 @@ int main(int argc, char *argv[]) categoriesY->insert(5,"med"); categoriesY->insert(10,"fast"); //![6] + //![7] axisX->setRange(0,10); axisX->setTicksCount(4); axisY->setRange(0,10); axisY->setTicksCount(4); //![7] + //![8] QChartView* chartView = new QChartView(chart); chartView->setRenderHint(QPainter::Antialiasing); //![8] + //![9] QMainWindow window; window.setCentralWidget(chartView); window.resize(400, 300); window.show(); //![9] + return a.exec(); } diff --git a/examples/linechart/main.cpp b/examples/linechart/main.cpp index 4dcf418..9f6f634 100644 --- a/examples/linechart/main.cpp +++ b/examples/linechart/main.cpp @@ -28,12 +28,14 @@ QTCOMMERCIALCHART_USE_NAMESPACE int main(int argc, char *argv[]) { QApplication a(argc, argv); + //![1] QLineSeries* series = new QLineSeries(); QPen red(Qt::red); red.setWidth(3); series->setPen(red); //![1] + //![2] series->append(0, 6); series->append(2, 4); @@ -42,20 +44,24 @@ int main(int argc, char *argv[]) series->append(10, 5); *series << QPointF(11, 1) << QPointF(13, 3) << QPointF(17, 6) << QPointF(18, 3) << QPointF(20, 2); //![2] + //![3] QChart* chart = new QChart(); chart->addSeries(series); chart->setTitle("Simple line chart example"); //![3] + //![4] QChartView* chartView = new QChartView(chart); chartView->setRenderHint(QPainter::Antialiasing); //![4] + //![5] QMainWindow window; window.setCentralWidget(chartView); window.resize(400, 300); window.show(); //![5] + return a.exec(); } diff --git a/examples/percentbarchart/main.cpp b/examples/percentbarchart/main.cpp index 39d0381..da2d546 100644 --- a/examples/percentbarchart/main.cpp +++ b/examples/percentbarchart/main.cpp @@ -29,10 +29,12 @@ QTCOMMERCIALCHART_USE_NAMESPACE int main(int argc, char *argv[]) { QApplication a(argc, argv); + //![1] QBarCategories categories; categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun"; //![1] + //![2] QBarSet *set0 = new QBarSet("Jane"); QBarSet *set1 = new QBarSet("John"); @@ -46,6 +48,7 @@ int main(int argc, char *argv[]) *set3 << 5 << 6 << 7 << 3 << 4 << 5; *set4 << 9 << 7 << 5 << 3 << 1 << 2; //![2] + //![3] QPercentBarSeries* series = new QPercentBarSeries(categories); series->appendBarSet(set0); @@ -54,21 +57,25 @@ int main(int argc, char *argv[]) series->appendBarSet(set3); series->appendBarSet(set4); //![3] + //![4] QChart* chart = new QChart(); chart->addSeries(series); chart->setTitle("Simple precentbarchart example"); //![4] + //![5] QChartView* chartView = new QChartView(chart); chartView->setRenderHint(QPainter::Antialiasing); //![5] + //![6] QMainWindow window; window.setCentralWidget(chartView); window.resize(400, 300); window.show(); //![6] + return a.exec(); } diff --git a/examples/scatterchart/main.cpp b/examples/scatterchart/main.cpp index 30d41ff..ab62f58 100644 --- a/examples/scatterchart/main.cpp +++ b/examples/scatterchart/main.cpp @@ -28,6 +28,7 @@ QTCOMMERCIALCHART_USE_NAMESPACE int main(int argc, char *argv[]) { QApplication a(argc, argv); + //![1] QPen pen(Qt::black); pen.setWidth(2); @@ -56,6 +57,7 @@ int main(int argc, char *argv[]) *series1 << QPointF(1, 1) << QPointF(3, 3) << QPointF(7, 6) << QPointF(8, 3) << QPointF(10, 2); //![2] + //![3] QChart* chart = new QChart(); @@ -63,15 +65,18 @@ int main(int argc, char *argv[]) chart->addSeries(series1); chart->setTitle("Simple scatterchart example"); //![3] + //![4] QChartView* chartView = new QChartView(chart); chartView->setRenderHint(QPainter::Antialiasing); //![4] + //![5] QMainWindow window; window.setCentralWidget(chartView); window.resize(400, 300); window.show(); //![5] + return a.exec(); } diff --git a/examples/stackedbarchart/main.cpp b/examples/stackedbarchart/main.cpp index dc08d1b..52ce044 100644 --- a/examples/stackedbarchart/main.cpp +++ b/examples/stackedbarchart/main.cpp @@ -29,10 +29,12 @@ QTCOMMERCIALCHART_USE_NAMESPACE int main(int argc, char *argv[]) { QApplication a(argc, argv); + //![1] QBarCategories categories; categories << "Jan" << "Feb" << "Mar" << "Apr" << "May" << "Jun"; //![1] + //![2] QBarSet *set0 = new QBarSet("Jane"); QBarSet *set1 = new QBarSet("John"); @@ -46,6 +48,7 @@ int main(int argc, char *argv[]) *set3 << 5 << 6 << 7 << 3 << 4 << 5; *set4 << 9 << 7 << 5 << 3 << 1 << 2; //![2] + //![3] QStackedBarSeries* series = new QStackedBarSeries(categories); series->appendBarSet(set0); @@ -54,21 +57,25 @@ int main(int argc, char *argv[]) series->appendBarSet(set3); series->appendBarSet(set4); //![3] + //![4] QChart* chart = new QChart(); chart->addSeries(series); chart->setTitle("Simple stackedbarchart example"); //![4] + //![5] QChartView* chartView = new QChartView(chart); chartView->setRenderHint(QPainter::Antialiasing); //![5] + //![6] QMainWindow window; window.setCentralWidget(chartView); window.resize(400, 300); window.show(); //![6] + return a.exec(); } diff --git a/examples/zoomlinechart/main.cpp b/examples/zoomlinechart/main.cpp index bac21d6..faa3b26 100644 --- a/examples/zoomlinechart/main.cpp +++ b/examples/zoomlinechart/main.cpp @@ -40,10 +40,12 @@ int main(int argc, char *argv[]) red.setWidth(3); series1->setPen(red); //![1] + //![2] *series0 << QPointF(0, 6) << QPointF(2, 4) << QPointF(3, 8) << QPointF(7, 4) << QPointF(10, 5); *series1 << QPointF(1, 1) << QPointF(3, 3) << QPointF(7, 6) << QPointF(8, 3) << QPointF(10, 2); //![2] + //![3] QChart* chart = new QChart(); @@ -52,15 +54,18 @@ int main(int argc, char *argv[]) chart->setTitle("Zoom in/out chart example"); chart->setAnimationOptions(QChart::AllAnimations); //![3] + //![4] ChartView* chartView = new ChartView(chart); chartView->setRenderHint(QPainter::Antialiasing); //![4] + //![5] QMainWindow window; window.setCentralWidget(chartView); window.resize(400, 300); window.show(); //![5] + return a.exec(); }