Skip to content

Commit

Permalink
#3221: Charts | Tree: Use regular tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksashka11 committed Jan 15, 2025
1 parent 095d359 commit c9c7093
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 0 additions & 2 deletions packages/Charts/src/deprecated/viewers/chord/chord-viewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ export class ChordViewer extends EChartViewer {
super();

this.top = this.string('top', '50px');
this.left = this.string('left', '100px');
this.bottom = this.string('bottom', '50px');
this.right = this.string('right', '100px');

this.animationDuration = this.int('animationDuration', 500);
this.animationDurationUpdate = this.int('animationDurationUpdate', 750);
Expand Down
14 changes: 10 additions & 4 deletions packages/Charts/src/viewers/tree/tree-viewer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as DG from 'datagrok-api/dg';
import * as grok from 'datagrok-api/grok';
import * as ui from 'datagrok-api/ui';

import { EChartViewer } from '../echart/echart-viewer';
import { TreeUtils, TreeDataType } from '../../utils/tree-utils';
Expand Down Expand Up @@ -59,10 +60,6 @@ export class TreeViewer extends EChartViewer {
this.fontSize = this.int('fontSize', 12);

this.option = {
tooltip: {
trigger: 'item',
triggerOn: 'mousemove',
},
series: [
{
type: 'tree',
Expand Down Expand Up @@ -105,6 +102,15 @@ export class TreeViewer extends EChartViewer {
return isMatch;
}
}, params.event!.event, true));
this.chart.on('mouseover', (params: any) => {
const ancestors = params.treeAncestors.filter((item: any) => item.name).map((item: any) => item.name).join('.');
const div = ui.divV([
ui.divText(ancestors),
ui.divText(params.value, { style: { fontWeight: 'bold' } })
]);
ui.tooltip.show(div, params.event.event.x, params.event.event.y);
});
this.chart.on('mouseout', () => ui.tooltip.hide());
}

onPropertyChanged(p: DG.Property | null, render: boolean = true) {
Expand Down

0 comments on commit c9c7093

Please sign in to comment.