Skip to content

Commit

Permalink
fix: wippp
Browse files Browse the repository at this point in the history
  • Loading branch information
MAudelGisaia committed Jan 30, 2025
1 parent f4bb146 commit 1eebd80
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/histograms/charts/AbstractChart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export abstract class AbstractChart extends AbstractHistogram {

private reFunc = null;
private meanSIze = 0;
private t = null;

public plot(inputData: Array<HistogramData>) {
super.init();
Expand Down Expand Up @@ -243,17 +244,20 @@ export abstract class AbstractChart extends AbstractHistogram {
const t = this.histogramParams.xTicks;
let c = v;
let tc = t;
const fc = this.xLabelsAxis.selectAll('text').size();
return ( count) => {
console.error('original x axis label', v)
console.error('original x axis label', count)
c = (v / (v / count));
tc = (tc / (tc / count));
return {label:c, tick: tc};
return {label:c, tick: tc, prec: (count / fc) * 100, ori: v};
}
}

public resize(histogramContainer: HTMLElement): void {
this.histogramParams.histogramContainer = histogramContainer;
let isBigger = false;
if (this.isWidthFixed === false && this.plottingCount > 0) {
isBigger = this.histogramParams.histogramContainer.offsetWidth > this.histogramParams.chartWidth;
this.histogramParams.chartWidth = this.histogramParams.histogramContainer.offsetWidth;

// this.refreshData();
Expand All @@ -271,13 +275,16 @@ export abstract class AbstractChart extends AbstractHistogram {
this.reFunc = this.resized();
this.meanSIze = this.getLabelMeanWidth();
console.error(this.meanSIze)
this.t = scaleLinear().domain([0,100])
.range([this.histogramParams.xLabels, 0]);
}


const res = this.reFunc(overlapCount);
// const t = this.histogramParams.chartWidth / res.label * this.meanSIze;
this.histogramParams.xLabels = res.label;
this.histogramParams.xTicks = res.tick;
console.error(res, this.t(res.prec))
const t = this.histogramParams.chartWidth / this.meanSIze;
this.histogramParams.xLabels = this.t(res.prec);
this.histogramParams.xTicks = this.t(res.prec);
}

if (this.isHeightFixed === false && this.plottingCount > 0) {
Expand Down

0 comments on commit 1eebd80

Please sign in to comment.