Skip to content

Commit

Permalink
feat: experimental bucket width calculation
Browse files Browse the repository at this point in the history
Signed-off-by: Manik Rana <[email protected]>
  • Loading branch information
Maniktherana committed May 31, 2024
1 parent 5d33e31 commit ee71a57
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion web/ui/react-app/src/pages/graph/HistogramChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ const RenderHistogramBars: FC<RenderHistogramProps> = ({
const count = parseFloat(b[3]);
const bucketIdx = `bucket-${index}-${bIdx}-${Math.ceil(parseFloat(b[3]) * 100)}`;

const expBucketWidth = Math.abs(Math.log(Math.abs(right)) - Math.log(Math.abs(left))); //bw

let bucketWidth = '';
let bucketLeft = '';
let bucketHeight = '';
Expand All @@ -212,7 +214,7 @@ const RenderHistogramBars: FC<RenderHistogramProps> = ({
bucketHeight = (fds[bIdx] / fdMax) * 100 + '%';
break;
case 'exponential':
bucketWidth = (bw / widthTotal) * 100 + '%';
bucketWidth = ((expBucketWidth === 0 ? bw : expBucketWidth) / widthTotal) * 100 + '%';
if (left < 0) {
// negative buckets boundary
bucketLeft = (-(Math.log(Math.abs(left)) + startNegative) / widthTotal) * 100 + '%';
Expand Down

0 comments on commit ee71a57

Please sign in to comment.