Skip to content
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
9 changes: 7 additions & 2 deletions src/coord/axisTickLabelBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,11 @@ export function createAxisLabels(axis: Axis): {
const custom = axis.getLabelModel().get('customValues');
if (custom) {
const labelFormatter = makeLabelFormatter(axis);
const extent = axis.scale.getExtent();
const tickNumbers = tickValuesToNumbers(axis, custom);
const ticks = zrUtil.filter(tickNumbers, val => val >= extent[0] && val <= extent[1]);
return {
labels: tickValuesToNumbers(axis, custom).map(numval => {
labels: zrUtil.map(ticks, numval => {
const tick = {value: numval};
return {
formattedLabel: labelFormatter(tick),
Expand Down Expand Up @@ -115,8 +118,10 @@ export function createAxisTicks(axis: Axis, tickModel: AxisBaseModel): {
} {
const custom = axis.getTickModel().get('customValues');
if (custom) {
const extent = axis.scale.getExtent();
const tickNumbers = tickValuesToNumbers(axis, custom);
return {
ticks: tickValuesToNumbers(axis, custom)
ticks: zrUtil.filter(tickNumbers, val => val >= extent[0] && val <= extent[1])
};
}
// Only ordinal scale support tick interval
Expand Down
186 changes: 186 additions & 0 deletions test/axis-customTicks.html

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