Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Chart stylesheet & Text field



  • ec960183-85bf-4d73-99cb-2cd74ad8294d-image.png

    Hi. I'm drawing the chart real-time. I have a question.
    The red letter stage1 starts with the 8.5 number on the x-axis. I want to mark it, so if it's drawn in real time, I'll have to go back in the direction of the arrow. Is there a way to do this?

    8969a434-2b72-4b9a-9f8d-b9e1366fce62-image.png

    The second question is, is there a way to decorate the chart like this? Will the chart be a style sheet? And my chart is based on the theme provided by qt, but if the background is white, can you change this color or make it transparent?



  • m_pChartViewer->chart()->setBackgroundVisible(false);
    //m_pChartViewer->chart()->setBackgroundBrush(QColor(0, 0, 0, 0));

    3615f052-edc1-4fed-8dba-747fe08b3d21-image.png



  • void QTemperatureChart::InitializeChart()
    {
    	//m_pChartViewer = new QChartView(createAreaChart());
    	m_pChartViewer = new QChartView(createSplineChart());
    	//m_pChartViewer->chart()->setTheme(QChart::ChartTheme::ChartThemeDark);
    	m_pChartViewer->chart()->legend()->hide();
    	m_pChartViewer->chart()->setAnimationOptions(QtCharts::QChart::SeriesAnimations);
    	m_pChartViewer->chart()->setAnimationDuration(500);
    	//m_pChartViewer->chart()->setBackgroundRoundness(20);
    	//m_pChartViewer->chart()->setBackgroundVisible(false);
    	//m_pChartViewer->chart()->backgr;
    	m_pChartViewer->chart()->setBackgroundBrush(QBrush(Qt::darkGray));
    	//m_pChartViewer->chart()->setBackgroundVisible(false);
    	m_pChartViewer->setRenderHint(QPainter::Antialiasing);
    	m_pChartViewer->setBackgroundBrush(QBrush(Qt::darkYellow));
    	//m_pChartViewer->setStyleSheet("ChartView{background-color: none;}");
    	//m_pChartViewer->setBackgroundBrush(QColor(255,255,255,0));
    
    
        this->ui.verticalLayout->addWidget(m_pChartViewer);
    }
    

    b1192b8e-5313-41bc-97a6-67eec3737cb2-image.png

    It's not transparent.

    9dc969a5-0f35-44be-bf2a-33c63a402332-image.png


Log in to reply