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. getting the coordinate value of points in Qchartview
Forum Updated to NodeBB v4.3 + New Features

getting the coordinate value of points in Qchartview

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 269 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.
  • S Offline
    S Offline
    seok
    wrote on last edited by
    #1

    hello
    how to get the values of x and y in Qt chartview when i move the mouse on the point

    here is the code

    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    
    MainWindow::MainWindow(QWidget *parent)
        : QMainWindow(parent)
        , ui(new Ui::MainWindow)
    {
        ui->setupUi(this);
    
        series = new QScatterSeries();
    
        series->append(0,0);
        series->append(1,3);
        series->append(3,4);
        series->append(5,7);
    
    
        chart = new QChart();
        chart->addSeries(series);
        chart->setTitle("chart");
        chart->createDefaultAxes();
    
        chart->legend()->hide();
        chart->legend()->setAlignment(Qt::AlignTop);
    
        chartview = new  QChartView(chart);
        chartview->setRenderHint(QPainter::Antialiasing);
        //chartview->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
        chartview->setParent(this);
    
        chartview->setRubberBand(QChartView::RectangleRubberBand);
    
    }
    
    MainWindow::~MainWindow()
    {
        delete ui;
    }
    
    void MainWindow::on_pushButton_clicked()
    {
        chart->zoomIn();
    }
    
    
    void MainWindow::on_pushButton_2_clicked()
    {
        chart->zoomOut();
    }
    
    
    void MainWindow::on_pushButton_3_clicked()
    {
        chart->zoomReset();
    }
    
    

    please suggest a way to do this thanks in advance

    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