{"id":18930344,"url":"https://github.com/tomhumphries/dygraphsfixedcrosshairs","last_synced_at":"2026-03-16T23:30:16.971Z","repository":{"id":139772921,"uuid":"254375523","full_name":"TomHumphries/DyGraphsFixedCrosshairs","owner":"TomHumphries","description":"A modification of the original dygraphs crosshairs plugin that selects points on 'click', rather than on 'mousemove'","archived":false,"fork":false,"pushed_at":"2020-04-09T13:29:07.000Z","size":2,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-31T19:40:30.654Z","etag":null,"topics":["crosshairs","dygraphs","plugin"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TomHumphries.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-09T13:14:33.000Z","updated_at":"2020-04-09T13:30:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"3d65eb7c-61d9-46b7-8827-0498f91c3472","html_url":"https://github.com/TomHumphries/DyGraphsFixedCrosshairs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TomHumphries%2FDyGraphsFixedCrosshairs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TomHumphries%2FDyGraphsFixedCrosshairs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TomHumphries%2FDyGraphsFixedCrosshairs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TomHumphries%2FDyGraphsFixedCrosshairs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TomHumphries","download_url":"https://codeload.github.com/TomHumphries/DyGraphsFixedCrosshairs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239927817,"owners_count":19719835,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["crosshairs","dygraphs","plugin"],"created_at":"2024-11-08T11:37:18.327Z","updated_at":"2026-03-16T23:30:16.850Z","avatar_url":"https://github.com/TomHumphries.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dygraphs \"FixedCrosshairs\" Plugin\n\nThis is a plugin for [dygraphs](http://dygraphs.com/) that places crosshairs when the chart is clicked.\n\nIt is a modification to the [original crosshairs plugin](https://github.com/danvk/dygraphs/blob/master/src/extras/crosshair.js) that updated the crosshair location when the cursor was moved over the chart.\n\n## Usage\n\nImport the file and use it like any other. It takes the same constructor as the original crosshairs Plugin.\n\n```\nplugins: [\n    new Dygraph.Plugins.FixedCrosshair({\n        direction: \"both\"\n    })\n]\n```\n\n## About\n\nThe modification itself is small: in the `activate()` call we remove the `'mousemove'` event and replace it with a `'click'` event. The stops points being selected when the cursor is moved over the chart. We also remove the ```'mouseout'``` event stop the crosshairs being removed when the cursor is moved off the chart.\n\n```\ncrosshair.prototype.activate = function(g) {\n    this.dygraph_ = g;\n    g.graphDiv.appendChild(this.canvas_);\n    removeEvent(window, 'mouseout', this.dygraph_.mouseOutHandler_)\n    removeEvent(this.dygraph_.mouseEventElement_, 'mousemove', this.dygraph_.mouseMoveHandler_)\n    this.dygraph_.addAndTrackEvent(this.dygraph_.mouseEventElement_, 'click', this.dygraph_.mouseMoveHandler_);\n    return {\n        select: this.select,\n        deselect: this.deselect\n    };\n  };\n\nfunction removeEvent(elem, type, fn) {\n    elem.removeEventListener(type, fn, false);\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomhumphries%2Fdygraphsfixedcrosshairs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomhumphries%2Fdygraphsfixedcrosshairs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomhumphries%2Fdygraphsfixedcrosshairs/lists"}