Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved Possible to create multiple QStackedBarSeries on a single QChart?

    General and Desktop
    1
    1
    322
    Loading More Posts
    • 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
      oracle3001 last edited by

      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 Reply Quote 0
      • First post
        Last post