Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Possible to create multiple QStackedBarSeries on a single QChart?

Possible to create multiple QStackedBarSeries on a single QChart?

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 406 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    oracle3001
    wrote on last edited by
    #1

    I was wondering if it is possible to create two sets of QStackedBarSeries on a single QChart.

    When I try to create two QStackedBarSeries and add them both to the chart in the usual way, I find that for each x, QT bars the two stacked bars over one another i.e.

    // series 1
    	QStackedBarSeries *series = new QStackedBarSeries();
    	series->setName("Orginal Costs");
            int first = 0;
    	int count = _n_meshes ;
    	QVBarModelMapper *mapper = new QVBarModelMapper(this);
    	mapper->setFirstBarSetColumn(0);
    	mapper->setLastBarSetColumn(2);
    	mapper->setFirstRow(first);
    	mapper->setRowCount(count);
    	mapper->setSeries(series);
    	mapper->setModel(original_cost_summary_model);
    
    // series 2
    	QStackedBarSeries *series2 = new QStackedBarSeries();
    	series2->setName("Optimized Costs");
    	//int first = 0;
    	//int count = _n_meshes;
    	QVBarModelMapper *mapper2 = new QVBarModelMapper(this);
    	mapper2->setFirstBarSetColumn(0);
    	mapper2->setLastBarSetColumn(2);
    	mapper2->setFirstRow(first);
    	mapper2->setRowCount(count);
    	mapper2->setSeries(series2);
    	mapper2->setModel(final_cost_summary_model);
    
    	chart->addSeries(series);
    	chart->addSeries(series2);
    

    Am I just missing something simple?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved