{"action":"created","comment":{"url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/pulls/comments/51685877","id":51685877,"diff_hunk":"@@ -37,79 +78,125 @@ def __init__(self, pos=None, angle=90, pen=None, movable=False, bounds=None):\n                         for :func:`mkPen <pyqtgraph.mkPen>`. Default pen is transparent\n                         yellow.\n         movable         If True, the line can be dragged to a new position by the user.\n+        hoverPen        Pen to use when drawing line when hovering over it. Can be any\n+                        arguments that are valid for :func:`mkPen <pyqtgraph.mkPen>`.\n+                        Default pen is red.\n         bounds          Optional [min, max] bounding values. Bounds are only valid if the\n                         line is vertical or horizontal.\n+        label           if True, a label is displayed next to the line to indicate its\n+                        location in data coordinates\n+        textColor       color of the label. Can be any argument fn.mkColor can understand.\n+        textFill        A brush to use when filling within the border of the text.\n+        textLocation    A float [0-1] that defines the location of the text.\n+        textShift       A float [0-1] that defines when the text shifts from one side to\n+                        another.\n+        textFormat      Any new python 3 str.format() format.\n+        unit            If not None, corresponds to the unit to show next to the label\n+        name            If not None, corresponds to the name of the object\n         =============== ==================================================================\n         \"\"\"\n-        \n-        GraphicsObject.__init__(self)\n-        \n+\n+        UIGraphicsItem.__init__(self)\n+\n         if bounds is None:              ## allowed value boundaries for orthogonal lines\n             self.maxRange = [None, None]\n         else:\n             self.maxRange = bounds\n         self.moving = False\n-        self.setMovable(movable)\n         self.mouseHovering = False\n+\n+        self.angle = ((angle+45) % 180) - 45\n+        if textColor is None:\n+            textColor = (200, 200, 200)\n+        self.textColor = textColor\n+        self.location = textLocation\n+        self.shift = textShift\n+        self.label = label\n+        self.format = textFormat\n+        self.unit = unit\n+        self._name = name\n+\n+        self.anchorLeft = (1., 0.5)\n+        self.anchorRight = (0., 0.5)\n+        self.anchorUp = (0.5, 1.)\n+        self.anchorDown = (0.5, 0.)\n+        self.text = TextItem(fill=textFill)\n+        self.text.setParentItem(self) # important\n         self.p = [0, 0]\n-        self.setAngle(angle)\n-        if pos is None:\n-            pos = Point(0,0)\n-        self.setPos(pos)\n \n         if pen is None:\n             pen = (200, 200, 100)\n-        \n+\n         self.setPen(pen)\n-        self.setHoverPen(color=(255,0,0), width=self.pen.width())\n+\n+        if hoverPen is None:\n+            self.setHoverPen(color=(255,0,0), width=self.pen.width())\n+        else:\n+            self.setHoverPen(hoverPen)\n         self.currentPen = self.pen\n-      \n+\n+        self.setMovable(movable)\n+\n+        if pos is None:\n+            pos = Point(0,0)\n+        self.setPos(pos)\n+\n+        if (self.angle == 0 or self.angle == 90) and self.label:\n+            self.text.show()\n+        else:\n+            self.text.hide()\n+\n+\n     def setMovable(self, m):\n         \"\"\"Set whether the line is movable by the user.\"\"\"\n         self.movable = m\n         self.setAcceptHoverEvents(m)\n-      \n+\n     def setBounds(self, bounds):\n         \"\"\"Set the (minimum, maximum) allowable values when dragging.\"\"\"\n         self.maxRange = bounds\n         self.setValue(self.value())\n-        \n+\n     def setPen(self, *args, **kwargs):\n-        \"\"\"Set the pen for drawing the line. Allowable arguments are any that are valid \n+        \"\"\"Set the pen for drawing the line. Allowable arguments are any that are valid\n         for :func:`mkPen <pyqtgraph.mkPen>`.\"\"\"\n         self.pen = fn.mkPen(*args, **kwargs)\n         if not self.mouseHovering:\n             self.currentPen = self.pen\n             self.update()\n-        \n+\n     def setHoverPen(self, *args, **kwargs):\n-        \"\"\"Set the pen for drawing the line while the mouse hovers over it. \n-        Allowable arguments are any that are valid \n+        \"\"\"Set the pen for drawing the line while the mouse hovers over it.\n+        Allowable arguments are any that are valid\n         for :func:`mkPen <pyqtgraph.mkPen>`.\n-        \n+\n         If the line is not movable, then hovering is also disabled.\n-        \n+\n         Added in version 0.9.9.\"\"\"\n         self.hoverPen = fn.mkPen(*args, **kwargs)\n         if self.mouseHovering:\n             self.currentPen = self.hoverPen\n             self.update()\n-        \n+\n     def setAngle(self, angle):\n         \"\"\"\n         Takes angle argument in degrees.\n         0 is horizontal; 90 is vertical.\n-        \n-        Note that the use of value() and setValue() changes if the line is \n+\n+        Note that the use of value() and setValue() changes if the line is\n         not vertical or horizontal.\n         \"\"\"\n         self.angle = ((angle+45) % 180) - 45   ##  -45 <= angle < 135\n-        self.resetTransform()\n-        self.rotate(self.angle)\n+        # self.resetTransform()   # no longer needed since version 0.9.11\n+        # self.rotate(self.angle) # no longer needed since version 0.9.11","path":"pyqtgraph/graphicsItems/InfiniteLine.py","position":220,"original_position":220,"commit_id":"0d4c78a6bea699d33e85c41c9019171f4cddd9e0","original_commit_id":"0d4c78a6bea699d33e85c41c9019171f4cddd9e0","user":{"login":"campagnola","id":940580,"avatar_url":"https://avatars.githubusercontent.com/u/940580?v=3","gravatar_id":"","url":"https://api.github.com/users/campagnola","html_url":"https://github.com/campagnola","followers_url":"https://api.github.com/users/campagnola/followers","following_url":"https://api.github.com/users/campagnola/following{/other_user}","gists_url":"https://api.github.com/users/campagnola/gists{/gist_id}","starred_url":"https://api.github.com/users/campagnola/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/campagnola/subscriptions","organizations_url":"https://api.github.com/users/campagnola/orgs","repos_url":"https://api.github.com/users/campagnola/repos","events_url":"https://api.github.com/users/campagnola/events{/privacy}","received_events_url":"https://api.github.com/users/campagnola/received_events","type":"User","site_admin":false},"body":"That method will be called for you whenever the ViewBox transform changes, so you want something like:\r\n\r\n    def viewTransformChanged(self):\r\n        self.updateTextPosition() ","created_at":"2016-02-03T07:18:36Z","updated_at":"2016-02-03T07:18:36Z","html_url":"https://github.com/pyqtgraph/pyqtgraph/pull/267#discussion_r51685877","pull_request_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/pulls/267","_links":{"self":{"href":"https://api.github.com/repos/pyqtgraph/pyqtgraph/pulls/comments/51685877"},"html":{"href":"https://github.com/pyqtgraph/pyqtgraph/pull/267#discussion_r51685877"},"pull_request":{"href":"https://api.github.com/repos/pyqtgraph/pyqtgraph/pulls/267"}}},"pull_request":{"url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/pulls/267","id":56180610,"html_url":"https://github.com/pyqtgraph/pyqtgraph/pull/267","diff_url":"https://github.com/pyqtgraph/pyqtgraph/pull/267.diff","patch_url":"https://github.com/pyqtgraph/pyqtgraph/pull/267.patch","issue_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/issues/267","number":267,"state":"open","locked":false,"title":"InfiniteLine enhancement","user":{"login":"lesauxvi","id":8177167,"avatar_url":"https://avatars.githubusercontent.com/u/8177167?v=3","gravatar_id":"","url":"https://api.github.com/users/lesauxvi","html_url":"https://github.com/lesauxvi","followers_url":"https://api.github.com/users/lesauxvi/followers","following_url":"https://api.github.com/users/lesauxvi/following{/other_user}","gists_url":"https://api.github.com/users/lesauxvi/gists{/gist_id}","starred_url":"https://api.github.com/users/lesauxvi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lesauxvi/subscriptions","organizations_url":"https://api.github.com/users/lesauxvi/orgs","repos_url":"https://api.github.com/users/lesauxvi/repos","events_url":"https://api.github.com/users/lesauxvi/events{/privacy}","received_events_url":"https://api.github.com/users/lesauxvi/received_events","type":"User","site_admin":false},"body":"Add some new features to InfiniteLine and an example illustrating some of them.","created_at":"2016-01-15T15:14:51Z","updated_at":"2016-02-03T07:18:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4301706889cbc3180e7c83e53f6b1713d2be1407","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/pulls/267/commits","review_comments_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/pulls/267/comments","review_comment_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/issues/267/comments","statuses_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/statuses/0d4c78a6bea699d33e85c41c9019171f4cddd9e0","head":{"label":"lesauxvi:new_plot_items","ref":"new_plot_items","sha":"0d4c78a6bea699d33e85c41c9019171f4cddd9e0","user":{"login":"lesauxvi","id":8177167,"avatar_url":"https://avatars.githubusercontent.com/u/8177167?v=3","gravatar_id":"","url":"https://api.github.com/users/lesauxvi","html_url":"https://github.com/lesauxvi","followers_url":"https://api.github.com/users/lesauxvi/followers","following_url":"https://api.github.com/users/lesauxvi/following{/other_user}","gists_url":"https://api.github.com/users/lesauxvi/gists{/gist_id}","starred_url":"https://api.github.com/users/lesauxvi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lesauxvi/subscriptions","organizations_url":"https://api.github.com/users/lesauxvi/orgs","repos_url":"https://api.github.com/users/lesauxvi/repos","events_url":"https://api.github.com/users/lesauxvi/events{/privacy}","received_events_url":"https://api.github.com/users/lesauxvi/received_events","type":"User","site_admin":false},"repo":{"id":49705652,"name":"pyqtgraph","full_name":"lesauxvi/pyqtgraph","owner":{"login":"lesauxvi","id":8177167,"avatar_url":"https://avatars.githubusercontent.com/u/8177167?v=3","gravatar_id":"","url":"https://api.github.com/users/lesauxvi","html_url":"https://github.com/lesauxvi","followers_url":"https://api.github.com/users/lesauxvi/followers","following_url":"https://api.github.com/users/lesauxvi/following{/other_user}","gists_url":"https://api.github.com/users/lesauxvi/gists{/gist_id}","starred_url":"https://api.github.com/users/lesauxvi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lesauxvi/subscriptions","organizations_url":"https://api.github.com/users/lesauxvi/orgs","repos_url":"https://api.github.com/users/lesauxvi/repos","events_url":"https://api.github.com/users/lesauxvi/events{/privacy}","received_events_url":"https://api.github.com/users/lesauxvi/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/lesauxvi/pyqtgraph","description":"pyqtgraph main development repository","fork":true,"url":"https://api.github.com/repos/lesauxvi/pyqtgraph","forks_url":"https://api.github.com/repos/lesauxvi/pyqtgraph/forks","keys_url":"https://api.github.com/repos/lesauxvi/pyqtgraph/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lesauxvi/pyqtgraph/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lesauxvi/pyqtgraph/teams","hooks_url":"https://api.github.com/repos/lesauxvi/pyqtgraph/hooks","issue_events_url":"https://api.github.com/repos/lesauxvi/pyqtgraph/issues/events{/number}","events_url":"https://api.github.com/repos/lesauxvi/pyqtgraph/events","assignees_url":"https://api.github.com/repos/lesauxvi/pyqtgraph/assignees{/user}","branches_url":"https://api.github.com/repos/lesauxvi/pyqtgraph/branches{/branch}","tags_url":"https://api.github.com/repos/lesauxvi/pyqtgraph/tags","blobs_url":"https://api.github.com/repos/lesauxvi/pyqtgraph/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lesauxvi/pyqtgraph/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lesauxvi/pyqtgraph/git/refs{/sha}","trees_url":"https://api.github.com/repos/lesauxvi/pyqtgraph/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lesauxvi/pyqtgraph/statuses/{sha}","languages_url":"https://api.github.com/repos/lesauxvi/pyqtgraph/languages","stargazers_url":"https://api.github.com/repos/lesauxvi/pyqtgraph/stargazers","contributors_url":"https://api.github.com/repos/lesauxvi/pyqtgraph/contributors","subscribers_url":"https://api.github.com/repos/lesauxvi/pyqtgraph/subscribers","subscription_url":"https://api.github.com/repos/lesauxvi/pyqtgraph/subscription","commits_url":"https://api.github.com/repos/lesauxvi/pyqtgraph/commits{/sha}","git_commits_url":"https://api.github.com/repos/lesauxvi/pyqtgraph/git/commits{/sha}","comments_url":"https://api.github.com/repos/lesauxvi/pyqtgraph/comments{/number}","issue_comment_url":"https://api.github.com/repos/lesauxvi/pyqtgraph/issues/comments{/number}","contents_url":"https://api.github.com/repos/lesauxvi/pyqtgraph/contents/{+path}","compare_url":"https://api.github.com/repos/lesauxvi/pyqtgraph/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lesauxvi/pyqtgraph/merges","archive_url":"https://api.github.com/repos/lesauxvi/pyqtgraph/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lesauxvi/pyqtgraph/downloads","issues_url":"https://api.github.com/repos/lesauxvi/pyqtgraph/issues{/number}","pulls_url":"https://api.github.com/repos/lesauxvi/pyqtgraph/pulls{/number}","milestones_url":"https://api.github.com/repos/lesauxvi/pyqtgraph/milestones{/number}","notifications_url":"https://api.github.com/repos/lesauxvi/pyqtgraph/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lesauxvi/pyqtgraph/labels{/name}","releases_url":"https://api.github.com/repos/lesauxvi/pyqtgraph/releases{/id}","deployments_url":"https://api.github.com/repos/lesauxvi/pyqtgraph/deployments","created_at":"2016-01-15T08:12:03Z","updated_at":"2016-01-15T08:12:05Z","pushed_at":"2016-02-02T22:24:29Z","git_url":"git://github.com/lesauxvi/pyqtgraph.git","ssh_url":"git@github.com:lesauxvi/pyqtgraph.git","clone_url":"https://github.com/lesauxvi/pyqtgraph.git","svn_url":"https://github.com/lesauxvi/pyqtgraph","homepage":null,"size":3274,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"develop"}},"base":{"label":"pyqtgraph:develop","ref":"develop","sha":"9e8c2082edf3a5eb81eb50d5180997f7c758579d","user":{"login":"pyqtgraph","id":5440571,"avatar_url":"https://avatars.githubusercontent.com/u/5440571?v=3","gravatar_id":"","url":"https://api.github.com/users/pyqtgraph","html_url":"https://github.com/pyqtgraph","followers_url":"https://api.github.com/users/pyqtgraph/followers","following_url":"https://api.github.com/users/pyqtgraph/following{/other_user}","gists_url":"https://api.github.com/users/pyqtgraph/gists{/gist_id}","starred_url":"https://api.github.com/users/pyqtgraph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pyqtgraph/subscriptions","organizations_url":"https://api.github.com/users/pyqtgraph/orgs","repos_url":"https://api.github.com/users/pyqtgraph/repos","events_url":"https://api.github.com/users/pyqtgraph/events{/privacy}","received_events_url":"https://api.github.com/users/pyqtgraph/received_events","type":"Organization","site_admin":false},"repo":{"id":12777496,"name":"pyqtgraph","full_name":"pyqtgraph/pyqtgraph","owner":{"login":"pyqtgraph","id":5440571,"avatar_url":"https://avatars.githubusercontent.com/u/5440571?v=3","gravatar_id":"","url":"https://api.github.com/users/pyqtgraph","html_url":"https://github.com/pyqtgraph","followers_url":"https://api.github.com/users/pyqtgraph/followers","following_url":"https://api.github.com/users/pyqtgraph/following{/other_user}","gists_url":"https://api.github.com/users/pyqtgraph/gists{/gist_id}","starred_url":"https://api.github.com/users/pyqtgraph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pyqtgraph/subscriptions","organizations_url":"https://api.github.com/users/pyqtgraph/orgs","repos_url":"https://api.github.com/users/pyqtgraph/repos","events_url":"https://api.github.com/users/pyqtgraph/events{/privacy}","received_events_url":"https://api.github.com/users/pyqtgraph/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pyqtgraph/pyqtgraph","description":"pyqtgraph main development repository","fork":false,"url":"https://api.github.com/repos/pyqtgraph/pyqtgraph","forks_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/forks","keys_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/teams","hooks_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/hooks","issue_events_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/issues/events{/number}","events_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/events","assignees_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/assignees{/user}","branches_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/branches{/branch}","tags_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/tags","blobs_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/git/refs{/sha}","trees_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/statuses/{sha}","languages_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/languages","stargazers_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/stargazers","contributors_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/contributors","subscribers_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/subscribers","subscription_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/subscription","commits_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/commits{/sha}","git_commits_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/git/commits{/sha}","comments_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/comments{/number}","issue_comment_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/issues/comments{/number}","contents_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/contents/{+path}","compare_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/merges","archive_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/downloads","issues_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/issues{/number}","pulls_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/pulls{/number}","milestones_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/milestones{/number}","notifications_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/labels{/name}","releases_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/releases{/id}","deployments_url":"https://api.github.com/repos/pyqtgraph/pyqtgraph/deployments","created_at":"2013-09-12T07:18:21Z","updated_at":"2016-01-30T17:36:17Z","pushed_at":"2016-02-02T14:39:25Z","git_url":"git://github.com/pyqtgraph/pyqtgraph.git","ssh_url":"git@github.com:pyqtgraph/pyqtgraph.git","clone_url":"https://github.com/pyqtgraph/pyqtgraph.git","svn_url":"https://github.com/pyqtgraph/pyqtgraph","homepage":null,"size":4673,"stargazers_count":337,"watchers_count":337,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":188,"mirror_url":null,"open_issues_count":138,"forks":188,"open_issues":138,"watchers":337,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/pyqtgraph/pyqtgraph/pulls/267"},"html":{"href":"https://github.com/pyqtgraph/pyqtgraph/pull/267"},"issue":{"href":"https://api.github.com/repos/pyqtgraph/pyqtgraph/issues/267"},"comments":{"href":"https://api.github.com/repos/pyqtgraph/pyqtgraph/issues/267/comments"},"review_comments":{"href":"https://api.github.com/repos/pyqtgraph/pyqtgraph/pulls/267/comments"},"review_comment":{"href":"https://api.github.com/repos/pyqtgraph/pyqtgraph/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pyqtgraph/pyqtgraph/pulls/267/commits"},"statuses":{"href":"https://api.github.com/repos/pyqtgraph/pyqtgraph/statuses/0d4c78a6bea699d33e85c41c9019171f4cddd9e0"}}}}