@@ -56,13 +56,6 @@ const isDataset = computed({
5656 }
5757});
5858
59- const drawableDataset = ref (typeof props .dataset === ' string' ? createWordCloudDatasetFromPlainText (props .dataset ) : props .dataset .map ((dp , i ) => {
60- return {
61- ... dp,
62- value: checkNaN (dp .value )
63- }
64- }));
65-
6659const uid = ref (createUid ());
6760const step = ref (0 );
6861const wordCloudChart = ref (null );
@@ -81,6 +74,22 @@ const FINAL_CONFIG = computed({
8174 }
8275});
8376
77+ const drawableDataset = ref (setupWordCloud ());
78+
79+ function setupWordCloud () {
80+ return typeof props .dataset === ' string' ? createWordCloudDatasetFromPlainText (props .dataset ) : props .dataset .map ((dp , i ) => {
81+ return {
82+ ... dp,
83+ value: checkNaN (dp .value )
84+ }
85+ })
86+ }
87+
88+ watch (() => props .dataset , () => {
89+ drawableDataset .value = setupWordCloud ();
90+ generateWordCloud ();
91+ })
92+
8493const { userOptionsVisible , setUserOptionsVisibility , keepUserOptionState } = useUserOptionState ({ config: FINAL_CONFIG .value });
8594const { svgRef } = useChartAccessibility ({ config: FINAL_CONFIG .value .style .chart .title });
8695
@@ -436,7 +445,7 @@ function useTooltip(word) {
436445 :style =" `width: 100%; font-family:${FINAL_CONFIG.style.fontFamily};background:${FINAL_CONFIG.style.chart.backgroundColor};${FINAL_CONFIG.responsive ? 'height:100%' : ''}`" @mouseenter =" () => setUserOptionsVisibility(true)" @mouseleave =" () => setUserOptionsVisibility(false)" >
437446 <PenAndPaper
438447 v-if =" FINAL_CONFIG.userOptions.buttons.annotator"
439- :parent = " wordCloudChart "
448+ :svgRef = " svgRef "
440449 :backgroundColor =" FINAL_CONFIG.style.chart.backgroundColor"
441450 :color =" FINAL_CONFIG.style.chart.color"
442451 :active =" isAnnotator"
0 commit comments