You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by eb...@apache.org on 2020/05/13 10:37:32 UTC
[incubator-streampipes] 07/09: Add (if existing) labels obtained
from database to line chart
This is an automated email from the ASF dual-hosted git repository.
ebi pushed a commit to branch timeseries-labeling
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git
commit f645dc950f0bde6200820a622e3dd73f6f087534
Author: Daniel Ebi <eb...@fzi.de>
AuthorDate: Wed May 13 10:58:27 2020 +0200
Add (if existing) labels obtained from database to line chart
---
ui/src/app/core-ui/linechart/lineChart.component.ts | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/ui/src/app/core-ui/linechart/lineChart.component.ts b/ui/src/app/core-ui/linechart/lineChart.component.ts
index 39cc377..dc34750 100644
--- a/ui/src/app/core-ui/linechart/lineChart.component.ts
+++ b/ui/src/app/core-ui/linechart/lineChart.component.ts
@@ -141,13 +141,19 @@ export class LineChartComponent extends BaseChartComponent implements OnChanges
displayData(transformedData: DataResult, yKeys: string[]) {
if (this.yKeys.length > 0) {
const tmp = [];
+ tmp['measureName'] = transformedData.measureName;
this.yKeys.forEach(key => {
transformedData.rows.forEach(serie => {
if (serie.name === key) {
tmp.push(serie);
// adding customdata property in order to store labels in graph
- serie['customdata'] = Array(serie['x'].length).fill('');
+ if (transformedData.labels !== undefined && transformedData.labels.length !== 0) {
+ serie['customdata'] = transformedData.labels;
+ }
+ else {
+ serie['customdata'] = Array(serie['x'].length).fill('');
+ }
// adding custom hovertemplate in order to display labels in graph
serie['hovertemplate'] = 'y: %{y}<br>' + 'x: %{x}<br>' + 'label: %{customdata}';
}
@@ -156,14 +162,8 @@ export class LineChartComponent extends BaseChartComponent implements OnChanges
this.dataToDisplay = tmp;
-
- /**
- * TODO: fetching stored labels, filling this.labels and drawing related shapes
- */
-
} else {
this.dataToDisplay = undefined;
-
}
}