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(addon-charts): LineDaysChart fix hint circle not disappearing, fix wrong hover index #4178

Merged
merged 1 commit into from
Apr 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {
AfterContentInit,
AfterViewInit,
ContentChildren,
Directive,
ElementRef,
Expand Down Expand Up @@ -42,7 +42,7 @@ import {TuiLineChartComponent} from './line-chart.component';
selector: '[tuiLineChartHint]',
providers: [TuiDestroyService, TuiHoveredService],
})
export class TuiLineChartHintDirective implements AfterContentInit {
export class TuiLineChartHintDirective implements AfterViewInit {
@ContentChildren(forwardRef(() => TuiLineChartComponent))
private readonly charts: QueryList<TuiLineChartComponent> = EMPTY_QUERY;

Expand All @@ -60,7 +60,7 @@ export class TuiLineChartHintDirective implements AfterContentInit {
@Inject(TuiHoveredService) private readonly hovered$: Observable<boolean>,
) {}

ngAfterContentInit(): void {
ngAfterViewInit(): void {
combineLatest([tuiLineChartDrivers(this.charts), this.hovered$])
.pipe(
filter(result => !result.some(Boolean)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
tuiZoneOptimized,
} from '@taiga-ui/cdk';
import {
TuiDriver,
TuiHintHoverDirective,
TuiHintOptionsDirective,
tuiHintOptionsProvider,
TuiPoint,
Expand All @@ -49,7 +49,7 @@ export class TuiLineChartComponent {

private readonly autoIdString: string;

@ViewChildren(TuiDriver)
@ViewChildren(TuiHintHoverDirective)
readonly drivers: QueryList<Observable<boolean>> = EMPTY_QUERY;

@Input('value')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
class="axes"
[verticalLines]="4"
[horizontalLines]="2"
[tuiLineChartHint]="hintContent"
>
<tui-line-chart
[x]="0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {Component} from '@angular/core';
import {changeDetection} from '@demo/emulate/change-detection';
import {encapsulation} from '@demo/emulate/encapsulation';
import {TUI_DEFAULT_STRINGIFY} from '@taiga-ui/cdk';
import {TUI_DEFAULT_STRINGIFY, TuiContextWithImplicit} from '@taiga-ui/cdk';
import {TuiPoint} from '@taiga-ui/core';

@Component({
Expand All @@ -23,4 +23,8 @@ export class TuiLineChartExample1 {
];

readonly stringify = TUI_DEFAULT_STRINGIFY;

readonly hintContent = ({
$implicit,
}: TuiContextWithImplicit<readonly TuiPoint[]>): number => $implicit[0][1];
}