Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(inset): relative position for text in polar #5223

Merged
merged 1 commit into from
Jun 25, 2023
Merged

Conversation

pearmini
Copy link
Member

Inset

修复 polar 下相对位置的设置失败。

开始使用

Before After
export function population2015IntervalDonutTextAnnotationInset(): G2Spec {
  return {
    type: 'view',
    height: 640,
    inset: 50,
    coordinate: { type: 'theta', innerRadius: 0.6 },
    style: {
      viewFill: '#4e79a7',
      plotFill: '#f28e2c',
      mainFill: '#e15759',
      contentFill: '#76b7b2',
    },
    children: [
      {
        type: 'interval',
        data: {
          type: 'fetch',
          value: 'data/population2015.csv',
        },
        transform: [{ type: 'stackY' }],
        scale: {
          color: {
            palette: 'spectral',
            offset: (t) => t * 0.8 + 0.1,
          },
        },
        legend: false,
        encode: {
          y: 'value',
          color: 'name',
        },
      },
      {
        type: 'text',
        style: {
          text: 'Donut',
          // Relative position.
          x: '50%',
          y: '50%',
          fontSize: 40,
          textAlign: 'center',
          fontWeight: 'bold',
        },
      },
      {
        type: 'text',
        style: {
          text: 'chart',
          // Absolute position.
          x: 290,
          y: 320,
          fontSize: 20,
          textAlign: 'center',
          fontWeight: 'bold',
        },
      },
    ],
  };
}

@pearmini pearmini requested a review from hustcc June 25, 2023 02:32
@pearmini pearmini merged commit 567717b into v5 Jun 25, 2023
3 checks passed
@pearmini pearmini deleted the fix/polar-shape-inset branch June 25, 2023 02:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants