Merge pull request #26329 from tommilligan/recharts-axis-label-object

recharts X/YAxis label prop can be of type LabelProps
This commit is contained in:
Mine Starks
2018-06-13 08:44:57 -07:00
committed by GitHub
2 changed files with 4 additions and 8 deletions
+2 -2
View File
@@ -910,7 +910,7 @@ export interface XAxisProps extends EventAttributes {
interval?: AxisInterval;
reversed?: boolean;
// see label section at http://recharts.org/#/en-US/api/XAxis
label?: string | number | Label;
label?: string | number | Label | LabelProps;
}
export class XAxis extends React.Component<XAxisProps> { }
@@ -961,7 +961,7 @@ export interface YAxisProps extends EventAttributes {
interval?: AxisInterval;
reversed?: boolean;
// see label section at http://recharts.org/#/en-US/api/YAxis
label?: string | number | Label;
label?: string | number | Label | LabelProps;
}
export class YAxis extends React.Component<YAxisProps> { }
+2 -6
View File
@@ -136,12 +136,8 @@ class Component extends React.Component<{}, ComponentState> {
</ResponsiveContainer>
<ResponsiveContainer>
<LineChart width={500} height={300} data={data}>
<XAxis dataKey="name">
<Label>X axis - name</Label>
</XAxis>
<YAxis>
<Label>Y axis</Label>
</YAxis>
<XAxis dataKey="name" label={{ value: "X axis - name" }} />
<YAxis label={{ value: "Y axis" }} />
<CartesianGrid stroke="#eee" strokeDasharray="5 5" />
<Line type="monotone" dataKey="uv" stroke="#8884d8" onClick={ this.clickHandler } />
<Line type="monotone" dataKey="pv" stroke="#82ca9d" />