{"id":20020298,"url":"https://github.com/multivacplatform/es-punchcard","last_synced_at":"2025-12-12T04:03:38.523Z","repository":{"id":57226997,"uuid":"50101750","full_name":"multivacplatform/es-punchcard","owner":"multivacplatform","description":"Make punchcard charts based on Elasticsearch histogram aggregations","archived":false,"fork":false,"pushed_at":"2019-01-11T16:19:46.000Z","size":123,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-07T04:39:55.108Z","etag":null,"topics":["bower","elasticsearch","es-punchcard","histogram","punchcard","punchcard-charts","visualization"],"latest_commit_sha":null,"homepage":"https://multivac.iscpif.fr/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/multivacplatform.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-21T11:00:31.000Z","updated_at":"2019-01-11T16:19:47.000Z","dependencies_parsed_at":"2022-08-31T03:01:46.288Z","dependency_job_id":null,"html_url":"https://github.com/multivacplatform/es-punchcard","commit_stats":null,"previous_names":["maziyarpanahi/es-punchcard"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/multivacplatform/es-punchcard","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multivacplatform%2Fes-punchcard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multivacplatform%2Fes-punchcard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multivacplatform%2Fes-punchcard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multivacplatform%2Fes-punchcard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/multivacplatform","download_url":"https://codeload.github.com/multivacplatform/es-punchcard/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/multivacplatform%2Fes-punchcard/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278722729,"owners_count":26034461,"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","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["bower","elasticsearch","es-punchcard","histogram","punchcard","punchcard-charts","visualization"],"created_at":"2024-11-13T08:31:13.732Z","updated_at":"2025-10-07T04:39:55.545Z","avatar_url":"https://github.com/multivacplatform.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# es-punchcard [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/multivacplatform/es-punchcard/blob/master/LICENSE.md) [![Multivac Discuss](https://img.shields.io/badge/multivac-discuss-ff69b4.svg)](https://discourse.iscpif.fr/c/multivac) [![Multivac Channel](https://img.shields.io/badge/multivac-chat-ff69b4.svg)](https://chat.iscpif.fr/channel/multivac)\n\n## Description\nMake punchcard charts based on Elasticsearch [histogram] (https://www.elastic.co/guide/en/elasticsearch/reference/master/search-aggregations-bucket-histogram-aggregation.html) or [date histogram] (https://www.elastic.co/guide/en/elasticsearch/reference/master/search-aggregations-bucket-datehistogram-aggregation.html) aggregations\n\n\n## Installation\n### Bower\n\nThis is a recommended way and it will install everything you need:\n\n```\nbower install --save es-punchcard\n```\n\n(OPTIONAL) You may want to have a .bowerrc next to your bower.json file and change it to:\n\n```javascript\n{\n  \"directory\": \"js/\"\n}\n```\n\nThis way you can use the demo.html right away. Otherwise you have to fix the paths to the required files.\n\ne.g. chage this to where ever you keep your D3 library.\n\n```javascript\n \u003cscript src=\"js/d3/d3.min.js\"\u003e\u003c/script\u003e\n```\n\n\n### Git clone\n```\ngit clone https://github.com/maziyarpanahi/es-punchcard.git\n```\n\nor\n\n```\ngit clone https://maziyar_sh@bitbucket.org/iscpif/es-punchcard.git\n```\n\nYou need these JS libraries if you installing this manually:\n\n\nD3 [https://github.com/mbostock/d3] (https://github.com/mbostock/d3)\n\nMoment [https://github.com/moment/moment] (https://github.com/moment/moment)\n\njQuery [https://github.com/jquery/jquery] (https://github.com/jquery/jquery)\n\nOptional for the demo file:\n\nBootstrap [https://github.com/twbs/bootstrap] (https://github.com/twbs/bootstrap)\n\n\n## Documentation\n\nYou can install these by simply using bower install:\n```javascript\n  \u003clink rel=\"stylesheet\" href=\"style.css\" /\u003e \u003c!-- load punchcard css (OPTIONAL) --\u003e\n  \u003cscript src=\"/path-to-jquery/jquery.min.js\" /\u003e\n  \u003cscript src=\"/path-to-bootstrap/bootstrap.min.js\" /\u003e\n  \u003cscript src=\"/path-to-d3/d3.min.js\" /\u003e \u003c!-- (REQUIRED) --\u003e\n  \u003cscript src=\"/path-to-moment/moment.js\" /\u003e \u003c!-- (REQUIRED) --\u003e\n  \u003cscript src=\"/path-to-es-punchcard/es-punchcard.js\" /\u003e \u003c!-- (REQUIRED) --\u003e\n```\n\n\nSet some settings before calling the init() function:\n\n```javascript\npunchcard.width = 500;\npunchcard.top = 50;\npunchcard.svgID = \"myFristChart\";\npunchcard.custom_start_year = \"2015-05\";\npunchcard.custom_end_year = \"2015-12\";\npunchcard.d3DateFormat = \"%Y-%m\";\npunchcard.dataDateFormat = \"YYYY-MM\";\npunchcard.customTickFormat = \"%Y-%m\";\n```\n\nYou can set these settings anytime and call the init() again to initiate the SVG with new config.\n\n```javascript\npunchcard.init();\n```\n\nAll charts would be removed whenever init() is called. (possible to only remove svg with a specific ID if you set one)\n\nNow it is time for loading some data:\n\n```javascript\npunchcard.draw(data);\n```\n\n## Data Structure\n\nThis is a sample of one of the keys. The buckets refer to (date) histogram aggregation to fill the punchcard. \n\n```javascript\n{\"key\":\"carbon emissions\",\"doc_count\":320001,\"score\":52.34230602030492,\"bg_count\":519874,\"monthly\":{\"buckets\":[{\"key_as_string\":\"2015-03-01T00:00:00.000Z\",\"key\":1425168000000,\"doc_count\":1916},{\"key_as_string\":\"2015-04-01T00:00:00.000Z\",\"key\":1427846400000,\"doc_count\":28383},{\"key_as_string\":\"2015-05-01T00:00:00.000Z\",\"key\":1430438400000,\"doc_count\":31190},{\"key_as_string\":\"2015-06-01T00:00:00.000Z\",\"key\":1433116800000,\"doc_count\":32671},{\"key_as_string\":\"2015-07-01T00:00:00.000Z\",\"key\":1435708800000,\"doc_count\":44745},{\"key_as_string\":\"2015-08-01T00:00:00.000Z\",\"key\":1438387200000,\"doc_count\":31513},{\"key_as_string\":\"2015-09-01T00:00:00.000Z\",\"key\":1441065600000,\"doc_count\":24680},{\"key_as_string\":\"2015-10-01T00:00:00.000Z\",\"key\":1443657600000,\"doc_count\":18625},{\"key_as_string\":\"2015-11-01T00:00:00.000Z\",\"key\":1446336000000,\"doc_count\":43595},{\"key_as_string\":\"2015-12-01T00:00:00.000Z\",\"key\":1448928000000,\"doc_count\":62683}]}}\n```\n\nRight way to send aggregation to Elasticsearch to get proper response:\n\n\n## Example\n### Live Demo\nClimate at ISCPIF [https://climate.iscpif.fr/playground] (https://climate.iscpif.fr/playground)\n\n![Climate Demo](https://github.com/maziyarpanahi/es-punchcard/raw/master/demo-climatechange.png \"Climate Demo\")\n\n\n### JSFiddle\n\nIt is also available on JSFiddle [https://jsfiddle.net/maziyar/73da0urn/] (https://jsfiddle.net/maziyar/73da0urn/)\n\n### Native Demo\n\nSimply run \"bower install\" to install required libraries and open demo.html file.\n\n## Code of Conduct\n\nThis, and all github.com/multivacplatform projects, are under the [Multivac Platform Open Source Code of Conduct](https://github.com/multivacplatform/code-of-conduct/blob/master/code-of-conduct.md). Additionally, see the [Typelevel Code of Conduct](http://typelevel.org/conduct) for specific examples of harassing behavior that are not tolerated.\n\n\n## Credits\n### Inspired by\n\nRepository [https://github.com/mutanthumb/ETD_bubbles] (https://github.com/mutanthumb/ETD_bubbles)\n\n\nExample [http://neuralengr.com/asifr/journals] (http://neuralengr.com/asifr/journals/)\n\n### Used Libraries\nBootstrap [https://github.com/twbs/bootstrap] (https://github.com/twbs/bootstrap)\n\nD3 [https://github.com/mbostock/d3] (https://github.com/mbostock/d3)\n\njQuery [https://github.com/jquery/jquery] (https://github.com/jquery/jquery)\n\nMoment [https://github.com/moment/moment] (https://github.com/moment/moment)\n\n## TODO\n* Updating documentations\n* Connect mouse events to custome functions defined by user\n* Customized date format based on Elasticsearch Histogram results\n* Set start and end date dynamically from result by default\n\n## Copyright and License\n\nCode and documentation copyright (c) 2015-2019 [ISCPIF - CNRS](http://iscpif.fr). Code released under the [MIT license](https://github.com/multivacplatform/es-punchcard/blob/master/LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmultivacplatform%2Fes-punchcard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmultivacplatform%2Fes-punchcard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmultivacplatform%2Fes-punchcard/lists"}