Yaxis component documents. Yaxis is a component, which including Axis, Label components.
var Yaxis = require('react-d3-core').Yaxis;
You can customize Yaxis
component using the following properties.
- width
- height
- margins
- showYAxis
- yAxisClassName
- y
- yDomain
- yRange
- yScale
- yRangeRoundBands
- TickOrient
- yTickPadding
- yInnerTickSize
- yOuterTickSize
- yTickFormat
- yTicks
- setScale
- yLabelPosition (see Label -> labelPosition setting)
- yLabel (see Label -> labelTitle setting)
- labelOffset (see Label -> labelOffset setting)
default as 960
(number)
width
prop is the width of the parent svg
that wrap the legend component.
default as 500
(number)
height
prop is the height of the parent svg
that wrap the legend component.
default as {top: 50, right: 50, bottom: 50, left: 50}
(object)
margins
prop is the margins of the parent svg
that wrap the legend component.
default as react-d3-core__axis__yAxis
(string)
gridAxisClassName
is the setting that set the class of the <g class="your-grid-class-name">
Required (function with return value)
y
is the accessor function of your y
axis data. For instance, you have a data like.
[
{
"name":"Darron Weissnat IV",
"BMI":20.72,
"age":39,
"birthday":"2005-01-03T00:00:00.000Z",
"city":"East Russel",
"married":false,
"index":0
},
{
"name":"Pablo Ondricka",
"BMI":19.32,
"age":38,
"birthday":"1974-05-13T00:00:00.000Z",
"city":"Lake Edytheville",
"married":false,
"index":1
},
{
"name":"Mr. Stella Kiehn Jr.",
"BMI":16.8,
"age":34,
"birthday":"2003-07-25T00:00:00.000Z",
"city":"Lake Veronicaburgh",
"married":false,
"index":2
},
{
"name":"Lavon Hilll I",
"BMI":20.57,
"age":12,
"birthday":"1994-10-26T00:00:00.000Z",
"city":"Annatown",
"married":true,
"index":3
}
]
and you want to have index as your y
value, you just set your y
value to
y = (d) => {
return d.index;
}
Required (array)
Your yDomain
prop is to set your yaxis domain, which is your input domain of your y scale. In most cases, it is something like [min value, max value]
.
Required (array)
default as [height - margins.top - margins.bottom, 0]
Your yRange
prop is to set your axis range, which is your output range of your y scale. In most cases, it is [height - margins.top - margins.bottom, 0]
Required a d3 scale (should be one of the types )
default as linear
We support scale types:
- linear
- identity
- sqrt
- pow
- log
- quantize
- quantile
- ordinal
- time
Optional (object)
If you need to setup your rangeRoundBands
at your y axis. You have to pass an object to the prop with your interval or padding or outerPadding.
{
"interval": "<your interval>",
"padding": "<your padding>",
"outerPadding": "<your outerPadding>"
}