-
Notifications
You must be signed in to change notification settings - Fork 3
Export Function #428
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
base: develop
Are you sure you want to change the base?
Export Function #428
Conversation
NXXR
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great 👍
some small suggestions:
src/components/TopBar/ExportMenu.tsx
Outdated
| const esidLogoSvg = ` | ||
| <svg width="200" height="66" viewBox="0 0 200 66" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
| <rect x="0.125" y="17.4988" width="20.0083" height="30.0125" fill="#EBA73B"/> | ||
| <rect x="6.79395" y="22.501" width="20.0083" height="30.0125" fill="#3998DB"/> | ||
| <path d="M51.7475 52.8252V12.8085H78.7119V19.7841H60.2081V29.3193H77.3246V36.2949H60.2081V45.8496H78.7901V52.8252H51.7475ZM107.147 24.3172C106.99 22.741 106.319 21.5166 105.134 20.6438C103.949 19.771 102.34 19.3347 100.308 19.3347C98.927 19.3347 97.7612 19.5301 96.8103 19.9209C95.8594 20.2986 95.1299 20.8262 94.6219 21.5035C94.1269 22.1809 93.8794 22.9495 93.8794 23.8092C93.8533 24.5256 94.0031 25.1509 94.3288 25.685C94.6675 26.219 95.1299 26.6815 95.7161 27.0723C96.3023 27.45 96.9796 27.7822 97.7482 28.0688C98.5167 28.3423 99.3374 28.5768 100.21 28.7722L103.805 29.6319C105.551 30.0227 107.153 30.5438 108.612 31.1951C110.071 31.8464 111.335 32.6475 112.403 33.5984C113.471 34.5493 114.298 35.6696 114.884 36.9592C115.483 38.2488 115.79 39.7273 115.803 41.3946C115.79 43.8436 115.164 45.9669 113.927 47.7645C112.702 49.5491 110.931 50.9364 108.612 51.9264C106.306 52.9034 103.525 53.3918 100.269 53.3918C97.0382 53.3918 94.2246 52.8968 91.8277 51.9068C89.4439 50.9168 87.5812 49.4514 86.2395 47.5105C84.9108 45.5565 84.2139 43.1402 84.1487 40.2614H92.3358C92.4269 41.6031 92.8112 42.7233 93.4886 43.6221C94.179 44.5079 95.0973 45.1788 96.2436 45.6347C97.403 46.0776 98.7121 46.299 100.171 46.299C101.604 46.299 102.848 46.0906 103.903 45.6738C104.971 45.2569 105.798 44.6773 106.385 43.9348C106.971 43.1923 107.264 42.3391 107.264 41.3751C107.264 40.4763 106.997 39.7208 106.463 39.1085C105.942 38.4963 105.173 37.9753 104.157 37.5454C103.154 37.1155 101.923 36.7247 100.464 36.373L96.1069 35.2788C92.7331 34.4582 90.0692 33.1751 88.1152 31.4296C86.1613 29.684 85.1908 27.3328 85.2039 24.3758C85.1908 21.9529 85.8356 19.8362 87.1383 18.0255C88.4539 16.2149 90.2581 14.8015 92.5507 13.7855C94.8433 12.7694 97.4486 12.2614 100.366 12.2614C103.336 12.2614 105.929 12.7694 108.143 13.7855C110.371 14.8015 112.103 16.2149 113.341 18.0255C114.578 19.8362 115.216 21.9334 115.255 24.3172H107.147ZM129.954 12.8085V52.8252H121.493V12.8085H129.954ZM151.1 52.8252H136.915V12.8085H151.218C155.243 12.8085 158.708 13.6096 161.613 15.2119C164.518 16.8011 166.752 19.0872 168.315 22.0702C169.891 25.0532 170.679 28.6224 170.679 32.7778C170.679 36.9462 169.891 40.5284 168.315 43.5244C166.752 46.5205 164.505 48.8196 161.574 50.4218C158.656 52.0241 155.165 52.8252 151.1 52.8252ZM145.375 45.5761H150.749C153.25 45.5761 155.354 45.1332 157.06 44.2474C158.779 43.3486 160.069 41.9613 160.929 40.0855C161.802 38.1967 162.238 35.7608 162.238 32.7778C162.238 29.8208 161.802 27.4044 160.929 25.5287C160.069 23.6529 158.786 22.2721 157.08 21.3863C155.373 20.5005 153.269 20.0576 150.768 20.0576H145.375V45.5761Z" fill="#333B4E"/> | ||
| <rect x="18.4658" y="12.4966" width="20.0083" height="30.0125" fill="#543CF0"/> | ||
| </svg`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you use the raw svg string here hardcoded? can't we take the logo from our assets?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I received this error in the console when i import the pdf and use ContentImage type from pdfmake:
Uncaught (in promise) Invalid image: File 'assets/logo/logo-200x66.png' not found in virtual file system
Images dictionary should contain dataURL entries (or local file paths in node.js)
If SVG, somehow only the raw data works, maybe something to do with how pdfmake library processes content image / svg.
When importing from the asset directly using "import" I received this error in the console:
Uncaught (in promise) Error: SVGMeasure: Error: Non-whitespace before first tag.
Line: 0
Column: 1
Char: /
parseSVG svgMeasure.js:21
measureSVG svgMeasure.js:36
measureSVG docMeasure.js:212
You could check out the docs for pdfmake here:
https://pdfmake.github.io/docs/0.1/document-definition-object/svgs/
https://pdfmake.github.io/docs/0.1/document-definition-object/images/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try importing the svg explicitly
You should be able to import the logo either
with ?url to get the asset as a URL which should satisfy the error message,
or with ?raw to get the raw svg path which should be the same as your hardcoded version 🤔
Vite is crazy convenient :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh thanks it worked :D
…oks, now able to export multiple amchart components
4c4e705 to
474bf8d
Compare
Created an export button that exports the current data shown on the esid dashboard as a PDF
Description
This PR creates an export function that exports the Heatmap, LineChart and relevant data based on the selected and reference data. The export button can be found on the TopBar (Hamburger) menu, and the user could choose between PDF and .csv export format.
Related Issues
Design Decisions
Performance & Quality
Checklist
I, the author of this PR checked the following requirements for good software quality:
I, the reviewer checked the following things: