legend.js 466 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
import { globalConfig } from './global';

export const buildDefaultLegend = (option) => {
  const { title } = option;

  let paddingRight = 0;
  if (title && title.show) paddingRight = 80; // 给标题留够空间

  return {
    show: true,
    right: 20,
    top: 20,
    icon: 'rect',
    itemWidth: 14,
    itemHeight: 8,
    itemGap: 20,
    padding: [0, 0, 0, paddingRight],
    textStyle: {
      padding: [0, 0, 0, 4],
      color: '#2d2d2d',
    },
  };
};