@@ -34,7 +34,7 @@ import {
3434 createAreas
3535} from "./visualizationLayerBehavior/general"
3636
37- import { relativeY , findPointByID } from "./svg/lineDrawing"
37+ import { relativeY , relativeX , findPointByID } from "./svg/lineDrawing"
3838import AnnotationCallout from "react-annotation/lib/Types/AnnotationCallout"
3939
4040import {
@@ -48,7 +48,10 @@ import {
4848 projectedY ,
4949 projectedYTop ,
5050 projectedYMiddle ,
51- projectedYBottom
51+ projectedYBottom ,
52+ projectedXMiddle ,
53+ projectedXTop ,
54+ projectedXBottom
5255} from "./constants/coordinateNames"
5356import {
5457 calculateDataExtent ,
@@ -233,7 +236,10 @@ const projectedCoordinateNames = {
233236 x : projectedX ,
234237 yMiddle : projectedYMiddle ,
235238 yTop : projectedYTop ,
236- yBottom : projectedYBottom
239+ yBottom : projectedYBottom ,
240+ xMiddle : projectedXMiddle ,
241+ xTop : projectedXTop ,
242+ xBottom : projectedXBottom
237243}
238244
239245function mapParentsToPoints ( fullDataset : Array < Object > ) {
@@ -619,6 +625,7 @@ class XYFrame extends React.Component<XYFrameProps, State> {
619625
620626 const existingBaselines = { }
621627
628+
622629 if ( currentProps . axes ) {
623630 axesTickLines = [ ]
624631 axes = currentProps . axes . map ( ( d , i ) => {
@@ -919,20 +926,20 @@ class XYFrame extends React.Component<XYFrameProps, State> {
919926 } )
920927
921928 if ( ! d . coordinates && ! d . bounds ) {
922- const xCoord = d [ projectedX ] || findFirstAccessorValue ( xAccessor , d )
923929 screenCoordinates = [
924- xScale ( xCoord ) ,
930+ relativeX ( {
931+ point : d ,
932+ projectedXMiddle,
933+ projectedX,
934+ xAccessor,
935+ xScale
936+ } ) ,
925937 relativeY ( {
926938 point : d ,
927- lines,
928939 projectedYMiddle,
929940 projectedY,
930- projectedX,
931- xAccessor,
932941 yAccessor,
933- yScale,
934- xScale,
935- idAccessor
942+ yScale
936943 } )
937944 ]
938945
@@ -948,7 +955,14 @@ class XYFrame extends React.Component<XYFrameProps, State> {
948955 }
949956 } else if ( ! d . bounds ) {
950957 screenCoordinates = d . coordinates . reduce ( ( coords , p ) => {
951- const xCoordinate = xScale ( findFirstAccessorValue ( xAccessor , p ) ) + adjustedPosition [ 0 ]
958+ const xCoordinate = relativeX ( {
959+ point : p ,
960+ projectedXMiddle,
961+ projectedX,
962+ xAccessor,
963+ xScale
964+ } )
965+
952966 const yCoordinate = relativeY ( {
953967 point : p ,
954968 lines,
@@ -964,6 +978,9 @@ class XYFrame extends React.Component<XYFrameProps, State> {
964978 if ( Array . isArray ( yCoordinate ) ) {
965979 return [ ...coords , [ xCoordinate , Math . min ( ...yCoordinate ) ] , [ xCoordinate , Math . max ( ...yCoordinate ) ] ]
966980 }
981+ else if ( Array . isArray ( xCoordinate ) ) {
982+ return [ ...coords , [ Math . min ( ...xCoordinate ) , yCoordinate ] , [ Math . max ( ...xCoordinate ) , yCoordinate ] ]
983+ }
967984 else {
968985 return [ ...coords , [ xCoordinate , yCoordinate ] ]
969986 } } , [ ] )
@@ -1112,8 +1129,8 @@ class XYFrame extends React.Component<XYFrameProps, State> {
11121129 return null
11131130 }
11141131
1115- const xCoord = d [ projectedX ] || findFirstAccessorValue ( xAccessor , d )
1116- const yCoord = d [ projectedY ] || findFirstAccessorValue ( yAccessor , d )
1132+ const xCoord = d [ projectedXMiddle ] || d [ projectedX ] || findFirstAccessorValue ( xAccessor , d )
1133+ const yCoord = d [ projectedYMiddle ] || d [ projectedY ] || findFirstAccessorValue ( yAccessor , d )
11171134
11181135 const xString = xCoord && xCoord . toString ? xCoord . toString ( ) : xCoord
11191136 const yString = yCoord && yCoord . toString ? yCoord . toString ( ) : yCoord
0 commit comments