customizing gridlines: custom pens, major/minor lines, X/Y controls

85 views
Skip to first unread message

nvdw

unread,
Oct 14, 2016, 2:12:32 PM10/14/16
to pyqtgraph
Hi,

I want to customize grid lines, as in:
  1. using specific pens to allow customization of grid line color, thickness, and style, independent of the corresponding axis object
  2. notion of major / minor gridlines
  3. separate control over horizontal / vertical grid lines

As these specifications are not available in pyqtgraph by default, I'd like to understand the best way to implement this.
My current understanding is that I need to subclass GridItem, and re-implement GridItem.generatePicture(self)

Even for Spec 1, I don't see a simple way to do this. Following Luke's suggestion (see here) of subclassing GridItem and creating a setPen() method also requires rewriting the generatePicture() to replace the hard-coded pens with the customized ones.
Furthermore, the drawing algorithm in GridItem.generatePicture() makes it difficult to implement spec 2 or 3.

Before I implement such a change, I want to ensure that I am looking at the right method to modify. Am I right that re-implementing GridItem.generatePicture() is the way forward?

regards,
Nick

Reply all
Reply to author
Forward
0 new messages