Skip to content

Commit

Permalink
Fix lable calculation on chart (close #1963)
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitryAstafyev committed Nov 10, 2023
1 parent 277f29b commit 9343caf
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion application/client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "chipmunk",
"version": "3.10.2",
"version": "3.10.3",
"description": "Logs analyzer tool",
"author": "Dmitry Astafyev",
"scripts": {
Expand Down
3 changes: 1 addition & 2 deletions application/client/src/app/ui/views/toolbar/chart/cursor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,10 @@ export class Cursor {
public rowsRangeByX(x: number): IRange {
const frame = this.to - this.from;
const rate = this.width / frame;
const from = Math.floor(x / rate) + this.from;
if (rate < 1) {
const from = Math.floor(x / rate) + this.from;
return { from, to: from + Math.floor(frame / this.width) };
} else {
const from = Math.floor(x / rate);
return { from, to: from };
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
padding: 2px 4px;
border-radius: 2px;
top: 0;
z-index: 10;
}
&::before{
position: absolute;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<canvas #canvas [attr.width]="rect.width" [attr.height]="rect.height"></canvas>
<span class="pointer" *ngIf="x !== undefined" [ngStyle]="{'left': x}">
<span class="label range" *ngIf="range !== undefined">{{range.from}} - {{range.to}}</span>
<span class="label range" *ngIf="((range !== undefined) && (range.from !== range.to))"
>{{range.from}} - {{range.to}}</span
>
<span class="label range" *ngIf="((range !== undefined) && (range.from === range.to))"
>{{range.from}}</span
>
<span class="label" [ngStyle]="{'background': label.color}" *ngFor="let label of labels">
<span class="wrapped" *ngIf="!label.candle">
<span class="row">{{label.position}}:</span>
Expand All @@ -13,4 +18,4 @@
</span>
</span>
<span class="label more" *ngIf="cutted !== 0">and more {{cutted}}</span>
</span>
</span>
2 changes: 1 addition & 1 deletion application/holder/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "chipmunk",
"version": "3.10.2",
"version": "3.10.3",
"chipmunk": {
"versions": {}
},
Expand Down
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 3.10.3 (10.11.2023)

## Fixes
- Fix labels on chart

# 3.10.2 (30.10.2023)

## Fixes
Expand Down

0 comments on commit 9343caf

Please sign in to comment.