aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/DataVizBox/components/LineChart.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/DataVizBox/components/LineChart.tsx')
-rw-r--r--src/client/views/nodes/DataVizBox/components/LineChart.tsx19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/client/views/nodes/DataVizBox/components/LineChart.tsx b/src/client/views/nodes/DataVizBox/components/LineChart.tsx
index 47ac751cd..8d6671e65 100644
--- a/src/client/views/nodes/DataVizBox/components/LineChart.tsx
+++ b/src/client/views/nodes/DataVizBox/components/LineChart.tsx
@@ -272,12 +272,25 @@ export class LineChart extends ObservableReactComponent<LineChartProps> {
const data = dataSet[0];
const lineGen = createLineGenerator(xScale, yScale);
var validData = data.filter(d => {
- var valid = true;
Object.keys(data[0]).map(key => {
- if (!d[key] || Number.isNaN(d[key])) valid = false;
+ if (!d[key] || Number.isNaN(d[key])) return false;
});
- return valid;
+ return true;
});
+
+ if (this._props.axes.length>2){
+ var next = this._tableData.map(record => ({ x: Number(record[this._props.axes[0]]), y: Number(record[this._props.axes[2]]) })).sort((a, b) => (a.x < b.x ? -1 : 1));
+ var validNext = next.filter(d => {
+ // Object.keys(next[0]).map(key => {
+ // if (!d[key] || Number.isNaN(d[key])) return false;
+ // });
+ if (!d.x || Number.isNaN(d.x) || !d.y || Number.isNaN(d.y)) valid = false;
+ return true;
+ });
+ drawLine(svg.append('path'), validNext, lineGen);
+ this.drawDataPoints(validNext, 0, xScale, yScale);
+ }
+
// draw the plot line
drawLine(svg.append('path'), validData, lineGen);
// draw the datapoint circle