diff --git a/packages/vstory/demo/src/App.tsx b/packages/vstory/demo/src/App.tsx index c8395953..8371ca03 100644 --- a/packages/vstory/demo/src/App.tsx +++ b/packages/vstory/demo/src/App.tsx @@ -43,6 +43,7 @@ import { BarWorkingInSameIndustry } from './demos/infographic/bar-work-in-same-i import { ProjectGoal } from './demos/infographic/project-goal'; import { BigDataWordCloud } from './demos/infographic/big-data-wordcloud'; import { AreaChart } from './demos/infographic/source-of-new-contacts-area-chart'; +import { MarketingWordcloud } from './demos/infographic/marking-wordcloud'; type MenusType = ( | { @@ -254,6 +255,10 @@ const App = () => { { name: 'Source of New Contacts Area Chart', component: AreaChart + }, + { + name: 'Marketing WordCloud', + component: MarketingWordcloud } ] }, diff --git a/packages/vstory/demo/src/demos/infographic/marking-wordcloud.tsx b/packages/vstory/demo/src/demos/infographic/marking-wordcloud.tsx new file mode 100644 index 00000000..2ffd1e34 --- /dev/null +++ b/packages/vstory/demo/src/demos/infographic/marking-wordcloud.tsx @@ -0,0 +1,368 @@ +import React, { createRef, useEffect } from 'react'; +import { Player, Story } from '../../../../../vstory-core/src'; +import { registerAll } from '../../../../../vstory/src'; + +registerAll(); +export const MarketingWordcloud = () => { + const id = 'MarketingWordcloud'; + useEffect(() => { + const container = document.getElementById(id); + const canvas = document.createElement('canvas'); + container?.appendChild(canvas); + + const chartPath = + 'M948.6 627c1.2-2 2.6-4 3.8-5.8 8-12.4 15.2-25.4 21.4-39 6.2-13.6 11.4-27.4 15.6-41.8 4.2-14.4 7.4-28.8 9.6-43.6 2.2-14.8 3.2-29.6 3.2-44.6 0.6-172.6-140.2-312.6-314.2-312.6-151.8 0-278.4 106.8-308.2 248.8-4.4 21-6.8 42.4-6.8 64 0 172.8 135.4 316.6 309.4 316.6 27.6 0 65-8.6 85.4-14.4 20.4-5.8 40.8-13.4 46-15.6 5.2-2 13.4-4.2 20-2.2l130 39c1.2 0.4 2.4 0.4 3.6 0 1.2-0.4 2.2-0.8 3-1.8 0.8-0.8 1.4-2 1.8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15L277.2 910c0 0.2 0 0.6-0.2 0.8v1c0 0.4 0 0.6 0.2 0.8 0 0.2 0.2 0.6 0.2 0.8 0 0.2 0.2 0.6 0.4 0.8 0.2 0.2 0.2 0.6 0.4 0.8 0.2 0.2 0.4 0.4 0.6 0.8l0.6 0.6 0.6 0.6c0.2 0.2 0.4 0.4 0.8 0.4 0.2 0.2 0.6 0.2 0.8 0.4 0.2 0 0.6 0.2 0.8 0.2 0.2 0 0.6 0 0.8 0.2h0.8c0.2 0 0.6 0 0.8-0.2 0.2 0 0.6-0.2 0.8-0.2l114.2-42.2c3.4-1.4 7.2-2.2 10.8-2 3.8 0 7.4 0.8 10.8 2.4 34.2 14 72 22.4 109.8 22.4 9 0 18-0.4 27-1.2 9-0.8 17.8-2.2 26.6-3.8 8.8-1.8 17.6-3.8 26.2-6.4 8.6-2.6 17.2-5.6 25.6-9a274.252 274.252 0 0 0 48-25.2c7.6-5 15-10.4 22-16 7.2-5.8 14-11.8 20.4-18.2 0.6-0.6 1-1.2 1.4-1.8 0.4-0.8 0.6-1.4 0.8-2.2 0.2-0.8 0.2-1.6 0-2.4-0.2-0.8-0.4-1.6-0.6-2.2-0.4-0.8-0.8-1.4-1.4-2-0.6-0.6-1.2-1-1.8-1.4-0.6-0.4-1.4-0.6-2.2-0.8-0.8 0.2-1.4 0.2-2.2 0.2z'; + + const dsl = { + acts: [ + { + id: 'defaultAct', + scenes: [ + { + id: 'defaultScene', + actions: [ + { + characterId: [ + 'background-1', + 'background-2', + 'title', + 'chart', + 'list-1-icon', + 'list-1-text', + 'list-2-icon', + 'list-2-text', + 'list-3-icon', + 'list-3-text', + 'list-4-icon', + 'list-4-text' + ], + characterActions: [ + { + action: 'appear' + } + ] + } + ] + } + ] + } + ], + characters: [ + { + id: 'background-1', + type: 'Rect', + zIndex: 0, + position: { + x: -150, + y: 610, + width: 400, + height: 400, + + angle: Math.PI / 4 - 0.2 + }, + options: { + graphic: { + fill: 'rgb(242,242,242)' + } + } + }, + { + id: 'background-2', + type: 'Rect', + zIndex: 0, + position: { + x: -150, + y: 600, + width: 300, + height: 300, + angle: Math.PI / 4 + }, + options: { + graphic: { + fill: 'rgb(217,217,217)' + } + } + }, + { + id: 'title', + type: 'Text', + zIndex: 0, + position: { + x: 420, + y: 50, + width: 600, + height: 200 + }, + options: { + graphic: { + text: 'Marketing Wordcloud', + textAlign: 'left', + fontSize: 40, + fontWeight: 'bold', + fill: '#000' + } + } + }, + { + id: 'chart', + type: 'VChart', + zIndex: 0, + position: { + x: 120, + y: 140, + width: 600, + height: 450 + }, + options: { + spec: { + type: 'wordCloud', + maskShape: + '', + nameField: 'name', + valueField: 'value', + seriesField: 'name', + seriesStyle: [ + { + name: 'MARKETING', + word: { + style: { + fill: 'rgb(51,133,105)' + } + } + } + ], + colorList: ['#000'], + wordCloudShapeConfig: { + fillingColorList: ['#000'] + }, + data: [ + { + name: 'data', + values: [ + { name: 'MARKETING', value: 1000 }, + { name: 'SALES', value: 500 }, + { name: 'INTERNET', value: 500 }, + { name: 'ACCOUNT', value: 500 }, + { name: 'DEVELOP', value: 200 }, + { name: 'ORGANIZATION', value: 200 }, + { name: 'CUSTOMERS', value: 200 }, + { name: 'BUDGET', value: 200 }, + { name: 'RESEARCH', value: 100 }, + { name: 'SOCIAL', value: 10 }, + { name: 'AGGRESSIVE', value: 10 }, + { name: 'PLANNING', value: 10 }, + { name: 'MEDIA', value: 10 }, + { name: 'TARGET', value: 10 }, + { name: 'ADVANCE', value: 10 }, + { name: 'INNOVATE', value: 10 }, + { name: 'IDEA', value: 10 }, + { name: 'TEAM', value: 10 }, + { name: 'PROMOTION', value: 10 }, + { name: 'ACCOMPLISHMENT', value: 10 }, + { name: 'BELIEF', value: 10 }, + { name: 'NEWS', value: 10 }, + { name: 'SUCCESS', value: 10 }, + { name: 'GROWING', value: 10 }, + { name: 'SEGMENT', value: 10 }, + { name: 'DIVISION', value: 10 }, + { name: 'STRATEGY', value: 10 }, + { name: 'REFRESH', value: 10 }, + { name: 'DESIGN', value: 10 }, + { name: 'CONTEST', value: 10 }, + { name: 'ARCHITECTURE', value: 10 }, + { name: 'CREATIVE', value: 10 }, + { name: 'COMPANY', value: 10 }, + { name: 'INQUIRY', value: 10 }, + { name: 'DESTINATION', value: 10 }, + { name: 'MATCH', value: 10 }, + { name: 'ADMIT', value: 10 }, + { name: 'AMOUNT', value: 10 }, + { name: 'FORWARD', value: 10 }, + { name: 'ACCEPT', value: 10 }, + { name: 'COOL', value: 10 }, + { name: 'VIRAL', value: 10 }, + { name: 'MASS', value: 10 }, + { name: 'CONSTRUCTION', value: 10 }, + { name: 'INNOVATION', value: 10 } + ] + } + ], + color: { + type: 'ordinal', + // domain: ['a', 'b'], + // range: ['#000', '#000'], + specified: { + MARKETING: 'green', + d: 'red' + } + } + } + } + }, + { + id: 'list-1-icon', + type: 'Shape', + zIndex: 0, + position: { + x: 700, + y: 155, + width: 30, + height: 30 + }, + options: { + graphic: { + symbolType: chartPath, + fill: '#ddd' + } + } + }, + { + id: 'list-1-text', + type: 'Text', + zIndex: 0, + position: { + x: 780, + y: 163, + width: 450, + height: 200 + }, + options: { + graphic: { + text: 'MARKETING strategies require continuous INNOVATION and CREATIVE approaches to effectively engage CUSTOMERS.', + textAlign: 'left', + fontSize: 18, + fontWeight: 'bold', + fill: '#aaa', + wordBreak: 'break-word' + } + } + }, + { + id: 'list-2-icon', + type: 'Shape', + zIndex: 0, + position: { + x: 700, + y: 255, + width: 30, + height: 30 + }, + options: { + graphic: { + symbolType: chartPath, + fill: '#ddd' + } + } + }, + { + id: 'list-2-text', + type: 'Text', + zIndex: 0, + position: { + x: 780, + y: 260, + width: 450, + height: 200 + }, + options: { + graphic: { + text: 'Successful SALES not only depend on the BUDGET but also on thorough RESEARCH and market INQUIRY.', + textAlign: 'left', + fontSize: 18, + fontWeight: 'bold', + fill: '#aaa', + wordBreak: 'break-word' + } + } + }, + { + id: 'list-3-icon', + type: 'Shape', + zIndex: 0, + position: { + x: 700, + y: 355, + width: 30, + height: 30 + }, + options: { + graphic: { + symbolType: chartPath, + fill: '#ddd' + } + } + }, + { + id: 'list-3-text', + type: 'Text', + zIndex: 0, + position: { + x: 780, + y: 360, + width: 450, + height: 200 + }, + options: { + graphic: { + text: 'In the INTERNET age, SOCIAL media plays a crucial role in PROMOTION and reaching the TARGET audience.', + textAlign: 'left', + fontSize: 18, + fontWeight: 'bold', + fill: '#aaa', + wordBreak: 'break-word' + } + } + }, + { + id: 'list-4-icon', + type: 'Shape', + zIndex: 0, + position: { + x: 700, + y: 455, + width: 30, + height: 30 + }, + options: { + graphic: { + symbolType: chartPath, + fill: '#ddd' + } + } + }, + { + id: 'list-4-text', + type: 'Text', + zIndex: 0, + position: { + x: 780, + y: 460, + width: 450, + height: 200 + }, + options: { + graphic: { + text: 'A strong ORGANIZATION focuses on PLANNING and DEVELOP to achieve SUCCESS and ACCOMPLISHMENT in their goals.', + textAlign: 'left', + fontSize: 18, + fontWeight: 'bold', + fill: '#aaa', + wordBreak: 'break-word' + } + } + } + ] + }; + + const story = new Story(dsl, { canvas, width: 1280, height: 720, background: '#FFF' }); + const player = new Player(story); + story.init(player); + player.play(-1); + + return () => { + story.release(); + }; + }, []); + + return
; +}; diff --git a/packages/vstory/demo/src/demos/infographic/source-of-new-contacts-area-chart.tsx b/packages/vstory/demo/src/demos/infographic/source-of-new-contacts-area-chart.tsx index 47851ca9..ce400d8e 100644 --- a/packages/vstory/demo/src/demos/infographic/source-of-new-contacts-area-chart.tsx +++ b/packages/vstory/demo/src/demos/infographic/source-of-new-contacts-area-chart.tsx @@ -217,7 +217,7 @@ export const AreaChart = () => { }, options: { graphic: { - shape: 'circle', + symbolType: 'circle', fill: 'rgb(244,211,94)' } } @@ -254,7 +254,7 @@ export const AreaChart = () => { }, options: { graphic: { - shape: 'circle', + symbolType: 'circle', fill: 'rgb(249,87,56)' } } @@ -291,7 +291,7 @@ export const AreaChart = () => { }, options: { graphic: { - shape: 'circle', + symbolType: 'circle', fill: 'rgb(91,192,235)' } } @@ -328,7 +328,7 @@ export const AreaChart = () => { }, options: { graphic: { - shape: 'circle', + symbolType: 'circle', fill: 'rgb(155,197,61)' } }