{"id":16200850,"url":"https://github.com/observedobserver/mdx-g2","last_synced_at":"2025-04-07T18:16:02.773Z","repository":{"id":102838070,"uuid":"141727721","full_name":"ObservedObserver/mdx-g2","owner":"ObservedObserver","description":"a tool turn mdx to g2","archived":false,"fork":false,"pushed_at":"2018-07-30T05:49:53.000Z","size":152,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-13T20:14:29.769Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/ObservedObserver.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-20T15:19:23.000Z","updated_at":"2023-06-26T09:50:56.000Z","dependencies_parsed_at":"2023-03-13T15:14:28.014Z","dependency_job_id":null,"html_url":"https://github.com/ObservedObserver/mdx-g2","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/ObservedObserver%2Fmdx-g2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ObservedObserver%2Fmdx-g2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ObservedObserver%2Fmdx-g2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ObservedObserver%2Fmdx-g2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ObservedObserver","download_url":"https://codeload.github.com/ObservedObserver/mdx-g2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247704573,"owners_count":20982298,"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-10-10T09:34:31.084Z","updated_at":"2025-04-07T18:16:02.745Z","avatar_url":"https://github.com/ObservedObserver.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MDX to G2\n\u003e 将mdx转化为g2\n\n你可能需要先了解：\n+ [MDX](https://docs.microsoft.com/en-us/sql/analysis-services/multidimensional-models/mdx/mdx-query-fundamentals-analysis-services?view=sql-server-2017)\n+ [G2](https://antv.alipay.com/zh-cn/g2/3.x/index.html)\n## 安装\n```bash\nnpm i\n\nnpm start\n```\n访问[localhost:3000](http://localhost:3000)\n\n## 使用\n\n```js\nimport Chart from './components/mdxChart.js'\n// here are three examples\nconst mdx1 = 'select {[restaurant]} on row, {[food]} on column from [dataSource] where {[price], [rating]}'\nconst mdx2 = 'select {[restaurant]} on row, {[rating], [price]} on column from [dataSource]'\nconst mdx3 = 'select {[rating], [price]} on row, {[restaurant]} on column from [dataSource]'\nReactDOM.render(\u003cChart dataSource={dataSource} mdx={mdx1}  /\u003e, document.getElementById('root'));\n```\n\n## demo\n![](http://carrot.zone:8080/mdx2g2.gif)\n![](http://carrot.zone:8080/mdx2g2-2.gif)\n## 示例\n选择Cube: `VideoWebsites`\u003cbr\u003e\n由`where`选取度量\n```sql\nselect {[department]} on row, {[video]} on column from [VideoWebsites] where {[profit], [count]}\n```\n\n选择Cube: `VideoWebsites`\n由`row`或`column`选取度量\n```sql\nselect {[department], [video]} on row, {[profit]} on column from [VideoWebsites]\n```\n\n散点图\n```sql\nselect {[profit]} on row, {[count]} on column from [VideoWebsites] where {[department]}\n```\n\n## TODO\n+ [x] 数据聚合处理\n+ [x] 维度数量限制解除\n+ [x] 度量预处理, 所有度量转化到度量维度中\n+ [ ] 更科学的mdx-parser(tokenizer, AST)\n+ [x] 支持row与column均为度量的图表\n+ [ ] 支持部分图表（散点图）的非聚合数据展示（聚合、非聚合切换）\n+ [ ] mdx扩展语法（可能会扩展为g2）\n+ [x] 封装成更易复用的组件，\n+ [ ] 包含base版本与react版本\n+ [ ] 严格的元组与集合的概念\n+ [ ] 支持层级，属性，成员\n+ [ ] 更自由的聚合运算方式(可以保留原始数据)\n\n## ISSUES\n+ [ ] mdx解析尾部需添加额外的空格或回车\n+ [ ] 聚合底层没有安全检测，在聚合value为非数字时递归栈溢出\n### 有趣的探索\n+ [ ] 基于3D/4D(动态))可视化的pivot或mdx组件","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fobservedobserver%2Fmdx-g2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fobservedobserver%2Fmdx-g2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fobservedobserver%2Fmdx-g2/lists"}