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

CSV Export numberFormatter #4538

Merged
merged 5 commits into from
Jun 26, 2024
Merged

CSV Export numberFormatter #4538

merged 5 commits into from
Jun 26, 2024

Conversation

ggrote
Copy link
Contributor

@ggrote ggrote commented Jun 21, 2024

New Pull Request

We needed the numbers in a csv export to be formatted correctly with a comma as a decimal separator. So I thought it would be a good way to implement a numberFormatter like the dateFormatter for the CSV Export.

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Sorry, I don't know how to write unit tests.

@junedchhipa
Copy link
Contributor

@ggrote Thanks for the contribution. Shouldn't you also set the numberFormatter here as well? ln#307 and ln#387

@ggrote
Copy link
Contributor Author

ggrote commented Jun 21, 2024

I thought these lines are only for categories. But you are right they can be numbers too.

@ggrote
Copy link
Contributor Author

ggrote commented Jun 24, 2024

I think that should be it. Any chance to integrate the changes?
And maybe you can answer my question at vue3-apexcharts (apexcharts/vue3-apexcharts#106)?

@junedchhipa
Copy link
Contributor

@ggrote I am thinking of merging datetimeFormatter and numberFormatter together and provide a generic formatter. It is going to be a breaking change, so I am still thinking about it.
Thanks for the contribution.

@ggrote
Copy link
Contributor Author

ggrote commented Jun 26, 2024

Okay, how do you want to know which value should be formatted? By type?
Anything I can help you with?

@junedchhipa junedchhipa merged commit 7d02a91 into apexcharts:main Jun 26, 2024
@junedchhipa
Copy link
Contributor

instead of dateFormatter and numberFormatter, I have used the correct namings.
The new properties will be categoryFormatter for x value and valueFormatter and y values

chart: {
   toolbar: {
       export: {
            csv: {
              categoryFormatter: (cat) => (cat),
              valueFormatter: (val) => (val),
            },
        },
    }
}

Docs will be updated after the new release

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