Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add showLegend #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/area_stack.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ export default class LineTooltip extends VoronoiEvt {
const {
width,
height,
focus
focus,
showLegend
} = this.props;

var focusDom;
Expand All @@ -41,9 +42,12 @@ export default class LineTooltip extends VoronoiEvt {
<Tooltip {...this.props} {...this.state}>
{this.props.children}
</Tooltip>
<Legend
{...this.props}
/>
{showLegend?
<Legend
{...this.props}
/>
: null
}
<Chart
{...this.props}
{...this.state}
Expand Down
12 changes: 8 additions & 4 deletions src/bar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,21 @@ export default class BarTooltip extends BarEvt {

const {
width,
height
height,
showLegend
} = this.props;

return (
<div>
<Tooltip {...this.props} {...this.state}>
{this.props.children}
</Tooltip>
<Legend
{...this.props}
/>
{showLegend?
<Legend
{...this.props}
/>
: null
}
<Chart
{...this.props}
{...this.state}
Expand Down
12 changes: 8 additions & 4 deletions src/bar_group.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,21 @@ export default class BarGroupTooltip extends BarEvt {

const {
width,
height
height,
showLegend
} = this.props;

return (
<div>
<Tooltip {...this.props} {...this.state}>
{this.props.children}
</Tooltip>
<Legend
{...this.props}
/>
{showLegend?
<Legend
{...this.props}
/>
: null
}
<Chart
{...this.props}
{...this.state}
Expand Down
12 changes: 8 additions & 4 deletions src/bar_stack.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,21 @@ export default class BarGroupTooltip extends BarEvt {

const {
width,
height
height,
showLegend
} = this.props;

return (
<div>
<Tooltip {...this.props} {...this.state}>
{this.props.children}
</Tooltip>
<Legend
{...this.props}
/>
{showLegend?
<Legend
{...this.props}
/>
: null
}
<Chart
{...this.props}
{...this.state}
Expand Down
6 changes: 4 additions & 2 deletions src/commonProps.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export default {
yScale: 'linear',
focus: true,
showXGrid: true,
showYGrid: true
showYGrid: true,
showLegend: true
}

export const pieProps = {
Expand All @@ -24,5 +25,6 @@ export const pieProps = {
margins: margins,
innerRadius: 0,
categoricalColors: d3.scale.category10(),
pieSort: d3.descending
pieSort: d3.descending,
showLegend: true
}
12 changes: 8 additions & 4 deletions src/line.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ export default class LineTooltip extends VoronoiEvt {
const {
width,
height,
focus
focus,
showLegend
} = this.props;

var focusDom;
Expand All @@ -44,9 +45,12 @@ export default class LineTooltip extends VoronoiEvt {
<Tooltip {...this.props} {...this.state}>
{this.props.children}
</Tooltip>
<Legend
{...this.props}
/>
{showLegend?
<Legend
{...this.props}
/>
: null
}
<Chart
{...this.props}
{...this.state}
Expand Down
12 changes: 8 additions & 4 deletions src/pie.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ export default class PieTooltip extends Component {

const {
width,
height
height,
showLegend
} = this.props;

const radius = this.props.radius || Math.min(width - 120, height - 120) / 2;
Expand All @@ -64,9 +65,12 @@ export default class PieTooltip extends Component {
<Tooltip {...this.props} {...this.state}>
{this.props.children}
</Tooltip>
<Legend
{...this.props}
/>
{showLegend?
<Legend
{...this.props}
/>
: null
}
<ChartPie
{...this.props}
>
Expand Down
12 changes: 8 additions & 4 deletions src/scatter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ export default class LineTooltip extends VoronoiEvt {
const {
width,
height,
focus
focus,
showLegend
} = this.props;

var focusDom;
Expand All @@ -42,9 +43,12 @@ export default class LineTooltip extends VoronoiEvt {
<Tooltip {...this.props} {...this.state}>
{this.props.children}
</Tooltip>
<Legend
{...this.props}
/>
{showLegend?
<Legend
{...this.props}
/>
: null
}
<Chart
{...this.props}
{...this.state}
Expand Down