Skip to content

Commit

Permalink
feat: 子弹图为空时使用placeholder占位 (#2010)
Browse files Browse the repository at this point in the history
Co-authored-by: 沫君 <[email protected]>
  • Loading branch information
lcx-seima and 沫君 authored Dec 22, 2022
1 parent 57cd4c9 commit 8d28254
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions packages/s2-core/src/utils/g-mini-charts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { CellTypes, MiniChartTypes } from '../common/constant';
import { parseNumberWithPrecision } from '../utils/formatter';
import { getIntervalScale } from '../utils/condition/condition';
import type { DataCell } from '..';
import { getEllipsisText } from './text';
import { getEllipsisText, getEmptyPlaceholder } from './text';

interface FractionDigitsOptions {
min: number;
Expand Down Expand Up @@ -284,13 +284,22 @@ export const drawInterval = (cell: DataCell) => {
* 绘制单元格内的 mini子弹图
*/
export const drawBullet = (value: BulletValue, cell: S2CellType) => {
const dataCellStyle = cell.getStyle(CellTypes.DATA_CELL);
const { x, y, height, width, spreadsheet } = cell.getMeta();

if (isEmpty(value)) {
renderText(
cell,
[],
x + width - dataCellStyle.cell.padding.right,
height / 2,
getEmptyPlaceholder(cell, spreadsheet.options.placeholder),
dataCellStyle.text,
);
return;
}

const dataCellStyle = cell.getStyle(CellTypes.DATA_CELL);
const bulletStyle = dataCellStyle.miniChart.bullet;
const { x, y, height, width, spreadsheet } = cell.getMeta();
const { progressBar, comparativeMeasure, rangeColors, backgroundColor } =
bulletStyle;

Expand Down

1 comment on commit 8d28254

@vercel
Copy link

@vercel vercel bot commented on 8d28254 Dec 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

antvis-s2 – ./

antvis-s2.vercel.app
antvis-s2-git-master-antv-s2.vercel.app
antvis-s2-antv-s2.vercel.app

Please sign in to comment.