Skip to content
Closed
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
1 change: 1 addition & 0 deletions src/component/axisPointer/AxisPointerModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class AxisPointerModel extends ComponentModel<AxisPointerOption> {
snap: false,
triggerTooltip: true,
triggerEmphasis: true,
triggerOnNull: false,

value: null,
status: null, // Init value depends on whether handle is used.
Expand Down
5 changes: 3 additions & 2 deletions src/component/axisPointer/axisTrigger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,14 @@ export default function axisTrigger(
each(coordSysAxesInfo.coordSysAxesInfo[coordSysKey], function (axisInfo, key) {
const axis = axisInfo.axis;
const inputAxisInfo = findInputAxisInfo(inputAxesInfo, axisInfo);
const triggerOnNull = axisInfo.triggerOnNull;
// If no inputAxesInfo, no axis is restricted.
if (!shouldHide && coordSysContainsPoint && (!inputAxesInfo || inputAxisInfo)) {
if (coordSysContainsPoint && (triggerOnNull || (!shouldHide && (!inputAxesInfo || inputAxisInfo)))) {
let val = inputAxisInfo && inputAxisInfo.value;
if (val == null && !isIllegalPoint) {
val = axis.pointToData(point);
}
val != null && processOnAxis(axisInfo, val, updaters, false, outputPayload);
(triggerOnNull || val != null) && processOnAxis(axisInfo, val, updaters, false, outputPayload);
}
});
});
Expand Down
4 changes: 4 additions & 0 deletions src/component/axisPointer/modelHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ interface AxisInfo {
axisPointerModel: Model<CommonAxisPointerOption>
triggerTooltip: boolean
triggerEmphasis: boolean
triggerOnNull: boolean
involveSeries: boolean
snap: boolean
useHandle: boolean
Expand Down Expand Up @@ -89,6 +90,7 @@ export function collect(ecModel: GlobalModel, api: ExtensionAPI) {
* axisPointerModel,
* triggerTooltip,
* triggerEmphasis,
* triggerOnNull,
* involveSeries,
* snap,
* seriesModels,
Expand Down Expand Up @@ -197,6 +199,7 @@ function collectAxesInfo(result: CollectionResult, ecModel: GlobalModel, api: Ex

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

Expand All @@ -208,6 +211,7 @@ function collectAxesInfo(result: CollectionResult, ecModel: GlobalModel, api: Ex
axisPointerModel: axisPointerModel,
triggerTooltip: triggerTooltip,
triggerEmphasis: triggerEmphasis,
triggerOnNull: triggerOnNull,
involveSeries: involveSeries,
snap: snap,
useHandle: isHandleTrigger(axisPointerModel),
Expand Down
2 changes: 2 additions & 0 deletions src/util/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1380,6 +1380,8 @@ export interface CommonAxisPointerOption {

triggerEmphasis?: boolean

triggerOnNull?: boolean

/**
* current value. When using axisPointer.handle, value can be set to define the initial position of axisPointer.
*/
Expand Down
154 changes: 154 additions & 0 deletions test/axisPointer-triggerOnNull-snap.html

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

154 changes: 154 additions & 0 deletions test/axisPointer-triggerOnNull.html

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

2 changes: 2 additions & 0 deletions test/runTest/actions/__meta__.json

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

1 change: 1 addition & 0 deletions test/runTest/actions/axisPointer-triggerOnNull-snap.json

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

1 change: 1 addition & 0 deletions test/runTest/actions/axisPointer-triggerOnNull.json

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