{"id":20348702,"url":"https://github.com/jevonsflash/echartsgen","last_synced_at":"2025-04-12T01:21:01.217Z","repository":{"id":207153282,"uuid":"718550843","full_name":"jevonsflash/EChartsGen","owner":"jevonsflash","description":"纯后端ECharts库","archived":false,"fork":false,"pushed_at":"2024-08-23T03:24:21.000Z","size":44457,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-25T21:02:33.307Z","etag":null,"topics":["echarts","npoi","phantomjs"],"latest_commit_sha":null,"homepage":"https://blog.csdn.net/jevonsflash","language":"C#","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/jevonsflash.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2023-11-14T10:14:32.000Z","updated_at":"2024-08-23T03:24:24.000Z","dependencies_parsed_at":"2024-11-14T22:33:09.179Z","dependency_job_id":null,"html_url":"https://github.com/jevonsflash/EChartsGen","commit_stats":null,"previous_names":["jevonsflash/echartsgen"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jevonsflash%2FEChartsGen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jevonsflash%2FEChartsGen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jevonsflash%2FEChartsGen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jevonsflash%2FEChartsGen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jevonsflash","download_url":"https://codeload.github.com/jevonsflash/EChartsGen/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248501855,"owners_count":21114684,"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":["echarts","npoi","phantomjs"],"created_at":"2024-11-14T22:21:47.517Z","updated_at":"2025-04-12T01:21:01.184Z","avatar_url":"https://github.com/jevonsflash.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# EChartsGen\n\n在后端使用ECharts库，将ECharts图表Png图像文件导出到本地磁盘\n\n![EChartsGen](./Assets/p1.png)\n\n## 快速开始\n\n1. 在项目中引用[EChartsGen]( https://www.nuget.org/packages/EChartsGen)\n\n```\ndotnet add package EChartsGen\n```\n\n2. 指定一个option用于生成Echarts\n\n\u003e option是一个json对象，用于配置图表的各个属性，从而定义图表的展示形式。详情请查看官网：https://echarts.apache.org/zh/option.html\n\n```\nExporter exporter = new Exporter();\nvar pngPath = await exporter.ExportAsync(new EChartsGen.ExportOption() { ChartOptionPath = \"D:/option.json\", OutputPath=\"D:/out\" });\n```\n\n或使用Option对象参数\n\n```\nExporter exporter = new Exporter();\n\nvar title = \"血压监测结果分析\"; var passCount = 40; var failedCount = 2;\nvar pngPath = exporter.ExportAsync(new EChartsGen.ExportOption()\n{\n    Height = 400,\n    Width = 580,\n    ChartOption = new ChartOption()\n    {\n        title = new List\u003cTitle\u003e()\n        {\n            new Title (){\n            text=title, left=\"center\"}\n        },\n        tooltip = new ToolTip(),\n        legend = new Legend()\n        {\n            orient = OrientType.vertical,\n            left = \"left\"\n        },\n        series = new object[]\n        {\n            new {\n                name= \"Access From\",\n                type=\"pie\",\n                data=new object[]\n                    {\n                        new  { value= failedCount, name=\"异常\" },\n                        new  { value= passCount, name=\"正常\" },\n                    }\n            }\n        }\n    },\n    OutputPath=\"D:/out\"\n})\n```\n\n查看结果：\n\n![EChartsGen](./Assets/p2.png)\n\n\n## ExportOption 说明\n\n* ChartOptionPath - Option的json文件路径\n* ChartOption - Option的.Net对象\n* Height - 图片高度\n* Width - 图片宽度\n* OutputPath - 图片文件的生成目录,若为空则默认生成至工作目录下`\\libs\\phantomjs-2.1.1-windows\\tmp`\n\nChartOptionPath和ChartOption二选一，如果同时指定，优先使用ChartOptionPath。\n图片的高度和宽度默认为1920*800，你可以根据实际情况调整。\n\n\n\n\n## 示例\n\n1. 运行单元测试\n2. 使用文档模板生成工具将ECharts图形填充到Word文档示例，请前往[EChartsGen_DocTemplateTool_Sample](./EChartsGen_DocTemplateTool_Sample/)\n\n\n## 更新内容\n\n|  Date  |  Version   | Content                                                                                         |\n| :----: | :--------: | :---------------------------------------------------------------------------------------------- |\n| V0.1.0 | 2023-11-15  | 初始版本                                                                           \n| V0.1.1 | 2024-8-22  | 修复phantomjs报错   \n| V0.1.2 | 2024-8-23  | 添加OutputPath参数\n\n## 已知问题\n\n\n\n## 作者信息\n\n作者：林小\n\n邮箱：jevonsflash@qq.com\n\n\n\n## License\n\nThe MIT License (MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjevonsflash%2Fechartsgen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjevonsflash%2Fechartsgen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjevonsflash%2Fechartsgen/lists"}