Skip to content
This repository has been archived by the owner on Sep 17, 2021. It is now read-only.

adds showAreas prop - allows user to define if areas are shown #7

Merged
merged 1 commit into from
Oct 10, 2016
Merged
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
11 changes: 8 additions & 3 deletions src/Line.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,17 @@ export default class LineChart extends Component {
margin:options.margin
}

let showAreas = typeof(this.props.options.showAreas) != 'undefined' ? this.props.options.showAreas : true;
let lines = _.map(chart.curves, function (c, i) {
return <Path key={'lines' + i} d={ c.line.path.print() } stroke={ this.color(i) } fill="none"/>
}.bind(this))
let areas = _.map(chart.curves, function (c, i) {
return <Path key={'areas' + i} d={ c.area.path.print() } fillOpacity={0.5} stroke="none" fill={ this.color(i) }/>
}.bind(this))
let areas = null;

if(showAreas){
areas = _.map(chart.curves, function (c, i) {
return <Path key={'areas' + i} d={ c.area.path.print() } fillOpacity={0.5} stroke="none" fill={ this.color(i) }/>
}.bind(this))
}

let offset = {
x: chartArea.margin.left * -1,
Expand Down