Line Chart axis fixed range problem
Unsolved
General and Desktop
-
Hi all,
i want to build a line chart with using qchart. But I have a problem. i draw paint images for understand clearly. You can see before and after images. I want to build a this type line chart. How can i build a chart like images? Do i use any wrong
I am working on this code which is declared in below.
Code:
void MainWindow::ecgLineChart(QFrame *horizontalFrame){// set pen for series QPen pen(QRgb(0x00aa00)); pen.setWidth(2); //try some example datas with edges QLineSeries *series = new QLineSeries(); //for flow line chart right to left series->setPen(pen); series->append(0,1); series->append(-1,4); series->append(-2,5); series->append(-3,2); series->append(-4,2); /*not working for us right now //create chart with attributes QChart *chart = new QChart(); chart->createDefaultAxes(); chart->addSeries(series); chart->setBackgroundBrush(Qt::black); chart->layout()->setContentsMargins(0, 0, 0, 0); chart->setMargins(QMargins(0, 0, 0, 0)); chart->setBackgroundRoundness(0); chart->setMaximumSize(810,100); chart->setMinimumSize(810,100); chart->setPreferredSize(810,100); chart->legend()->hide(); //create chartview with some attributes QChartView *chartview = new QChartView(chart); chartview->setRenderHint(QPainter::Antialiasing); chartview->setParent(horizontalFrame); chartview->setContentsMargins(0,0,0,0);}