Skip to content

Commit

Permalink
Merge pull request #18524 from juliepagano/fix-18495
Browse files Browse the repository at this point in the history
feat(axisPointer): add option to disable emphasis. close #18495
  • Loading branch information
Ovilia committed Apr 19, 2023
2 parents f5bb3b0 + 8041cde commit 6b4f895
Show file tree
Hide file tree
Showing 7 changed files with 225 additions and 4 deletions.
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.

0 comments on commit 6b4f895

Please sign in to comment.