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

feat(axisPointer): add triggerEmphasis option to disable emphasis #18524

Merged
merged 2 commits into from Apr 19, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions src/component/axisPointer/AxisPointerModel.ts
Expand Up @@ -88,6 +88,7 @@ class AxisPointerModel extends ComponentModel<AxisPointerOption> {
// see `modelHelper`.
snap: false,
triggerTooltip: true,
triggerEmphasis: true,

value: null,
status: null, // Init value depends on whether handle is used.
Expand Down
2 changes: 1 addition & 1 deletion src/component/axisPointer/axisTrigger.ts
Expand Up @@ -462,7 +462,7 @@ function dispatchHighDownActually(
// Build hash map and remove duplicate incidentally.
each(axesInfo, function (axisInfo, key) {
const option = axisInfo.axisPointerModel.option;
option.status === 'show' && each(option.seriesDataIndices, function (batchItem) {
option.status === 'show' && axisInfo.triggerEmphasis && each(option.seriesDataIndices, function (batchItem) {
const key = batchItem.seriesIndex + ' | ' + batchItem.dataIndex;
newHighlights[key] = batchItem;
});
Expand Down
4 changes: 4 additions & 0 deletions src/component/axisPointer/modelHelper.ts
Expand Up @@ -49,6 +49,7 @@ interface AxisInfo {
coordSys: CoordinateSystemMaster
axisPointerModel: Model<CommonAxisPointerOption>
triggerTooltip: boolean
triggerEmphasis: boolean
involveSeries: boolean
snap: boolean
useHandle: boolean
Expand Down Expand Up @@ -87,6 +88,7 @@ export function collect(ecModel: GlobalModel, api: ExtensionAPI) {
* coordSys,
* axisPointerModel,
* triggerTooltip,
* triggerEmphasis,
* involveSeries,
* snap,
* seriesModels,
Expand Down Expand Up @@ -194,6 +196,7 @@ function collectAxesInfo(result: CollectionResult, ecModel: GlobalModel, api: Ex
: axisPointerModel;

const snap = axisPointerModel.get('snap');
const triggerEmphasis = axisPointerModel.get('triggerEmphasis');
const axisKey = makeKey(axis.model);
const involveSeries = triggerTooltip || snap || axis.type === 'category';

Expand All @@ -204,6 +207,7 @@ function collectAxesInfo(result: CollectionResult, ecModel: GlobalModel, api: Ex
coordSys: coordSys,
axisPointerModel: axisPointerModel,
triggerTooltip: triggerTooltip,
triggerEmphasis: triggerEmphasis,
involveSeries: involveSeries,
snap: snap,
useHandle: isHandleTrigger(axisPointerModel),
Expand Down
2 changes: 2 additions & 0 deletions src/util/types.ts
Expand Up @@ -1376,6 +1376,8 @@ export interface CommonAxisPointerOption {

triggerTooltip?: boolean

triggerEmphasis?: boolean

/**
* current value. When using axisPointer.handle, value can be set to define the initial position of axisPointer.
*/
Expand Down
2 changes: 1 addition & 1 deletion test/runTest/actions/__meta__.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion test/runTest/actions/tooltip-axisPointer2.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

216 changes: 215 additions & 1 deletion test/tooltip-axisPointer2.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.