{"id":13672970,"url":"https://github.com/feifang/vue-wordcloud","last_synced_at":"2025-04-28T04:30:45.846Z","repository":{"id":27304373,"uuid":"99998618","full_name":"feifang/vue-wordcloud","owner":"feifang","description":"A Vue.js Word Cloud component","archived":false,"fork":false,"pushed_at":"2022-12-09T07:34:46.000Z","size":2160,"stargazers_count":129,"open_issues_count":35,"forks_count":33,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-11-11T11:45:26.185Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Vue","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/feifang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-11T06:25:04.000Z","updated_at":"2024-10-15T06:46:34.000Z","dependencies_parsed_at":"2023-01-14T06:26:14.417Z","dependency_job_id":null,"html_url":"https://github.com/feifang/vue-wordcloud","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/feifang%2Fvue-wordcloud","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feifang%2Fvue-wordcloud/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feifang%2Fvue-wordcloud/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feifang%2Fvue-wordcloud/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/feifang","download_url":"https://codeload.github.com/feifang/vue-wordcloud/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251251854,"owners_count":21559669,"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":[],"created_at":"2024-08-02T09:02:01.288Z","updated_at":"2025-04-28T04:30:45.366Z","avatar_url":"https://github.com/feifang.png","language":"Vue","readme":"# vue-wordcloud\n\nA Vue.js Word Cloud component based on the original [d3-cloud](https://github.com/jasondavies/d3-cloud) plugin.\n\n**What's New?**\n\nV1.1 Nov 25, 2018:\n\n- Fix #6 add `showTooltip` option\n- Fix #5 add support for custom color scales\n\nV1.0.2 Aug 12, 2017:\n\n- Additional font scale options\n- Easy to use rotation setting\n\nFor details please refer to [options](https://github.com/feifang/vue-wordcloud#options).\n\n### Install\n```\nnpm install vue-wordcloud\n\n```\n\n### Import\n```\nimport wordcloud from 'vue-wordcloud'\n```\n\n### Examples\n\nUsing D3 color scheme Category10:\n\n![Word Cloud Example](wordcloud-min.png)\n\nUsing single color of your choice, e.g. `['#1f77b4']`:\n\n![Word Cloud Example](wordcloud-single-min.png)\n\nUsing single-hue color of your choice, e.g. `['#1f77b4', '#629fc9', '#94bedb', '#c9e0ef']`:\n\n![Word Cloud Example](wordcloud-blue-min.png)\n\nCode:\n```\n\u003ctemplate\u003e\n  \u003cdiv id=\"app\"\u003e\n      \u003cwordcloud\n      :data=\"defaultWords\"\n      nameKey=\"name\"\n      valueKey=\"value\"\n      :color=\"myColors\"\n      :showTooltip=\"true\"\n      :wordClick=\"wordClickHandler\"\u003e\n      \u003c/wordcloud\u003e\n  \u003c/div\u003e\n\u003c/template\u003e\n\n\u003cscript\u003e\nimport wordcloud from 'vue-wordcloud'\n\nexport default {\n  name: 'app',\n  components: {\n    wordcloud\n  },\n  methods: {\n    wordClickHandler(name, value, vm) {\n      console.log('wordClickHandler', name, value, vm);\n    }\n  },\n  data() {\n    return {\n      myColors: ['#1f77b4', '#629fc9', '#94bedb', '#c9e0ef'],\n      defaultWords: [{\n          \"name\": \"Cat\",\n          \"value\": 26\n        },\n        {\n          \"name\": \"fish\",\n          \"value\": 19\n        },\n        {\n          \"name\": \"things\",\n          \"value\": 18\n        },\n        {\n          \"name\": \"look\",\n          \"value\": 16\n        },\n        {\n          \"name\": \"two\",\n          \"value\": 15\n        },\n        {\n          \"name\": \"fun\",\n          \"value\": 9\n        },\n        {\n          \"name\": \"know\",\n          \"value\": 9\n        },\n        {\n          \"name\": \"good\",\n          \"value\": 9\n        },\n        {\n          \"name\": \"play\",\n          \"value\": 6\n        }\n      ]\n    }\n  }\n}\n\u003c/script\u003e\n```\n\nFor using [D3 categorical color schemes](https://github.com/d3/d3-scale-chromatic#categorical):\n```\n\u003ctemplate\u003e\n  \u003cdiv id=\"app\"\u003e\n      \u003cwordcloud\n      :data=\"defaultWords\"\n      nameKey=\"name\"\n      valueKey=\"value\"\n      color=\"Accent\"\u003e\n      \u003c/wordcloud\u003e\n  \u003c/div\u003e\n\u003c/template\u003e\n```\n\n### Options\n**选项**|**简介**|**默认值**|**说明**\n:-----:|:-----:|:-----:|:-----:\ndata|词云文本数据|defaultWords|数据格式：数组。数组中每个元素是对象{ 词：数值 }\nnameKey|数据中表示要显示的词的字段名称|'name'|-\nvalueKey|数据中表示词的权重的字段名称|'value'|-\nmargin|图表外边矩|{top: 15, right: 15, bottom: 15, left: 15 }|-\nwordPadding|词间间距|3|-\nrotate|词的旋转角度|{from: -60, to: 60, numOfOrientation: 5 }|可设置角度范围及角度的个数\nspiral|词的布局方式|'archimedian'|可选择'archimedian'或'rectangular'\nfontScale|词的大小缩放比例|'sqrt'|可选择'sqrt'，'log'或'n'\nfontSize|词的字号范围| `[10, 80]`| [minSize, maxSize]\nfont|词的字体名称，对应 `font-family` 的值 |\"impact\"|例如，衬线字体'serif'，非衬线字体'Arial'\ncolor|配色集合，可配置两种类型的值：String (D3 scheme name)，或 Array（自定义的颜色列表）|'Category10'|可采用D3内置的任意 Category 配色，或自定义的颜色列表；单色可通过传入只有一个颜色的数组实现，详见 [examples](https://github.com/feifang/vue-wordcloud#examples)\nshowTooltip|显示 Tooltip|true| true/false; tooltip 的样式（如宽高、颜色等）可以通过 CSS 类 `div.tooltip` 配置\nwordClick|词的点击事件的回调函数|null|函数传入三个变量，第一个是点击的词 `text`，第二个是该词对应的权重 `value`，第三个是 Vue 实例 `vm`\n\n\n\n### Todo\n- minimize component\n- add formatter option for tooltip\n- support D3 V5\n","funding_links":[],"categories":["Vue"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffeifang%2Fvue-wordcloud","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffeifang%2Fvue-wordcloud","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffeifang%2Fvue-wordcloud/lists"}