Hi,

I am using custom plot version 2.1.0.

In my present scatter series application i am reading the values(X and Y ) from CSV file and then able to plot them as scatter series without the lines connected to these scatter series.


Could you please help me on the below two queries?

I have following two signals.

connect(ui->customPlot, SIGNAL(itemClick(QCPAbstractItem*,QMouseEvent*)), this,SLOT(GraphItemClicked(QCPAbstractItem*,QMouseEvent*)));

connect(ui->customPlot, SIGNAL(plottableClick(QCPAbstractPlottable*,int,QMouseEvent*)), this, SLOT(GraphClicked(QCPAbstractPlottable*,int,QMouseEvent*)));

Following are the corresponding two slots connected to the above two signals.

Query 1:
-----------

I am having an issue here, the below slot which is connected to itemClick is not getting invoked when i click on the graph or on the scatter data. Am i doing some thing wrong?

I read in the forums, the issue related to the signal itemClick is got fixed in versio 2.0.

void MainWindow::GraphItemClicked(QCPAbstractItem* pItem,QMouseEvent*pEvent)
{
qDebug()<<ui->customPlot->xAxis->pixelToCoord(pEvent->x())<<" , ";
qDebug()<<ui->customPlot->yAxis->pixelToCoord(pEvent->y())<<endl;

}


Query 2:
-----------

In the below slot, I am printing/reading the X and Y values back, when the user clicks on the particular scatter data.

void MainWindow::GraphClicked(QCPAbstractPlottable* graphplot,int nIndex,QMouseEvent* pEvent)
{
qDebug()<<" X = " <<graphplot->interface1D()->dataMainKey(nIndex)<<" Y= "<<graphplot->interface1D()->dataMainValue(nIndex);
}

Is there any way exists, to change the color of the individual scatter data point.
suppose if I have three data points are plotted, can i change one data point to Red, second one to Green and third one to Blue color, based on the selection made by the user from the mouse click.