Hello Everybody,

I'd like to add some describing text to a given QPointF on a chart. I really spent a lot of time trying all of the mapToX's and mapFromX's to map coordinates.
Here's a short wrap up about what I'm doing:

Qt Code:
  1. // create Chart
  2. chart = new QChart();
  3. chart->createDefaultAxes();
  4.  
  5. // costumize chart
  6. dateTimeAxis = new QDateTimeAxis;
  7.  
  8. categoryAxis = new QBarCategoryAxis();
  9. categoryAxis->append(categoriesList);
  10.  
  11. chart->addAxis(dateTimeAxis,Qt::AlignBottom);
  12. chart->addAxis(categoryAxis, Qt::AlignLeft);
  13.  
  14. // hide casual axes
  15. chart->axisX()->hide();
  16. chart->axisY()->hide();
  17.  
  18. // use QChartView
  19. myChartView = new QChartView(chart);
  20.  
  21. // promote to QMainWindow
  22. layout->addWidget(myChartView);
  23.  
  24. myWidget = new QWidget();
  25. myWidget->setLayout(layout);
  26. setCentralWidget(myWidget);
  27.  
  28. ///////////////////
  29.  
  30. // generate some life
  31. lowerSeries = new QLineSeries();
  32. upperSeries = new QLineSeries();
  33. area = new QAreaSeries(upperSeries, lowerSeries);
  34.  
  35. area->attachAxis(dateTimeAxis);
  36. area->attachAxis(chart->axisY());
  37.  
  38. p1 = QPointF(QDateTime::currentTime.toMSecsSinceEpoch(), 1);
  39. p3 = QPointF(QDateTime::currentTime.toMSecsSinceEpoch(), 5);
  40. p2 = QPointF(QDateTime::currentTime.addSecs(rand_N_ofSec).toMSecsSinceEpoch(), 1);
  41. p4 = QPointF(QDateTime::currentTime.addSecs(rand_N_ofSec).toMSecsSinceEpoch(), 5);
  42.  
  43. lowerSeries << p1 << p2;
  44. upperSeries << p3 << p4;
  45.  
  46.  
  47. // now the problem:
  48. tag = new QGraphicsSimpleTextItem(chart);
  49. tag->setText("any text to describe the point");
  50.  
  51. // how toset the location of the tag properly (near the point)?
To copy to clipboard, switch view to plain text mode 

i.e. the point is at (30,60) I'd like to set the tag on (31,61)
a typical QPointF on the chart would look like

Qt Code:
  1. p1 = QPointF(QDateTime::currentTime.toMSecsSinceEpoch(), 3);
  2. qDebug() << "p:" << p;
  3.  
  4. p: QPointF(1.51138e+12, 3) // strange numbers due to toMSecSinceEpoche()
To copy to clipboard, switch view to plain text mode 

Thanks in advance, Lars