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

How to customize charts with different color palettes and tooltips #2779

Open
theWitchR opened this issue Nov 18, 2024 · 0 comments
Open

How to customize charts with different color palettes and tooltips #2779

theWitchR opened this issue Nov 18, 2024 · 0 comments

Comments

@theWitchR
Copy link

Reproduction link

Edit on CodeSandbox

Steps to reproduce

I'm trying to customize the charts, but I could not find proper documentation.
Screenshot 2024-11-16 085952

I want to number format the tooltip as well.

This is what I tried:

  data: aggregateDataByYearAndQuarter('COLUMN'),
  xField: 'YEAR',
  yField: 'value',
  height: 400,
  padding: 'auto',
  colorField: 'QUARTER',
  stack: true,
  axis: {
    x:{
      title: 'Year',
    },
    y:{
      title: '$',
      labelFormatter: formatNumber
    }
  },
  tooltip: {
    title: (data) => `${data.YEAR}`,
    fields: ['QUARTER', 'value'],
    formatter: (data) => ({
      
      name: data.QUARTER,
      value: formatNumber(data.value),
    }),
    
    itemSorter: (a, b) => {
      const quarterOrder = { 'Q1': 1, 'Q2': 2, 'Q3': 3, 'Q4': 4 };
      return quarterOrder[a.name] - quarterOrder[b.name];
    },
  },
  legend: {
    position: 'top-right'
  },
  smooth: true,
  animation: {
    appear: {
      animation: 'path-in',
      duration: 800,
    },
  },
};```


Where can I find proper documentation for this?

### What is expected?

Change in color palette and formatting the numbers in the tooltip


### What is actually happening?

Nothing is happening

| Environment | Info |
| --- | --- |
| antd | 5.22.1 |
| React | 18.3.1 |
| System | Windows 10 |
| Browser | Edge |

<!-- generated by ant-design-issue-helper. DO NOT REMOVE -->
@afc163 afc163 transferred this issue from ant-design/ant-design Nov 18, 2024
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

No branches or pull requests

1 participant