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):

    0_1511835255691_LineSeriesChart.png

    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);
    	series->setColor(Qt::darkBlue);
    	series->setPointsVisible();
    
    	auto chart = new QtCharts::QChart();
    	chart->layout()->setContentsMargins(0, 0, 0, 0);
    	chart->setBackgroundRoundness(0);
    	chart->legend()->hide();
    	chart->addSeries(series);
    	chart->createDefaultAxes();
    
    	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->setColor(Qt::darkBlue);
    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:

    0_1511840628808_PenSizeTwo.png

    Here it is at a pen size of 3:

    0_1511840644040_PenSizeThree.png

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

    Thanks again.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.