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

feat: html label supported #5354

Merged
merged 5 commits into from
Jul 28, 2023
Merged

feat: html label supported #5354

merged 5 commits into from
Jul 28, 2023

Conversation

hustcc
Copy link
Member

@hustcc hustcc commented Jul 28, 2023

{
  type: 'interval',
  transform: [{ type: 'sortX', by: 'y', reverse: true }],
  data: {
    type: 'fetch',
    value: 'data/alphabet.csv',
  },
  axis: {
    y: { labelFormatter: '.0%' },
  },
  encode: {
    x: 'letter',
    y: 'frequency',
    color: 'steelblue',
  },
  labels: [
    {
      text: 'frequency',
      transform: [
        {
          type: 'overlapHide',
        },
      ],
      className: 'alphabet-labels',
      render: (
        _,
        datum,
      ) => `<div style="left:-50%;top:-16px;position:relative;font-size:12px;">
        <span style="color: blue">${
          datum.letter
        }</span>:<span style="color: black">${datum.frequency.toFixed(
        2,
      )}</span>
      </div>`,
    },
  ],
}

image

@hustcc hustcc requested a review from pearmini July 28, 2023 03:36
@hustcc
Copy link
Member Author

hustcc commented Jul 28, 2023

image

@hustcc hustcc merged commit 64137e1 into v5 Jul 28, 2023
@hustcc hustcc deleted the feat-html-label branch July 28, 2023 13:43
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.

2 participants