From cd96316f6bf68c1881697760a120cb5292b2b555 Mon Sep 17 00:00:00 2001 From: ai-qing-hai Date: Mon, 11 Sep 2023 20:13:15 +0800 Subject: [PATCH] =?UTF-8?q?feat(examples):=20=E6=96=B0=E5=A2=9E=E5=AD=90?= =?UTF-8?q?=E5=BC=B9=E5=9B=BE=E6=A1=88=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../snapshots/static/intervalPointBullet.png | Bin 0 -> 7924 bytes .../static/intervalPointBulletDatas.png | Bin 0 -> 8212 bytes .../snapshots/static/intervalPointBullets.png | Bin 0 -> 11306 bytes __tests__/plots/static/index.ts | 3 + .../static/interval-point-bullet-datas.ts | 48 +++++++++++ .../plots/static/interval-point-bullet.ts | 36 ++++++++ .../plots/static/interval-point-bullets.ts | 41 +++++++++ .../general/bullet/demo/bullet-datas.ts | 79 ++++++++++++++++++ site/examples/general/bullet/demo/bullet.ts | 61 ++++++++++++++ site/examples/general/bullet/demo/bullets.ts | 79 ++++++++++++++++++ site/examples/general/bullet/demo/meta.json | 32 +++++++ site/examples/general/bullet/index.en.md | 4 + site/examples/general/bullet/index.zh.md | 4 + 13 files changed, 387 insertions(+) create mode 100644 __tests__/integration/snapshots/static/intervalPointBullet.png create mode 100644 __tests__/integration/snapshots/static/intervalPointBulletDatas.png create mode 100644 __tests__/integration/snapshots/static/intervalPointBullets.png create mode 100644 __tests__/plots/static/interval-point-bullet-datas.ts create mode 100644 __tests__/plots/static/interval-point-bullet.ts create mode 100644 __tests__/plots/static/interval-point-bullets.ts create mode 100644 site/examples/general/bullet/demo/bullet-datas.ts create mode 100644 site/examples/general/bullet/demo/bullet.ts create mode 100644 site/examples/general/bullet/demo/bullets.ts create mode 100644 site/examples/general/bullet/demo/meta.json create mode 100644 site/examples/general/bullet/index.en.md create mode 100644 site/examples/general/bullet/index.zh.md diff --git a/__tests__/integration/snapshots/static/intervalPointBullet.png b/__tests__/integration/snapshots/static/intervalP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;u(v+Wu}IS`TkGQFadO~MA$t2z`T4d|PPeWhvx|HMmunRD0ZPPWsC7Wo z?L-|9Q!9v-7HtEi`r*yVs?GU}3*4B^Wa2a$XjN*j39Fjo7uk?B3b~jAc^y=*P4WqJ zA%iK|q_sC!uWG7o!~4$Y+S6i&OEMozj=@awg^zvIy*e;K#*5)!1MV!}ijG!p)Gj|! zmopIXysFo)(h$3z?0HHRqp_N saU4Glt&a$ql3CyT|I~n|$y=sX8wNf6ebT>e7m6R;5pGrAU;p?208OalBLDyZ literal 0 HcmV?d00001 diff --git a/__tests__/integration/snapshots/static/intervalPointBullets.png b/__tests__/integration/snapshots/static/intervalPointBullets.png new file mode 100644 index 0000000000000000000000000000000000000000..e71a395fe0811df1be788d7f125d6074039aa9dd GIT binary patch literal 11306 zcmeHtcT`i`y6-{+HXcVV}5ypxtj{oIqh0tjm> zD?2h`=?6A4C3!d%j*c)v!z)+y3TUqIzIZ}?pTmdn32J(~NP zAyNKq^f9j&{izqXD>KTjMljHGL$4GIeA8OQjYe`Vh*tGX`ve|@aBy>#Gu-8n7n83w zC+xC45{jzp$8!V_d;+lqIudYp|B1%qqTWa57-LXUosBL?^L6obm76sxQmU;@Gx$_c zTp(%`r>-GLZb~!6b!jCZ0b8&{35xfwZ@P2M`WD^TVrR$biho0U#NL%pPH87Ir3G&r zrwfNw3<-I1iHVB*qyR5{JSP?@WPJ;qBv0Vk;D4VhXD~DKd0|V7JcYAJcErHw2^xo_^ zxKofwTSb!>;f!3D!D_*g3!lvTwk(`v#_@G44*8fByPiuS^oo$B*E{QxB51a@wKDCQ z+x|T{702+d3G<^Pk^0(b**3B_U4+qPexb@h*>6RjKoZ-0xLl;u^ zh2ap@_#vY*Igg^Ja&bcYb`)(s$Jk@Cg~^WWGn0v*=zd1rdHSh*yx;&J^FX0@C32jJs=Nu5S}{ne1>k&tRF;VX)Z; zkJ6(&ueD}@QS(T40mx?u6k#9Z)sK`Z&gHcTP_P2;6IP8`e)mTE!&f7UT+@K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U}sd$d_bsm01AJ**U8Vhx;W~SsHuhrdKFWMc;gu&?9N167Njxh9Fgp^5t1K48* zEqw%{*=rHOYaY;o*sDe))@mV*@sbw9zB-fC@C0|&w%$?nk*`S3Tyvdc8mUbvx zm(}_x8%lUl7a8w{E&%RsK4K=7WIMrG4nlY|JyM# z9<4{{?ysrY+-1&2dU9f|LDO^9$cqdd&(pI>>*d}_tu9n@?nJ|<*4COrGL58t%`yU3 znpNh1gxK?Madsv!M6T4kJ+G4m63_qYA1TrntH&N%UclNc>0)!Z6PmDC-rGyQhCPze zSa6n{IC_t%b=OUs(^Ig;FaOqS#b%Zd=Gto+)ctO%R2<)$4PY%|fCkAQch*GI=C zIHu>!$16?RFwXRA?xLKO}?tiVcGhGa+L#ZmpXxHt>;as=AcTdHC z1mEou*Tn_tMFu9*SKdO-=jQjP-gKFGAt52=@u|wwp%>?xh^W-z-O9&(Y4Cb>lnv(Q z4^B+^a!q+g?ZN)3!O*LP9RkX`yAJcjP3c ze7yx`N5F@Ro|b!f-XIcAsw(i<_CME(I!`Fb6rFF$W?m)s4ct{!hZWqmc=o>l+m@3C literal 0 HcmV?d00001 diff --git a/__tests__/plots/static/index.ts b/__tests__/plots/static/index.ts index ef14049358..fd4b43d98a 100644 --- a/__tests__/plots/static/index.ts +++ b/__tests__/plots/static/index.ts @@ -283,3 +283,6 @@ export { settleWeatherCellLineXY } from './seattle-weather-cell-lineXY'; export { alphabetIntervalFunnelConnectorLabel } from './alphabet-interval-funnel-connector-label'; export { alphabetIntervalAxisOptions } from './alphabet-interval-axis-options'; export { profitIntervalAxisTransform } from './profit-interval-axis-transform'; +export { intervalPointBullet } from './interval-point-bullet'; +export { intervalPointBullets } from './interval-point-bullets'; +export { intervalPointBulletDatas } from './interval-point-bullet-datas'; diff --git a/__tests__/plots/static/interval-point-bullet-datas.ts b/__tests__/plots/static/interval-point-bullet-datas.ts new file mode 100644 index 0000000000..25d7738ac1 --- /dev/null +++ b/__tests__/plots/static/interval-point-bullet-datas.ts @@ -0,0 +1,48 @@ +import { G2Spec } from '../../../src'; + +export function intervalPointBulletDatas(): G2Spec { + const colors = { + ranges: ['#bfeec8', '#FFe0b0', '#FFbcb8'], + measures: ['#61DDAA', '#5B8FF9'], + target: '#39a3f4', + }; + + return { + type: 'view', + data: [ + { title: '满意度', ranges: 100, measures: 60, target: 90 }, + { title: '满意度', ranges: 80, measures: 10 }, + { title: '满意度', ranges: 30 }, + ], + coordinate: { transform: [{ type: 'transpose' }] }, + legend: false, + children: [ + { + type: 'interval', + encode: { y: 'ranges', x: 'title', color: 'ranges' }, + style: { maxWidth: 30, fill: (d, i) => colors['ranges'][i] }, + axis: { y: { grid: true, gridLineWidth: 2 }, x: { title: false } }, + }, + { + type: 'interval', + encode: { y: 'measures', color: '#5B8FF9', x: 'title' }, + style: { maxWidth: 20, fill: (d, i) => colors['measures'][i] }, + labels: [ + { text: 'measures', position: 'right', textAlign: 'left', dx: 5 }, + ], + }, + { + type: 'point', + encode: { + size: 8, + y: 'target', + x: 'title', + shape: 'line', + color: '#39a3f4', + }, + style: { lineWidth: 1 }, + tooltip: { title: false, items: [{ channel: 'y' }] }, + }, + ], + }; +} diff --git a/__tests__/plots/static/interval-point-bullet.ts b/__tests__/plots/static/interval-point-bullet.ts new file mode 100644 index 0000000000..0f7a1aefbb --- /dev/null +++ b/__tests__/plots/static/interval-point-bullet.ts @@ -0,0 +1,36 @@ +import { G2Spec } from '../../../src'; + +export function intervalPointBullet(): G2Spec { + return { + type: 'view', + data: [{ title: '满意度', ranges: 100, measures: 80, target: 85 }], + coordinate: { transform: [{ type: 'transpose' }] }, + children: [ + { + type: 'interval', + encode: { x: 'title', y: 'ranges', color: '#f0efff' }, + style: { maxWidth: 30 }, + axis: { y: { grid: true, gridLineWidth: 2 }, x: { title: false } }, + }, + { + type: 'interval', + encode: { x: 'title', y: 'measures', color: '#5B8FF9' }, + style: { maxWidth: 20 }, + labels: [ + { text: 'measures', position: 'right', textAlign: 'left', dx: 5 }, + ], + }, + { + type: 'point', + encode: { + size: 8, + x: 'title', + y: 'target', + shape: 'line', + color: '#3D76DD', + }, + tooltip: { title: false, items: [{ channel: 'y' }] }, + }, + ], + }; +} diff --git a/__tests__/plots/static/interval-point-bullets.ts b/__tests__/plots/static/interval-point-bullets.ts new file mode 100644 index 0000000000..23618ae3fe --- /dev/null +++ b/__tests__/plots/static/interval-point-bullets.ts @@ -0,0 +1,41 @@ +import { G2Spec } from '../../../src'; + +export function intervalPointBullets(): G2Spec { + return { + type: 'view', + data: [ + { title: '5🌟', ranges: 100, measures: 40, target: 85 }, + { title: '4🌟', ranges: 100, measures: 80, target: 40 }, + { title: '3🌟', ranges: 100, measures: 20, target: 22 }, + { title: '0-2🌟', ranges: 100, measures: 30, target: 10 }, + ], + coordinate: { transform: [{ type: 'transpose' }] }, + children: [ + { + type: 'interval', + encode: { x: 'title', y: 'ranges', color: '#f0efff' }, + style: { maxWidth: 30 }, + axis: { y: { grid: true, gridLineWidth: 2 }, x: { title: false } }, + }, + { + type: 'interval', + encode: { x: 'title', y: 'measures', color: '#5B8FF9' }, + style: { maxWidth: 20 }, + labels: [ + { text: 'measures', position: 'right', textAlign: 'left', dx: 5 }, + ], + }, + { + type: 'point', + encode: { + size: 15, + x: 'title', + y: 'target', + shape: 'line', + color: 'red', + }, + tooltip: { title: false, items: [{ channel: 'y' }] }, + }, + ], + }; +} diff --git a/site/examples/general/bullet/demo/bullet-datas.ts b/site/examples/general/bullet/demo/bullet-datas.ts new file mode 100644 index 0000000000..6c82a4b12c --- /dev/null +++ b/site/examples/general/bullet/demo/bullet-datas.ts @@ -0,0 +1,79 @@ +import { Chart } from '@antv/g2'; + +const chart = new Chart({ + container: 'container', +}); + +const colors = { + ranges: ['#bfeec8', '#FFe0b0', '#FFbcb8'], + measures: ['#61DDAA', '#5B8FF9'], + target: '#39a3f4', +}; + +const data = [ + { + title: '满意度', + ranges: 100, + measures: 60, + target: 90, + }, + { + title: '满意度', + ranges: 80, + measures: 10, + }, + { + title: '满意度', + ranges: 30, + }, +]; + +chart.coordinate({ transform: [{ type: 'transpose' }] }); + +chart.data(data).legend(false); + +chart + .interval() + .style('maxWidth', 30) + .axis({ + y: { + grid: true, + gridLineWidth: 2, + }, + x: { + title: false, + }, + }) + .encode('y', 'ranges') + .encode('x', 'title') + .style('fill', (d, i) => colors['ranges'][i]) + .encode('color', 'ranges'); + +chart + .interval() + .style('maxWidth', 20) + .encode('y', 'measures') + .encode('color', '#5B8FF9') + .encode('x', 'title') + .style('fill', (d, i) => colors['measures'][i]) + .label({ + text: 'measures', + position: 'right', + textAlign: 'left', + dx: 5, + }); + +chart + .point() + .encode('size', 8) + .style('lineWidth', 1) + .encode('y', 'target') + .encode('x', 'title') + .encode('shape', 'line') + .encode('color', colors['target']) + .tooltip({ + title: false, + items: [{ channel: 'y' }], + }); + +chart.render(); diff --git a/site/examples/general/bullet/demo/bullet.ts b/site/examples/general/bullet/demo/bullet.ts new file mode 100644 index 0000000000..d7bc89db94 --- /dev/null +++ b/site/examples/general/bullet/demo/bullet.ts @@ -0,0 +1,61 @@ +import { Chart } from '@antv/g2'; + +const chart = new Chart({ + container: 'container', +}); + +const data = [ + { + title: '满意度', + ranges: 100, + measures: 80, + target: 85, + }, +]; + +chart.coordinate({ transform: [{ type: 'transpose' }] }); + +chart.data(data); + +chart + .interval() + .style('maxWidth', 30) + .axis({ + y: { + grid: true, + gridLineWidth: 2, + }, + x: { + title: false, + }, + }) + .encode('x', 'title') + .encode('y', 'ranges') + .encode('color', '#f0efff'); + +chart + .interval() + .style('maxWidth', 20) + .encode('x', 'title') + .encode('y', 'measures') + .encode('color', '#5B8FF9') + .label({ + text: 'measures', + position: 'right', + textAlign: 'left', + dx: 5, + }); + +chart + .point() + .encode('size', 8) + .encode('x', 'title') + .encode('y', 'target') + .encode('shape', 'line') + .encode('color', '#3D76DD') + .tooltip({ + title: false, + items: [{ channel: 'y' }], + }); + +chart.render(); diff --git a/site/examples/general/bullet/demo/bullets.ts b/site/examples/general/bullet/demo/bullets.ts new file mode 100644 index 0000000000..6b993edcc6 --- /dev/null +++ b/site/examples/general/bullet/demo/bullets.ts @@ -0,0 +1,79 @@ +import { Chart } from '@antv/g2'; + +const chart = new Chart({ + container: 'container', +}); + +const data = [ + { + title: '5🌟', + ranges: 100, + measures: 40, + target: 85, + }, + { + title: '4🌟', + ranges: 100, + measures: 80, + target: 40, + }, + { + title: '3🌟', + ranges: 100, + measures: 20, + target: 22, + }, + { + title: '0-2🌟', + ranges: 100, + measures: 30, + target: 10, + }, +]; + +chart.coordinate({ transform: [{ type: 'transpose' }] }); + +chart.data(data); + +chart + .interval() + .style('maxWidth', 30) + .axis({ + y: { + grid: true, + gridLineWidth: 2, + }, + x: { + title: false, + }, + }) + .encode('x', 'title') + .encode('y', 'ranges') + .encode('color', '#f0efff'); + +chart + .interval() + .style('maxWidth', 20) + .encode('x', 'title') + .encode('y', 'measures') + .encode('color', '#5B8FF9') + .label({ + text: 'measures', + position: 'right', + textAlign: 'left', + dx: 5, + }); + +chart + .point() + .encode('size', 15) + .encode('x', 'title') + .encode('y', 'target') + .encode('shape', 'line') + .encode('color', 'red') + .tooltip({ + title: false, + items: [{ channel: 'y' }], + }); + +chart.render(); diff --git a/site/examples/general/bullet/demo/meta.json b/site/examples/general/bullet/demo/meta.json new file mode 100644 index 0000000000..4cd13caccd --- /dev/null +++ b/site/examples/general/bullet/demo/meta.json @@ -0,0 +1,32 @@ +{ + "title": { + "zh": "中文分类", + "en": "Category" + }, + "demos": [ + { + "filename": "bullet.ts", + "title": { + "zh": "子弹图", + "en": "Bullet" + }, + "screenshot": "https://mdn.alipayobjects.com/huamei_za7we3/afts/img/A*rRZQQ6I4Ic4AAAAAAAAAAAAADo2bAQ/original" + }, + { + "filename": "bullet-datas.ts", + "title": { + "zh": "子弹图 更多数据", + "en": "Bullet more data" + }, + "screenshot": "https://mdn.alipayobjects.com/huamei_za7we3/afts/img/A*fHiHTrdGO10AAAAAAAAAAAAADo2bAQ/original" + }, + { + "filename": "bullets.ts", + "title": { + "zh": "多条子弹图", + "en": "Bullet charts" + }, + "screenshot": "https://mdn.alipayobjects.com/huamei_za7we3/afts/img/A*wTXUQoxeACgAAAAAAAAAAAAADo2bAQ/original" + } + ] +} diff --git a/site/examples/general/bullet/index.en.md b/site/examples/general/bullet/index.en.md new file mode 100644 index 0000000000..6743667be0 --- /dev/null +++ b/site/examples/general/bullet/index.en.md @@ -0,0 +1,4 @@ +--- +title: Bullet +order: 18 +--- \ No newline at end of file diff --git a/site/examples/general/bullet/index.zh.md b/site/examples/general/bullet/index.zh.md new file mode 100644 index 0000000000..876f91f63d --- /dev/null +++ b/site/examples/general/bullet/index.zh.md @@ -0,0 +1,4 @@ +--- +title: 子弹图 +order: 18 +--- \ No newline at end of file