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

fix: only add buckets at the end if last bucket not fully included #234

Merged
merged 3 commits into from
Aug 30, 2024
Merged
Changes from 1 commit
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
10 changes: 6 additions & 4 deletions src/histograms/charts/AbstractChart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ export abstract class AbstractChart extends AbstractHistogram {
this.initializeDescriptionValues(minMaxBorders[0], minMaxBorders[1], this.histogramParams.bucketRange);
this.initializeChartDimensions();
this.customizeData(data);
const extendData = this.extendData(data);
this.createChartAxes(extendData);
const extendedData = this.extendData(data);
this.createChartAxes(extendedData);
this.drawChartAxes(this.chartAxes, 0);
this.plotChart(data);
this.showTooltips(data);
Expand Down Expand Up @@ -895,8 +895,10 @@ export abstract class AbstractChart extends AbstractHistogram {
}

extendedData = extendedData.concat(data);
if (+data[data.length - 1].key < +this.selectionInterval.endvalue) {
let fakeDataKey = +data[data.length - 1].key;
// We need to add a bucket only if the start of the next bucket
// is not in the data but included in the selection
if (+data[data.length - 1].key + bucketSize < +this.selectionInterval.endvalue) {
let fakeDataKey = +data[data.length - 1].key + bucketSize;
while (fakeDataKey < +this.selectionInterval.endvalue) {
fakeDataKey += +bucketSize;
if (this.histogramParams.dataType === DataType.numeric) {
Expand Down
Loading