Exemple #1
0
 def _createLabels(self, points, viewbox, logMode):
     for x, y in points:
         # fill the text
         xtext = self._getXText(x)
         ytext = self._getYText(y)
         text_item = TextItem()
         text_item.setHtml(("<div style='{}'> " + "<span><b>x=</b>{} " +
                            "<span><b>y=</b>{}</span> " + "</div>").format(
                                self._label_style, xtext, ytext))
         # add text_item in the right position (take into account log mode)
         if logMode[0]:
             x = numpy.log10(x)
         if logMode[1]:
             y = numpy.log10(y)
         text_item.setPos(x, y)
         self._labels.append(text_item)
         viewbox.addItem(text_item, ignoreBounds=True)
     # Add "highlight" marker at each point
     highlight = PlotDataItem(
         numpy.array(points),
         pen=None,
         symbol="s",
         symbolBrush="35393C88",
         pxMode=True,
         symbolSize=self.trigger_point_size,
     )
     # set log mode
     highlight.setLogMode(*logMode)
     # hack to make the CurvesPropertiesTool ignore the highlight points
     highlight._UImodifiable = False
     # Add it to the vbox and keep a reference
     viewbox.addItem(highlight, ignoreBounds=True)
     self._highlights.append(highlight)