Skip to content

Commit 106ff35

Browse files
committed
Move over first part of Barplot code
1 parent 34d5a75 commit 106ff35

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

src/visualizations/barplot/Barplot.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import {BarplotSettings} from "./BarplotSettings";
22
import * as d3 from "d3";
33
import {Bar} from "./Bar";
4+
import BarplotPreprocessor from "./BarplotPreprocessor";
45

56
export default class Barplot {
67
private readonly settings: BarplotSettings;
8+
private readonly data: Bar[];
79

810
private tooltip!: d3.Selection<HTMLDivElement, unknown, HTMLElement, any>;
911

@@ -15,6 +17,9 @@ export default class Barplot {
1517
options: BarplotSettings = new BarplotSettings()
1618
) {
1719
this.settings = this.fillOptions(options);
20+
21+
const preprocessor = new BarplotPreprocessor();
22+
this.data = preprocessor.computeMaxItemsInBars(data, this.settings.maxItems);
1823
}
1924

2025
private fillOptions(options: any = undefined): BarplotSettings {

src/visualizations/barplot/BarplotSettings.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ export class BarplotSettings extends Settings {
7373
*/
7474
barHeight: number = 75;
7575

76+
/**
77+
* Classname that's internally used for the object.
78+
*/
79+
className: string = "barplot";
80+
7681
/**
7782
* Only shows the n largest items in the barplot and moves all the others into a single group "other"
7883
* The order of the items is determined by looking at values in the first bar. Pass undefined into this option

src/visualizations/sunburst/Sunburst.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export default class Sunburst {
105105
}
106106

107107
/**
108-
* Reset the current view of the visualization. The visualization will completely be reset to it's initial state.
108+
* Reset the current view of the visualization. The visualization will completely be reset to its initial state.
109109
*/
110110
public reset() {
111111
this.click(this.data[0]);

0 commit comments

Comments
 (0)