-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(line): add ability to customize line width
- Loading branch information
Raphaël Benitte
committed
Sep 9, 2017
1 parent
bee8de3
commit 8cb8847
Showing
4 changed files
with
124 additions
and
106 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
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,108 @@ | ||
/* | ||
* This file is part of the nivo project. | ||
* | ||
* Copyright 2016-present, Raphaël Benitte. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
import PropTypes from 'prop-types' | ||
import { lineCurvePropType } from '../../../props' | ||
|
||
export const LinePropTypes = { | ||
// data | ||
data: PropTypes.arrayOf( | ||
PropTypes.shape({ | ||
id: PropTypes.string.isRequired, | ||
data: PropTypes.arrayOf( | ||
PropTypes.shape({ | ||
x: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired, | ||
y: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired, | ||
}) | ||
).isRequired, | ||
}) | ||
).isRequired, | ||
|
||
stacked: PropTypes.bool.isRequired, | ||
curve: lineCurvePropType.isRequired, | ||
lineGenerator: PropTypes.func.isRequired, | ||
|
||
lines: PropTypes.array.isRequired, | ||
slices: PropTypes.array.isRequired, | ||
|
||
minY: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.oneOf(['auto'])]) | ||
.isRequired, | ||
maxY: PropTypes.oneOfType([PropTypes.number, PropTypes.string, PropTypes.oneOf(['auto'])]) | ||
.isRequired, | ||
xScale: PropTypes.func.isRequired, // computed | ||
yScale: PropTypes.func.isRequired, // computed | ||
|
||
// axes & grid | ||
axisTop: PropTypes.object, | ||
axisRight: PropTypes.object, | ||
axisBottom: PropTypes.object, | ||
axisLeft: PropTypes.object, | ||
enableGridX: PropTypes.bool.isRequired, | ||
enableGridY: PropTypes.bool.isRequired, | ||
|
||
// dots | ||
enableDots: PropTypes.bool.isRequired, | ||
dotSymbol: PropTypes.func, | ||
dotSize: PropTypes.number.isRequired, | ||
dotColor: PropTypes.any.isRequired, | ||
dotBorderWidth: PropTypes.number.isRequired, | ||
dotBorderColor: PropTypes.any.isRequired, | ||
enableDotLabel: PropTypes.bool.isRequired, | ||
|
||
// markers | ||
markers: PropTypes.arrayOf( | ||
PropTypes.shape({ | ||
axis: PropTypes.oneOf(['x', 'y']).isRequired, | ||
value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired, | ||
style: PropTypes.object, | ||
}) | ||
), | ||
|
||
// theming | ||
getColor: PropTypes.func.isRequired, | ||
lineWidth: PropTypes.number.isRequired, | ||
|
||
// interactivity | ||
isInteractive: PropTypes.bool.isRequired, | ||
enableStackTooltip: PropTypes.bool.isRequired, | ||
} | ||
|
||
export const LineDefaultProps = { | ||
indexBy: 'id', | ||
keys: ['value'], | ||
|
||
stacked: false, | ||
curve: 'linear', | ||
|
||
// scales | ||
minY: 0, | ||
maxY: 'auto', | ||
|
||
// axes & grid | ||
axisBottom: {}, | ||
axisLeft: {}, | ||
enableGridX: true, | ||
enableGridY: true, | ||
|
||
// dots | ||
enableDots: true, | ||
dotSize: 6, | ||
dotColor: 'inherit', | ||
dotBorderWidth: 0, | ||
dotBorderColor: 'inherit', | ||
enableDotLabel: false, | ||
|
||
// theming | ||
colors: 'nivo', | ||
colorBy: 'id', | ||
lineWidth: 2, | ||
|
||
// interactivity | ||
isInteractive: true, | ||
enableStackTooltip: true, | ||
} |