11import React from "react" ;
22import XYGraph from "../XYGraph" ;
3- import { Actions } from "../../App/redux/actions" ;
43import { connect } from "react-redux" ;
54
65import {
@@ -14,7 +13,6 @@ import {
1413 select ,
1514 brushX ,
1615 voronoi ,
17- merge ,
1816 event
1917} from "d3" ;
2018
@@ -42,7 +40,6 @@ class LineGraph extends XYGraph {
4240 chartHeightToPixel,
4341 chartWidthToPixel,
4442 circleToPixel,
45- colorColumn,
4643 colors,
4744 legend,
4845 linesColumn,
@@ -79,8 +76,8 @@ class LineGraph extends XYGraph {
7976 } ) ;
8077
8178 let filterDatas = [ ] ;
82- data . map ( ( d ) => {
83- legendsData . map ( ( ld ) => {
79+ data . forEach ( ( d ) => {
80+ legendsData . forEach ( ( ld ) => {
8481 filterDatas . push ( Object . assign ( {
8582 yColumn : d [ ld [ 'key' ] ] ,
8683 columnType : ld [ 'key' ]
@@ -89,10 +86,14 @@ class LineGraph extends XYGraph {
8986 } ) ;
9087
9188 const isVerticalLegend = legend . orientation === 'vertical' ;
92- const xLabelFn = ( d ) => d [ xColumn ] ;
89+
90+ const xLabelFn = ( d ) => d [ xColumn ] ;
91+
92+ const yLabelUnformattedFn = ( d ) => d [ 'yColumn' ] ;
93+
9394 const yLabelFn = ( d ) => {
9495 if ( ! yTickFormat ) {
95- return d ;
96+ return d [ 'yColumn' ] ;
9697 }
9798 const formatter = format ( yTickFormat ) ;
9899 return formatter ( d [ 'yColumn' ] ) ;
@@ -103,19 +104,15 @@ class LineGraph extends XYGraph {
103104 const scale = this . scaleColor ( legendsData , 'key' ) ;
104105 const getColor = ( d ) => scale ? scale ( d [ 'key' ] ) : stroke . color || colors [ 0 ] ;
105106
106-
107107 let xAxisHeight = xLabel ? chartHeightToPixel : 0 ;
108108 let legendWidth = legend . show && legendsData . length >= 1 ? this . longestLabelLength ( legendsData , legendFn ) * chartWidthToPixel : 0 ;
109109
110- let xLabelWidth = this . longestLabelLength ( data , xLabelFn ) * chartWidthToPixel ;
111110 let yLabelWidth = this . longestLabelLength ( filterDatas , yLabelFn ) * chartWidthToPixel ;
112111
113112 let leftMargin = margin . left + yLabelWidth ;
114113 let availableWidth = width - ( margin . left + margin . right + yLabelWidth ) ;
115114 let availableHeight = height - ( margin . top + margin . bottom + chartHeightToPixel + xAxisHeight ) ;
116115
117-
118-
119116 if ( legend . show )
120117 {
121118 legend . width = legendWidth ;
@@ -136,7 +133,8 @@ class LineGraph extends XYGraph {
136133 const xScale = scaleTime ( )
137134 . domain ( extent ( data , xLabelFn ) ) ;
138135 const yScale = scaleLinear ( )
139- . domain ( extent ( filterDatas , yLabelFn ) ) ;
136+ . domain ( extent ( filterDatas , yLabelUnformattedFn ) ) ;
137+
140138
141139 xScale . range ( [ 0 , availableWidth ] ) ;
142140 yScale . range ( [ availableHeight , 0 ] ) ;
0 commit comments