You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by wi...@apache.org on 2021/09/01 19:58:20 UTC

[incubator-streampipes] branch dev updated: [STREAMPIPES-422] Fix chart update of word cloud widget on new events

This is an automated email from the ASF dual-hosted git repository.

wiener pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git


The following commit(s) were added to refs/heads/dev by this push:
     new 15479cb  [STREAMPIPES-422] Fix chart update of word cloud widget on new events
15479cb is described below

commit 15479cb6a8a0bdc22d60c9c9bc56073cb44941e1
Author: Patrick Wiener <wi...@fzi.de>
AuthorDate: Wed Sep 1 21:58:11 2021 +0200

    [STREAMPIPES-422] Fix chart update of word cloud widget on new events
---
 .../widgets/wordcloud/wordcloud-widget.component.ts         | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/ui/src/app/dashboard/components/widgets/wordcloud/wordcloud-widget.component.ts b/ui/src/app/dashboard/components/widgets/wordcloud/wordcloud-widget.component.ts
index 46bf5e2..f2a3178 100644
--- a/ui/src/app/dashboard/components/widgets/wordcloud/wordcloud-widget.component.ts
+++ b/ui/src/app/dashboard/components/widgets/wordcloud/wordcloud-widget.component.ts
@@ -63,7 +63,7 @@ export class WordcloudWidgetComponent extends BaseStreamPipesWidget implements O
       height: '100%',
       right: null,
       bottom: null,
-      sizeRange: [8, 50],
+      sizeRange: [12, 60],
       rotationRange: [-90, 90],
       rotationStep: 45,
       gridSize: 8,
@@ -97,6 +97,11 @@ export class WordcloudWidgetComponent extends BaseStreamPipesWidget implements O
     super(rxStompService, dashboardService, resizeService, false);
   }
 
+  ngOnInit(): void {
+    super.ngOnInit();
+    this.onSizeChanged(this.gridsterItemComponent.width, this.gridsterItemComponent.height);
+  }
+
   protected extractConfig(extractor: StaticPropertyExtractor) {
     this.countProperty = extractor.mappingPropertyValue(WordCloudConfig.COUNT_PROPERTY_KEY);
     this.nameProperty = extractor.mappingPropertyValue(WordCloudConfig.NAME_PROPERTY_KEY);
@@ -115,7 +120,9 @@ export class WordcloudWidgetComponent extends BaseStreamPipesWidget implements O
     if (this.dynamicData.series[0].data.length > this.windowSize) {
       this.dynamicData.series[0].data.shift();
     }
-    this.eChartsInstance.setOption(this.dynamicData);
+    if (this.eChartsInstance) {
+      this.eChartsInstance.setOption(this.dynamicData);
+    }
   }
 
   protected onSizeChanged(width: number, height: number) {
@@ -125,7 +132,7 @@ export class WordcloudWidgetComponent extends BaseStreamPipesWidget implements O
     this.applySize(width, height);
   }
 
-  onChartInit(ec) {
+  onChartInit(ec: ECharts) {
     this.eChartsInstance = ec;
     this.applySize(this.currentWidth, this.currentHeight);
   }