|
|
@ -282,9 +282,11 @@ export class ChartwerkBarPod extends ChartwerkPod<BarSerie, BarOptions> { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
get barWidth(): number { |
|
|
|
get barWidth(): number { |
|
|
|
// TODO: here we use first value + timeInterval as bar width. It is not a good idea
|
|
|
|
|
|
|
|
const xAxisStartValue = _.first(this.series.visibleSeries[0].datapoints)[0]; |
|
|
|
const xAxisStartValue = _.first(this.series.visibleSeries[0].datapoints)[0]; |
|
|
|
let width = this.state.xScale(xAxisStartValue + this.timeInterval) / 2; |
|
|
|
const xAxisEndValue = _.last(this.series.visibleSeries[0].datapoints)[0]; |
|
|
|
|
|
|
|
const timeInterval = (xAxisEndValue - xAxisStartValue) / this.series.visibleSeries[0].datapoints.length; |
|
|
|
|
|
|
|
console.log(xAxisStartValue, xAxisEndValue, timeInterval); |
|
|
|
|
|
|
|
let width = this.state.xScale(timeInterval) / 2; |
|
|
|
if(this.options.barOptions.barWidth !== undefined) { |
|
|
|
if(this.options.barOptions.barWidth !== undefined) { |
|
|
|
// barWidth now has axis-x dimension
|
|
|
|
// barWidth now has axis-x dimension
|
|
|
|
width = this.state.xScale(this.state.getMinValueX() + this.options.barOptions.barWidth); |
|
|
|
width = this.state.xScale(this.state.getMinValueX() + this.options.barOptions.barWidth); |
|
|
|