aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/DataVizBox/components/LineChart.tsx
diff options
context:
space:
mode:
authorgeireann <geireann.lindfield@gmail.com>2023-04-10 15:32:06 -0400
committergeireann <geireann.lindfield@gmail.com>2023-04-10 15:32:06 -0400
commit3cb7f85b23eb0ae3a432bbe15b8a2cda37290ce2 (patch)
tree6292360e91abe3f675768e11b6d70f64f421b7ad /src/client/views/nodes/DataVizBox/components/LineChart.tsx
parent6520bb8594b6cee9a4df09b25adf7aa590ef29e4 (diff)
fixed linechart margins
Diffstat (limited to 'src/client/views/nodes/DataVizBox/components/LineChart.tsx')
-rw-r--r--src/client/views/nodes/DataVizBox/components/LineChart.tsx12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/client/views/nodes/DataVizBox/components/LineChart.tsx b/src/client/views/nodes/DataVizBox/components/LineChart.tsx
index ecb06f64f..777bf2f66 100644
--- a/src/client/views/nodes/DataVizBox/components/LineChart.tsx
+++ b/src/client/views/nodes/DataVizBox/components/LineChart.tsx
@@ -74,7 +74,7 @@ export class LineChart extends React.Component<LineChartProps> {
}
componentDidMount = () => {
this._disposers.chartData = reaction(
- () => ({ dataSet: this._lineChartData, w: this.props.width, h: this.props.height }),
+ () => ({ dataSet: this._lineChartData, w: this.width, h: this.height }),
({ dataSet, w, h }) => {
if (dataSet) {
this.drawChart([dataSet], this.rangeVals, w, h);
@@ -227,16 +227,16 @@ export class LineChart extends React.Component<LineChartProps> {
}
// creating the x and y scales
- const xScale = scaleCreatorNumerical(xMin, xMax, 0, this.width);
- const yScale = scaleCreatorNumerical(0, yMax, this.height, 0);
+ const xScale = scaleCreatorNumerical(xMin, xMax, 0, width);
+ const yScale = scaleCreatorNumerical(0, yMax,height, 0);
// adding svg
const margin = this.props.margin;
const svg = (this._lineChartSvg = d3
.select(this._lineChartRef.current)
.append('svg')
- .attr('width', `${width - margin.right - margin.left}`)
- .attr('height', `${height - margin.top - margin.bottom}`)
+ .attr('width', `${width +margin.left + margin.right}`)
+ .attr('height', `${height + margin.top + margin.bottom }`)
.append('g')
.attr('transform', `translate(${margin.left}, ${margin.top})`));
@@ -281,7 +281,7 @@ export class LineChart extends React.Component<LineChartProps> {
svg.append('rect')
.attr('class', 'overlay')
- .attr('width', this.width)
+ .attr('width', width)
.attr('height', this.height + margin.top + margin.bottom)
.attr('fill', 'none')
.attr('translate', `translate(${margin.left}, ${-(margin.top + margin.bottom)})`)