This repository has been archived by the owner on Sep 17, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix grid axis appearing on top of the lines (#197)
* Fix grid appearing on top of lines * Update snapshots * Add GridAxis to Bar and Scatterplot
- Loading branch information
1 parent
bff54fe
commit 3267c55
Showing
12 changed files
with
169 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
Copyright 2016 Capital One Services, LLC | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and limitations under the License. | ||
SPDX-Copyright: Copyright (c) Capital One Services, LLC | ||
SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React, { Component } from 'react' | ||
import { G, Path } from 'react-native-svg' | ||
import _ from 'lodash' | ||
import { AxisStruct } from './Axis' | ||
|
||
export default class GridAxis extends Component { | ||
|
||
render() { | ||
const { chartArea, options, scale } = this.props | ||
const horizontal = options.orient ==='top' || options.orient ==='bottom' | ||
|
||
const axis = new AxisStruct(scale,options,chartArea,horizontal).axis() | ||
|
||
if (typeof options.gridColor !== 'string') { | ||
options.gridColor = '#3E90F0' | ||
} | ||
|
||
if (typeof options.opacity !== 'number') { | ||
options.opacity = 0.5 | ||
} | ||
|
||
const gridLines = options.showLines ? _.map(axis.lines, function (c, i) { | ||
return ( | ||
<Path key={'gridLines' + i} d={c.print()} strokeOpacity={options.opacity} stroke={options.gridColor} fill="none"/> | ||
) | ||
}) : [] | ||
|
||
let offset = { | ||
x: chartArea.margin.left * -1, | ||
y: chartArea.margin.top * -1 | ||
}; | ||
|
||
let returnV = <G x={offset.x} y={offset.y}> | ||
{gridLines} | ||
</G>; | ||
|
||
return returnV | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.