Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
componentDidMount () {
const { totaledRows, filteredRows, onSelect, selected } = this.props
const plotGroupItems = []
this.totaledRowsDataset = new Plottable.Dataset(totaledRows)
.metadata({ colorBucket: 5 })
this.filteredRowsDataset = new Plottable.Dataset(filteredRows)
.metadata({ colorBucket: 3 })
const xScale = new Plottable.Scales.Time()
.padProportion(0) // remove outer padding
const xAxis = new Plottable.Axes.Time(xScale, 'bottom')
const yScale = new Plottable.Scales.Linear()
const colorScale = new Plottable.Scales.InterpolatedColor()
.range(['#5279C7', '#BDCEF0'])
this.plot = new Plottable.Plots.Area()
.addDataset(this.totaledRowsDataset)
.addDataset(this.filteredRowsDataset)
.attr('fill', (datum, index, dataset) => dataset.metadata().colorBucket, colorScale)
.x((datum) => new Date(datum.label), xScale)
.y((datum) => datum.value, yScale)
.animated(true)
plotGroupItems.push(this.plot)
const selectedData = (selected) ? [selected.value] : []
this.selectedDataset = new Plottable.Dataset(selectedData)
componentDidMount () {
const { totaledRows, filteredRows, onSelect, selected } = this.props
this.totaledRowsDataset = new Plottable.Dataset(totaledRows)
.metadata({ colorBucket: 5 })
this.filteredRowsDataset = new Plottable.Dataset(filteredRows)
.metadata({ colorBucket: 3 })
const xScale = new Plottable.Scales.Category()
const xAxis = new Plottable.Axes.Category(xScale, 'bottom')
const yScale = new Plottable.Scales.Linear()
const colorScale = new Plottable.Scales.InterpolatedColor()
.range(['#5279C7', '#BDCEF0'])
this.plot = new Plottable.Plots.Bar()
.addDataset(this.totaledRowsDataset)
.addDataset(this.filteredRowsDataset)
.attr('fill', (datum, index, dataset) => dataset.metadata().colorBucket, colorScale)
.x((datum) => datum.label, xScale)
.y((datum) => datum.value, yScale)
.animated(true)
// .labelsEnabled(true)
const selectedData = (selected) ? [selected.value] : []
this.selectedDataset = new Plottable.Dataset(selectedData)