{"id":13531724,"url":"https://github.com/ambit-tsai/echarts-for-vue","last_synced_at":"2025-04-01T20:30:30.233Z","repository":{"id":49923927,"uuid":"297591773","full_name":"ambit-tsai/echarts-for-vue","owner":"ambit-tsai","description":"📊 📈 ECharts wrapper component for Vue 3, 2 and TypeScript","archived":false,"fork":false,"pushed_at":"2021-06-08T13:00:53.000Z","size":3300,"stargazers_count":80,"open_issues_count":1,"forks_count":11,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-26T03:34:35.131Z","etag":null,"topics":["chart","echarts","ts","typescript","vue","vue3"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ambit-tsai.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":"2020-09-22T08:56:10.000Z","updated_at":"2024-12-28T07:21:40.000Z","dependencies_parsed_at":"2022-08-28T23:30:11.697Z","dependency_job_id":null,"html_url":"https://github.com/ambit-tsai/echarts-for-vue","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ambit-tsai%2Fecharts-for-vue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ambit-tsai%2Fecharts-for-vue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ambit-tsai%2Fecharts-for-vue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ambit-tsai%2Fecharts-for-vue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ambit-tsai","download_url":"https://codeload.github.com/ambit-tsai/echarts-for-vue/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246709921,"owners_count":20821296,"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":["chart","echarts","ts","typescript","vue","vue3"],"created_at":"2024-08-01T07:01:05.163Z","updated_at":"2025-04-01T20:30:29.482Z","avatar_url":"https://github.com/ambit-tsai.png","language":"JavaScript","funding_links":[],"categories":["Frameworks","Packages","Components \u0026 Libraries","UI Components [🔝](#readme)"],"sub_categories":["Vue Component","UI Components"],"readme":"[简体中文](https://gitee.com/ambit/echarts-for-vue) | English\n\n\n# ECharts For Vue\u0026nbsp;\u0026nbsp;![Version](https://img.shields.io/npm/v/echarts-for-vue.svg)\n📊📈 ECharts wrapper component for Vue 3, 2 and TypeScript\n\n\n## Features\n1. Support for Vue 3 and 2;\n1. Support auto resize;\n1. Conform to the habits of Vue and ECharts users;\n1. Provide pure function API, no side effects;\n1. Lightweight encapsulation, easy to use;\n\n\n## Install\n```\nnpm i -S echarts-for-vue\n```\n\n\n## Usage\n1. Vue 3\n```javascript\nimport { createApp, h } from 'vue';\nimport { plugin } from 'echarts-for-vue';\nimport * as echarts from 'echarts';\n\nconst app = createApp({ /*...*/ });\napp.use(plugin, { echarts, h });                        // use as a plugin\n```\n```html\n\u003ctemplate\u003e\n    \u003cECharts ref=\"chart\" :option=\"option\" /\u003e\n\u003c/template\u003e\n\n\u003cscript\u003e\n    import { createComponent } from 'echarts-for-vue';\n    import * as echarts from 'echarts';\n    import { h } from 'vue';\n\n    export default {\n        components: {\n            ECharts: createComponent({ echarts, h }),   // use as a component\n        },\n        data: () =\u003e ({\n            option: { /*...*/ },\n        }),\n        methods: {\n            doSomething() {\n                this.$refs.chart.inst.getWidth();       // call the method of ECharts instance\n            },\n        },\n    }\n\u003c/script\u003e\n```\n\n2. Vue 2\n```javascript\nimport Vue from 'vue';\nimport { plugin } from 'echarts-for-vue';\nimport * as echarts from 'echarts';\n\nVue.use(plugin, { echarts });                           // use as a plugin\n```\n```html\n\u003ctemplate\u003e\n    \u003cECharts ref=\"chart\" :option=\"option\" /\u003e\n\u003c/template\u003e\n\n\u003cscript\u003e\n    import { createComponent } from 'echarts-for-vue';\n    import * as echarts from 'echarts';\n\n    export default {\n        components: {\n            ECharts: createComponent({ echarts }),      // use as a component\n        },\n        data: () =\u003e ({\n            option: { /*...*/ },\n        }),\n        methods: {\n            doSomething() {\n                this.$refs.chart.inst.getWidth();       // call the method of ECharts instance\n            },\n        },\n    }\n\u003c/script\u003e\n```\n3. \u003ca href=\"test\" target=\"_blank\"\u003eMore examples\u003c/a\u003e\n4. \u003ca href=\"https://ambit-tsai.github.io/echarts-for-vue/\" target=\"_blank\"\u003eOnline demo\u003c/a\u003e\n\n\n## Global API\n|Definition|Return|Description|\n|-|-|-|\n|`createComponent`(*options*: Options): object|Component definition object|Create a component|\n|`plugin`(*app*: Vue, *options*: Options): void||The installation method of plugin|\n\n\n## Options\n|Property|Type|Default|Optional|Description|\n|-|-|-|-|-|\n|echarts|typeof echarts|||The global object of ECharts library|\n|h|Function||✔|The method `createElement` of Vue (**Required** for Vue 3)|\n|ResizeObserver|typeof ResizeObserver|window.ResizeObserver|✔|When the global `ResizeObserver` doesn't exist, the \u003ca href=\"https://github.com/que-etc/resize-observer-polyfill\" target=\"_blank\"\u003epolyfill\u003c/a\u003e provides support|\n|name|string|\"ECharts\"|✔|The registered name of the component|\n|deepWatchOption|boolean|true|✔|deep watch prop \"option\"|\n\n\n## Instance Properties\n|Name|Type|ReadOnly|Description|\n|-|-|-|-|\n|inst|ECharts|✔|ECharts instance|\n\n\n## props\n|Name|Type|Default|Reactive|Description|\n|-|-|-|-|-|\n|initTheme|object \\| string||✔|The parameter `theme` of `echarts.init` method, \u003ca href=\"https://echarts.apache.org/en/api.html#echarts.init\" target=\"_blank\"\u003esee\u003c/a\u003e|\n|initOpts|object||✔|The parameter `opts` of `echarts.init` method, \u003ca href=\"https://echarts.apache.org/en/api.html#echarts.init\" target=\"_blank\"\u003esee\u003c/a\u003e|\n|loading|boolean|false|✔|Shows loading animation|\n|loadingType|string|\"default\"||The parameter `type` of ECharts instance method `showLoading`, \u003ca href=\"https://echarts.apache.org/en/api.html#echartsInstance.showLoading\" target=\"_blank\"\u003esee\u003c/a\u003e|\n|loadingOpts|EChartsLoadingOption|||The parameter `opts` of ECharts instance method `showLoading`, \u003ca href=\"https://echarts.apache.org/en/api.html#echartsInstance.showLoading\" target=\"_blank\"\u003esee\u003c/a\u003e|\n|option|EChartOption||✔|The parameter `option` of ECharts instance method `setOption`, \u003ca href=\"https://echarts.apache.org/en/api.html#echartsInstance.setOption\" target=\"_blank\"\u003esee\u003c/a\u003e|\n|optionOpts|EChartsOptionConfig|||The parameter `opts` of ECharts instance method `setOption`, \u003ca href=\"https://echarts.apache.org/en/api.html#echartsInstance.setOption\" target=\"_blank\"\u003esee\u003c/a\u003e|\n|events|Arguments[]|||An array element is the arguments of ECharts instance method `on`, \u003ca href=\"https://echarts.apache.org/en/api.html#echartsInstance.on\" target=\"_blank\"\u003esee\u003c/a\u003e|\n|autoResize|boolean|true|✔|Auto resize|\n\n***Beyond the `props` above, the remaining properties are passed to the root element of the component, such as `style`, `class` or `onclick`***\n\n\n## Events\n|Name|Description|\n|-|-|\n|resize|Trigger when chart is resized|\n\n\n## methods\n|Definition|Description|\n|-|-|\n|`setOption`(*option*: EChartOption, *opts*?: EChartsOptionConfig): void|Call the method `setOption` of ECharts instance, \u003ca href=\"https://echarts.apache.org/en/api.html#echartsInstance.setOption\" target=\"_blank\"\u003esee\u003c/a\u003e|\n|`resize`(): void|Resize chart (Based on the size of root element)|\n|`addResizeListener`(): void|Add \"resize\" listener|\n|`removeResizeListener`(): void|Remove \"resize\" listener|\n\n\n## Contact\n1. *WeChat*: cai_fanwei\n1. *QQ*: 854521460\n1. *QQ Group*: 663286147\n1. *E-mail*: ambit_tsai@qq.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fambit-tsai%2Fecharts-for-vue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fambit-tsai%2Fecharts-for-vue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fambit-tsai%2Fecharts-for-vue/lists"}