提交 d5ea9373 编写于 作者: O Ovilia

fix(markArea): fix situations when dims is not defined

上级 dc3a694c
...@@ -99,13 +99,13 @@ class BaseBarSeriesModel<Opts extends BaseBarSeriesOption<unknown> = BaseBarSeri ...@@ -99,13 +99,13 @@ class BaseBarSeriesModel<Opts extends BaseBarSeriesOption<unknown> = BaseBarSeri
if (startingAtTick) { if (startingAtTick) {
each(coordSys.getAxes(), function (axis: Axis2D, idx: number) { each(coordSys.getAxes(), function (axis: Axis2D, idx: number) {
// If axis type is category, use tick coords instead // If axis type is category, use tick coords instead
if (axis.type === 'category') { if (axis.type === 'category' && dims != null) {
const tickCoords = axis.getTicksCoords(); const tickCoords = axis.getTicksCoords();
let targetTickId = clampData[idx]; let targetTickId = clampData[idx];
// The index of rightmost tick of markArea is 1 larger than x1/y1 index // The index of rightmost tick of markArea is 1 larger than x1/y1 index
const isEnd = dims[idx] === 'x1' || dims[idx] === 'y1'; const isEnd = dims[idx] === 'x1' || dims[idx] === 'y1';
if (dims && isEnd) { if (isEnd) {
targetTickId += 1; targetTickId += 1;
} }
......
...@@ -105,14 +105,14 @@ export function dataTransform( ...@@ -105,14 +105,14 @@ export function dataTransform(
const data = seriesModel.getData(); const data = seriesModel.getData();
const coordSys = seriesModel.coordinateSystem; const coordSys = seriesModel.coordinateSystem;
const dims = coordSys.dimensions; const dims = coordSys?.dimensions;
// 1. If not specify the position with pixel directly // 1. If not specify the position with pixel directly
// 2. If `coord` is not a data array. Which uses `xAxis`, // 2. If `coord` is not a data array. Which uses `xAxis`,
// `yAxis` to specify the coord on each dimension // `yAxis` to specify the coord on each dimension
// parseFloat first because item.x and item.y can be percent string like '20%' // parseFloat first because item.x and item.y can be percent string like '20%'
if (!hasXAndY(item) && !isArray(item.coord) && coordSys) { if (!hasXAndY(item) && !isArray(item.coord) && isArray(dims)) {
const axisInfo = getAxisInfo(item, data, coordSys, seriesModel); const axisInfo = getAxisInfo(item, data, coordSys, seriesModel);
// Clone the option // Clone the option
...@@ -144,7 +144,7 @@ export function dataTransform( ...@@ -144,7 +144,7 @@ export function dataTransform(
} }
} }
// x y is provided // x y is provided
if (item.coord == null) { if (item.coord == null || !isArray(dims)) {
item.coord = []; item.coord = [];
} }
else { else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册