Qt World Summit: Register Today!

Point Size on a Line Series?

  • Hi! I've successfully created the kind of chart I want (thanks to the example here). My only complaint is that the size of the plotted points are really small. I cannot figure out how to make them larger. Anyone know?

    Here's my chart (with the points being too small):


    And here's the code I use to generate the chart:

    	auto *series = new QtCharts::QLineSeries();
    	series->append(0, 6);
    	series->append(2, 4);
    	series->append(3, 8);
    	series->append(7, 4);
    	series->append(10, 5);
    	*series << QPointF(11, 0) << QPointF(13, 3) << QPointF(17, 6) << QPointF(18, 3) << QPointF(20, 2);
    	auto chart = new QtCharts::QChart();
    	chart->layout()->setContentsMargins(0, 0, 0, 0);
    	auto chartView = new QtCharts::QChartView(chart);

  • @TerenceD
    I don't have QtCharts installed, but since QLineSeries inherits from QXYSeries, it has
    setPen(const QPen &pen) function.

    series->setPen(QPen pen(Qt::darkBlue, 3);

  • Thanks, Dream Captain. Ideally, I would like to be able to just leave the line size the same and increase the point size but making the pen size thicker does help. Examples:

    Here it is at a pen size of 2:


    Here it is at a pen size of 3:


    I think I'm going to go with a pen size of 2.

    Thanks again.

  • Is it possible to increase the points size without increasing the line width?

  • Hi @QueenAI, Did you find the answer? Even I am looking for the same solution.

  • I solve this problem by drawing QLineSeries and QScatterSeries at the same time. Init a QPointF and append it into both line series and scatter series. Then add both series into chart.

Log in to reply