Skip to content

Commit

Permalink
fix(heatmap): fix heatmap label may overlap when the dataZoom is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
plainheart committed Nov 6, 2022
1 parent 273f3ed commit 0f86a10
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 6 deletions.
8 changes: 5 additions & 3 deletions src/chart/heatmap/HeatmapView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { StageHandlerProgressParams, Dictionary, OptionDataValue } from '../../u
import type Cartesian2D from '../../coord/cartesian/Cartesian2D';
import type Calendar from '../../coord/calendar/Calendar';
import { setLabelStyle, getLabelStatesModels } from '../../label/labelStyle';
import Element from 'zrender/src/Element';
import type Element from 'zrender/src/Element';

// Coord can be 'geo' 'bmap' 'amap' 'leaflet'...
interface GeoLikeCoordSys extends CoordinateSystem {
Expand Down Expand Up @@ -94,7 +94,7 @@ function getIsInContinuousRange(dataExtent: number[], range: number[]) {

function isGeoCoordSys(coordSys: CoordinateSystem): coordSys is GeoLikeCoordSys {
const dimensions = coordSys.dimensions;
// Not use coorSys.type === 'geo' because coordSys maybe extended
// Not use coordSys.type === 'geo' because coordSys maybe extended
return dimensions[0] === 'lng' && dimensions[1] === 'lat';
}

Expand Down Expand Up @@ -235,6 +235,8 @@ class HeatmapView extends ChartView {

// Ignore empty data and out of extent data
if (isNaN(data.get(dataDims[2], idx) as number)
|| isNaN(dataDimX as number)
|| isNaN(dataDimY as number)
|| dataDimX < xAxisExtent[0]
|| dataDimX > xAxisExtent[1]
|| dataDimY < yAxisExtent[0]
Expand Down Expand Up @@ -271,7 +273,7 @@ class HeatmapView extends ChartView {
});
}

// Optimization for large datset
// Optimization for large dataset
if (data.hasItemOption) {
const itemModel = data.getItemModel<HeatmapDataItemOption>(idx);
const emphasisModel = itemModel.getModel('emphasis');
Expand Down
112 changes: 111 additions & 1 deletion test/heatmap.html

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/__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/heatmap.json

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

0 comments on commit 0f86a10

Please sign in to comment.